From 7dfcc5282f2afc908360a59a04aaca842dfcc05a Mon Sep 17 00:00:00 2001 From: Nemo Date: Sun, 28 Jan 2018 05:52:14 +0530 Subject: [PATCH] Adds initial state generation --- gothok/init | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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)