diff --git a/.editorconfig b/.editorconfig index 53b061a..9abb7cc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,6 @@ indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true -insert_final_newline = true \ No newline at end of file +insert_final_newline = true +[*.py] +indent_size = 4 diff --git a/gothok/init b/gothok/init new file mode 100755 index 0000000..b87a857 --- /dev/null +++ b/gothok/init @@ -0,0 +1,32 @@ +#!/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 diff --git a/gothok/state.capnp b/gothok/state.capnp index 153053a..07d4af8 100644 --- a/gothok/state.capnp +++ b/gothok/state.capnp @@ -1,14 +1,15 @@ @0xdcf6fa9421875ce0; enum House { - stark @7; - greyjoy @6; - lannister @5; - targaryen @4; - baratheon @3; - tyrell @2; - tully @1; - varys @0; + stark @8; + greyjoy @7; + lannister @6; + targaryen @5; + baratheon @4; + tyrell @3; + tully @2; + varys @1; + empty @0; } struct Location { @@ -26,7 +27,7 @@ struct Location { } struct Card { - house @0 :House; + house @0 :House = empty; location @1 :Location; }