# coding:utf-8
class Monopoly:
def __init__(self, *players):
self.board = list(self._init_board())
self.players = list(self._init_players(players))
def _init_board(self):
KEYS = ('name', 'color', 'list_price', 'construction_cost', 'remarks')
PROPS = (('GO', 0, 0, 0, 'Starting_point', []),
('Mediterranean Street', 1, 60, 50, 'No_information', []))
return map(lambda prop: dict(zip(KEYS, prop)), PROPS)
def _init_players(self, players):
KEYS = ('name', 'money', 'pos')
return map(lambda name: dict(zip(KEYS, (name, 1500, 0))), players)
game = Monopoly('a', 'b')
print(game.board)
print(game.players)
IyBjb2Rpbmc6dXRmLTgKCmNsYXNzIE1vbm9wb2x5OgogICAgZGVmIF9faW5pdF9fKHNlbGYsICpwbGF5ZXJzKToKICAgICAgICBzZWxmLmJvYXJkID0gbGlzdChzZWxmLl9pbml0X2JvYXJkKCkpCiAgICAgICAgc2VsZi5wbGF5ZXJzID0gbGlzdChzZWxmLl9pbml0X3BsYXllcnMocGxheWVycykpCgogICAgZGVmIF9pbml0X2JvYXJkKHNlbGYpOgogICAgICAgIEtFWVMgPSAoJ25hbWUnLCAnY29sb3InLCAnbGlzdF9wcmljZScsICdjb25zdHJ1Y3Rpb25fY29zdCcsICdyZW1hcmtzJykKICAgICAgICBQUk9QUyA9ICgoJ0dPJywgMCwgMCwgMCwgJ1N0YXJ0aW5nX3BvaW50JywgW10pLAoJCSgnTWVkaXRlcnJhbmVhbiBTdHJlZXQnLCAxLCA2MCwgNTAsICdOb19pbmZvcm1hdGlvbicsIFtdKSkgCiAgICAgICAgcmV0dXJuIG1hcChsYW1iZGEgcHJvcDogZGljdCh6aXAoS0VZUywgcHJvcCkpLCBQUk9QUykKCiAgICBkZWYgX2luaXRfcGxheWVycyhzZWxmLCBwbGF5ZXJzKToKICAgICAgICBLRVlTID0gKCduYW1lJywgJ21vbmV5JywgJ3BvcycpCiAgICAgICAgcmV0dXJuIG1hcChsYW1iZGEgbmFtZTogZGljdCh6aXAoS0VZUywgKG5hbWUsIDE1MDAsIDApKSksIHBsYXllcnMpCgpnYW1lID0gTW9ub3BvbHkoJ2EnLCAnYicpCgpwcmludChnYW1lLmJvYXJkKQpwcmludChnYW1lLnBsYXllcnMp
[{'remarks': 'Starting_point', 'color': 0, 'list_price': 0, 'name': 'GO', 'construction_cost': 0}, {'remarks': 'No_information', 'color': 1, 'list_price': 60, 'name': 'Mediterranean Street', 'construction_cost': 50}]
[{'name': 'a', 'pos': 0, 'money': 1500}, {'name': 'b', 'pos': 0, 'money': 1500}]