remove data.py
This commit is contained in:
parent
8f28eacac1
commit
9e6f7b78ce
38
data.py
38
data.py
@ -1,38 +0,0 @@
|
||||
import json
|
||||
|
||||
class Team:
|
||||
def __init__(self, name, country):
|
||||
self.name = name
|
||||
self.country = country
|
||||
self.players = []
|
||||
|
||||
def get_json_state(self):
|
||||
return [self.name, self.country, self.players]
|
||||
|
||||
def addPlayer(self, name, army):
|
||||
self.players.append(Player(name, army))
|
||||
|
||||
class TeamEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, Team):
|
||||
return obj.get_json_state()
|
||||
else:
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
class Player:
|
||||
def __init__(self, name, army):
|
||||
self.name = name
|
||||
self.army = army
|
||||
|
||||
class Terrain:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
class Scenario:
|
||||
def __init__(self, defender, opponent):
|
||||
self.defender = defender
|
||||
self.opponent = opponent
|
||||
self.terrains = []
|
||||
|
||||
def addTerrain(self, name):
|
||||
self.terrains.append(Terrain(name))
|
Loading…
Reference in New Issue
Block a user