Fix for detecting checkmates and stalemates

The `anyMove` function was broken, since we need move legality check in
order to decide whether there is any move on the board.