quoridor.board_state#

Board state module.

Classes

BoardState([first_player])

BoardState object is used to play at one instant.

Player(player_number)

Player data holder.

class quoridor.board_state.BoardState(first_player: int = 0)#

BoardState object is used to play at one instant.

A game is a succession of BoardState. Methods to pass from one BoardState to an other are declared here.

__init__(first_player: int = 0) None#

Initialize the board state as the begining of a game.

Paramètres:

first_player – the first player to play. Player 0 start from bottom and player 1 at top (j=BOARD_SIZE - 1).

add_new_wall(new_position: tuple[int, int, int]) None#

Add wall.

Modify wall possibilities, update free_paths, update player remaining walls number.

Paramètres:
  • new_position – (i,j,0) or (i,j,1)

  • player_number – int

Renvoie:

get_back(n: int = 1) None#

Reset game to n coup before.

property last_player: Player#

The player who just played.

property last_player_nb: int#

The id of the player which just played.

property next_player_nb: int#

The id of the player currently playing.

property player: Player#

Current player.

remove_wall(new_position: tuple[int, int, int]) None#

Undo an add wall operation.

Add one wall in remaining player walls, update wall possibilities, update free_paths. update walls. If last int is 9, wall is horizontal, otherwise it is vertical.

Paramètres:
  • new_position

  • player_number

Renvoie:

reset_player_position(last_pos: tuple[int, int, int]) None#

Reset player position to last position.

Paramètres:
  • new_position – [i,j,-1]

  • player_number – int

Renvoie:

to_universal_state(i_)#

Supposed to be a universal representation.

update_player_positions(new_position: tuple[int, int, int]) None#

Update player position and actualize the winner.

Paramètres:
  • new_position – [i,j,-1]

  • player_number – int

Renvoie:

class quoridor.board_state.Player(player_number: int)#

Player data holder.

__init__(player_number: int) None#

Player class initialisation.

Each player gets a name, a number of wall, a position (i,j) and a position k.

Paramètres:

player_number

property k_pos: int#

Transforms the position to a signle int.

n_tuiles: int#
name: int#
position: tuple[int, int]#