get nextMove and checkWin functions to work on firebase