Stalemates and three-fold repetition have now been added. Stalemates are calculated if legalMoves(turnColour) returns none but the king is not in check. I find if there is three-fold repetition by storing a hash of the board every move. This is stored in a dictionary as dictionaries are much better than arrays for lookups. After each move I see if that board state is in the dictionary. If it is I increase its value by 1. If not I set its value to 1. I then see how many times its reached that board state and if it is 3 times I end the game and show bright red text saying ‘Three-fold Repetition! Nobody wins!’. The hash includes piece positions, turn colour and castling rights as these are 3 of the 4 criteria that FIDE use. The fourth is en passant however that has not been added yet. Next I will add pawn promotions as this is the last major thing I don’t have.