AgentMax05 / cpp_chess_bot

A UCI chess engine made in C++.
MIT License
0 stars 1 forks source link

Refactor move_generation.cpp #1

Closed AgentMax05 closed 3 years ago

AgentMax05 commented 3 years ago

move_generation.cpp can be refactored to be made a lot smaller with a new function:

void add_move(int i, int x, vector<Move> &moves, int move_piece, int move_type = REGULAR_MOVE) {
  Bitboard new_board;
  Move new_move;

  new_board[i] = 1;
  new_board[x] = 1;

  new_move.type = move_type; 
  new_move.move = new_board;
  new_move.piece = move_piece;

  moves.push_back(new_move);
}
jamiely commented 3 years ago

@AgentMax05 I'll take this if you'd like since it is fairly mechanical.