warchron_app/src/warchron/model/round.py

33 lines
790 B
Python
Raw Normal View History

2026-01-21 07:43:04 +01:00
from uuid import uuid4
2026-01-19 18:55:07 +01:00
class Round:
2026-01-21 07:43:04 +01:00
def __init__(self):
self.id = str(uuid4())
2026-01-19 18:55:07 +01:00
self.sectors = {}
self.choices = {}
self.battles = {}
self.is_over = False
2026-01-21 07:43:04 +01:00
def set_id(self, new_id):
self.id = new_id
2026-01-19 18:55:07 +01:00
def set_state(self, new_state):
self.is_over = new_state
def toDict(self):
return {
"sectors" : self.sectors,
"choices" : self.choices,
"battles" : self.battles,
"is_over": self.is_over
}
@staticmethod
2026-01-21 07:43:04 +01:00
def fromDict(id, sectors, choices, battles, is_over):
tmp = Round()
tmp.set_id(id)
2026-01-19 18:55:07 +01:00
## sectors placeholder
## choices placeholder
## battles placeholder
tmp.set_state(is_over)
return tmp