Move Generator

Functions

void getMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given piece

Determines which function to call based on the piece type, it may be more efficient to call the appropriate function directly.

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getPawnMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given pawn

See documentation for legalPawnMoves() for more information This function returns all possible moves, and does not check for legality.

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getKnightMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given knight

See documentation for legalKnightMoves() for more information

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getBishopMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given bishop

See documentation for legalBishopMoves() for more information

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getRookMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given rook

See documentation for legalRookMoves() for more information

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getQueenMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given queen

See documentation for legalQueenMoves() for more information

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for

void getKingMoves(std::stack<int> *moves, int *board, int piece)

Generates all legal moves on the board for the given king

See documentation for legalKingMoves() for more information

Parameters:
  • moves – Stack of moves to add to

  • board – List of all pieces and their locations on the board

  • piece – The piece to generate legal moves for