algorithm for checking game board state implemented