class SavedGame(BaseEntity): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(120), default=lambda: str(datetime.datetime.utcnow())) agent_model_snapshot_id = db.Column( db.Integer, db.ForeignKey("agent_model_snapshot.id")) agent_model_snapshot = db.relationship("AgentModelSnapshot") user_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False) user = db.relationship("User")
class AgentModelSnapshot(BaseEntity): id = db.Column(db.Integer, primary_key=True) agent_model_state_id = db.Column(db.Integer, db.ForeignKey("agent_model_state.id")) agent_model_state = db.relationship("AgentModelState", backref=db.backref( "agent_model_snapshot", uselist=False)) snapshot_branch_id = db.Column(db.Integer, db.ForeignKey("snapshot_branch.id")) snapshot_branch = db.relationship("SnapshotBranch", backref=db.backref( "agent_model_snapshots", lazy=True))
class AgentState(BaseEntity): id = db.Column(db.Integer, primary_key=True) pos_x = db.Column(db.Integer, nullable=True) pos_y = db.Column(db.Integer, nullable=True) agent_unique_id = db.Column(db.String(120), nullable=False) agent_type_id = db.Column(db.Integer, db.ForeignKey("agent_type.id"), nullable=False) agent_type = db.relationship("AgentType") agent_model_state_id = db.Column(db.Integer, db.ForeignKey("agent_model_state.id"), nullable=False, index=True) agent_model_state = db.relationship("AgentModelState", backref=db.backref("agent_states", lazy=False))
class SnapshotBranch(BaseEntity): id = db.Column(db.Integer, primary_key=True) version_id = db.Column(db.Integer, nullable=False) __mapper_args__ = {"version_id_col": version_id} parent_branch_id = db.Column(db.Integer, db.ForeignKey("snapshot_branch.id")) parent_branch = db.relationship("SnapshotBranch", backref=db.backref("child_branches"), remote_side=[id])
class AgentStateAttribute(BaseEntity): id = db.Column(db.Integer, primary_key=True) agent_state_id = db.Column(db.Integer, db.ForeignKey("agent_state.id"), nullable=False, index=True) agent_state = db.relationship("AgentState", backref=db.backref("agent_state_attributes", lazy=False)) name = db.Column(db.String(80), nullable=False) value = db.Column(db.String(80)) value_type = db.Column(db.String(80))