Last active
February 26, 2016 16:37
-
-
Save noroutine/284103fb82dd7404a7e5 to your computer and use it in GitHub Desktop.
Dominion P2P structures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Computed game state | |
*/ | |
type GameState struct { | |
Copper, Silver, Gold int64 // amount of gold cards of value 1, 2 and 3 respectively | |
V1, V3, V6 int64 // amount of victory cards fo value 1, 3, 6 respectively | |
Actions map[string] int64 // amount of 10 action cards from the game box | |
Curse int64 // amount of curse cards | |
Trash []string // trash deck | |
} | |
/** | |
Transaction record | |
*/ | |
type TransactionRecord struct { | |
Id []byte // hash of current transaction | |
Prev []byte // reference to hash of previous transaction in the game | |
Tx []byte // one of areed transaction descriptions (byte representation) | |
Sig []byte // signature of Prev + T | |
} | |
var gameStart TransactionRecord // root of transaction tree (constitues initial game state) | |
var latest TransactionRecord // latest aggreed transaction | |
var txIndex TransactionIndex // index of the transaction database to quickly find transaction by Id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment