fix new game and undo, detects check and checkmate, fix legal moves for king