diff --git a/gothok/init b/gothok/init index b87a857..b46b4a2 100755 --- a/gothok/init +++ b/gothok/init @@ -7,12 +7,9 @@ import random # First let us create all the cards in the game state = game.State.new_message() -# Initialize the cardlist -state.init('cardlist', 36) - # 0-8 indexes as per state.capnp +# TODO: Read the strings out of the state definition houses = ["empty", "varys", "tully", "tyrell", "baratheon", "targaryen", "lannister", "greyjoy", "stark"] - cards = [] for x in xrange(1, 9): @@ -23,10 +20,18 @@ for x in xrange(1, 9): pass random.shuffle(cards) -# print(cards) + +cardlist = state.init('cardlist', 36) for index, card in enumerate(cards): location = game.Location.new_message() - location.board.x = index/6 + location.board.x = index / 6 location.board.x = index % 6 - cards[index].location = location + card.location = location + cardlist[index] = card + +# print(state) + +# Now we have an initial state of the game, write it down +f = open('state.bin', 'w+b') +state.write(f)