Open alexjfno1 opened 5 years ago
Update: Board updates every second to get new values within the cells. Created a combination of variables to check if the game has been won or not. (Need to create a draw scenario) Displays a "Game over!" message which is easily changed.
[ ] Update background with something majestic
[ ] Make table transparent in order to see the background or perhaps give it a translucent effect so X and O are still visible.
[ ] Create a better looking "Game over" or "You Won!" / "You Lost!" / "Draw!" message at the end of the game.
[ ] Add button to start a new game, clearing the values
[ ] Add a score for player 1 and player 2 if rematches are available.
Board
Fetch the board data from the API url (
/api/board
) and generate a Table in HTML with the values of each square populated.Fetch the board data every second so that when the backend data changes it updates the HTML page with the new values.
Moves
Build an API endpoint (
/api/move
) that will access query parameters. ->/api/move?row=row1,rowIndex=1,player=X
. Then update the board with the player move.After each move check if player has won and send back a boolean to say the player has won.
Display a win / lose draw message to the player