#!/usr/bin/env python import capnp import state_capnp as game 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 houses = ["empty", "varys", "tully", "tyrell", "baratheon", "targaryen", "lannister", "greyjoy", "stark"] cards = [] for x in xrange(1, 9): for y in xrange(0, x): card = game.Card.new_message() card.house = houses[x] cards.append(card) pass random.shuffle(cards) # print(cards) for index, card in enumerate(cards): location = game.Location.new_message() location.board.x = index/6 location.board.x = index % 6 cards[index].location = location