Do chess programmes keep a history of the full board for each move? I am creating a chess GUI for UCI engine as a hobby. I keep the history of moved positions (e.g., (4,6) -&gt; (4,4) for the pawn in front of the white king moving forward 2 squares) and the type of the moved piece (e.g., pawn), and some minor states like castling, capturing, etc).
Now I am trying to implement checking for draw conditions. At first, I thought it was about repeated moves, but after seeing the official rules, it seems that it is about repeated positions. Is it practically possible to check for this without keeping the snapshot of the whole board (in my case, a 8x8 integer array, 256 bytes) for each move? I thought about taking a hash value of the board, but even if I take a long value, it can only represent 2^64 values, and according to a quick search, the number of all possible positions is about 10^120, so hash collisions will occur.
You are doing a chess GUI, not a chess engine right?
Chess GUI doesn't need to be super efficient, because you have no more than a chess game to look for. Even a game over 200 moves about the world record is absolutely nothing for a computer.
I would just simply keep your positions with an array of strings like FEN format (or any other format), and then simply linear scan the whole game for repetitions.
If you want to get fancy, try https://marcelk.net/2013-04-06/paper/upcoming-rep-v2.pdf.