game module¶
Generate random match configurations.
Each Area of a Grid
is assigned to a random player seat and gets a random supply of about
three dice. The seat order (i.e. the sequence of the player’s turns)
is randomly shuffled.
All area and seat data are exposed as tuples. Area and seat references are indices into these tuples.
Game instances are immutable and intended to generate
runnable Match instances.
-
class
dicewars.game.Game(grid=None, num_seats=7)¶ Generate a game (assign seat/dice to areas, shuffle seats and calculate seat states).
- Parameters
- Raises
TypeError – if
gridis not a Grid instance ornum_seatsis not intValueError – if
num_seatsis out of range
-
DEFAULT_NUM_SEATS= 7¶ Default for the
num_seatsparameter. (int)
-
AREA_MAX_NUM_DICE= 8¶ Maximal number of dice per area. (int)
-
property
num_seats¶ The number of player seats. (int)
-
property
seat_order¶ The player indices in the order the players will do their turns. (tuple(int))
-
property
area_seats¶ The seat indices assigned to each area. (tuple(int))
-
property
area_num_dice¶ The number of dice supplied to each area. (tuple(int))
-
property
seat_areas¶ The area indices assigned to each seat. (tuple(tuple(int)))
-
property
seat_num_areas¶ The total number of areas assigned to each seat. (tuple(int))
-
property
seat_max_size¶ The maximal number of adjacent areas assigned to each seat. (tuple(int))
-
property
seat_num_dice¶ The total number of dice supplied to each seat’s areas. (tuple(int))