Game package

Submodules

Game.Game module

class Game.Game.Game

Bases: object

attemptKingCastle(playerOne)

This method is called if player wants to do a king side castle

Parameters

playerOne (bool) – Boolean representing if it is playerOne’s attempt

Raises

Exception – raises Exception if you can’t do a castle

attemptQueenCastle(playerOne)

This method is called if player wants to do a queen side castle

Parameters

playerOne (bool) – Boolean representing if it is playerOne’s attempt

Raises

Exception – raises Exception if you can’t do a castle

initGame()

Given a set reprenting player one’s peices, a set w/ player two peices, and a 8 by 8 2d list filled with Nones, this mehtod would autopopulated the sets and lists to reflect the start of the game. All of these inputs are already prebuilt in the start w/ the __init__ method.

initPlayerOne()

This populates the playerOnePieces (black) empty set with the player one’s pieces.It also adds those pieces to the board

initPlayerTwo()

This populates the playerTwoPieces (white) empty set with the player two’s pieces. It also adds those pieces to the board

isCheck(playerOne)

Tests if current Player is in check

Parameters

playerOne (bool) – Boolean representing if it is player one’s turn. False if it is player two’s turn

Returns

Returns a boolean noting if player is in check

Return type

bool

isCheckMate(playerOne)

Tests if current Player is in check mate

Parameters

playerOne (bool) – Boolean representing if it is player one’s turn. False if it is player two’s turn

Returns

Returns a boolean noting if player is in check mate

Return type

bool

pBoard()

Given a 2d list representing the self.board w/ pieces. This function returns a user friendly string depicting the board. The board is already provided because it is a member variable.

resetCheckBoard()

This resets the checkBoard by making all the positions None

startGame()

This function when run on terminal would allow the user to play chess via terminal.

updateCheckBoard(playerOne)

This updated the checkBoard with PlayerTwo checks on PlayerOne if the playerOne paramter is true, and opposite if false :param playerOne: Boolean representing if it is playerOne’s check :type playerOne: bool

Game.gameRunner module

Module contents