Guest User

Untitled

a guest
Feb 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. File: move.h
  2.  
  3. Move utils and move history utils.
  4. Assumes that a history list and the board it's used with are consistent.
  5.  
  6. Boardhistory:
  7. A move event consists of a series of board changes and a "move done",
  8. namely BoardChange.where == (boardsize = move_done), which is pushed last for each move event.
  9.  
  10. Author: Ken Rouwas
  11. Date 2017-09-14
  12.  
  13. const size_t move_done = board_size;
  14.  
  15. struct Move {
  16. ssize_t from;
  17. ssize_t to;
  18. Move(ssize_t, ssize_t);
  19. Move();
  20.  
  21. };
  22.  
  23. struct BoardChange {
  24. size_t where;
  25. Square old_square;
  26. };
  27.  
  28. using Boardhistory = std::list<BoardChange>;
  29. using MoveSet = std::vector<Move>;
  30.  
  31. void undo_move(Board&, Boardhistory&);
  32.  
  33. /* Castling is identified by king move to its castling destination if permitted.
  34. Pawn promotion move deduced.
  35. All other moves are unconditional moves.
  36. */
  37. void do_move(Move, Board&, Boardhistory&, Piece pawn_promotion = Piece::queen);
  38.  
  39. MoveSet valid_moves(Board&, Color turn); // This is the move generator
Add Comment
Please, Sign In to add comment