Game.Pieces package¶
Submodules¶
Game.Pieces.Bishop module¶
-
class
Game.Pieces.Bishop.Bishop(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the Bishop can make
- Returns
A set of the available moves the bishop can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the bishop can make for a king check
- Returns
A set of the available moves the bishop can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.King module¶
-
class
Game.Pieces.King.King(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the king can make
- Returns
A set of the available moves the king can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the king can make for a king check
- Returns
A set of the available moves the king can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.Knight module¶
-
class
Game.Pieces.Knight.Knight(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the knight can make
- Returns
A set of the available moves the knight can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the knight can make for a king check
- Returns
A set of the available moves the knight can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.Pawn module¶
-
class
Game.Pieces.Pawn.Pawn(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the pawn can make
- Returns
A set of the available moves the pawn can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
isPassant(tempOriginalRow, targetRow, targetCol)¶
-
move(targetRow, targetCol)¶ Given a row and column, the piece moves to that location. This is for a pawn specific move to account for en passant cases.
- Parameters
targetRow (int) – The target row
targetCol (str) – The target column
- Returns
Returns true if the move was successfully made with no issue. False if an error occured.
- Return type
bool
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the pawn can make for a king check
- Returns
A set of the available moves the pawn can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.Queen module¶
-
class
Game.Pieces.Queen.Queen(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the queen can make
- Returns
A set of the available moves the queen can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
crossMoves()¶ Returns the possible cross moves the queen can make
- Returns
A set of the available cross moves the queen can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
diagonalMoves()¶ Returns the possible diagonal moves the queen can make
- Returns
A set of the available diagonal moves the queen can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the queen can make for a king check
- Returns
A set of the available moves the queen can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.Rook module¶
-
class
Game.Pieces.Rook.Rook(board, color, group, row, col, game)¶ Bases:
Game.Pieces.piece.Piece-
availableMoves()¶ Returns a set of the avaiable moves the rook can make
- Returns
A set of the available moves the rook can make. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
possibleCapturesCheck()¶ Returns a set of the avaiable moves the queen can make for a king check
- Returns
A set of the available moves the queen can make for check. It is a set of tuples of the rows and colms that the move can move to
- Return type
{(int,str)}
-
Game.Pieces.piece module¶
This is a general class to describe the characteristics that every piece should have
-
class
Game.Pieces.piece.Piece(board, color, group, name, row, col, game)¶ Bases:
object-
availableMoves()¶ returns the available moves of the piece
-
move(targetRow, targetCol)¶ Given a row and column, the piece moves to that location.
- Parameters
targetRow (int) – The target row
targetCol (str) – The target column
- Returns
Returns true if the move was successfully made with no issue. False if an error occured.
- Return type
bool
-
notKing(row, col)¶ Checks if the desired location is a king or not.
- Parameters
row (int) – The desired row
col (str) – The desired column
- Returns
True if the location specified is not a king piece, false if it is.
- Return type
bool
-
possibleCapturesCheck()¶
-
removeFromGroup()¶ This removes the piece from the current player’s set
-
validMove(row, col)¶ Given a desired move of the piece, the method returns true if the player can move the piece to that location.
- Parameters
row (int) – The row of the desired location. Number between 1 to 8
col (str) – The column of the desired location. Letter between A and H.
- Returns
True if the desired moove can be made, or false if it can’t be made.
- Return type
bool
-
validMoveIncludingKing(row, col)¶ - Given a desired move of the piece, the method returns true if the player can move the piece to that location.
This also includes the possibility of capturing a king as well
- Parameters
row (int) – The row of the desired location. Number between 1 to 8
col (str) – The column of the desired location. Letter between A and H.
- Returns
True if the desired moove can be made, or false if it can’t be made.
- Return type
bool
-