Skip to content

Commit

Permalink
Implement move recommendation feature and update game configuration
Browse files Browse the repository at this point in the history
This commit adds the implementation for the move recommendation feature in the Tic-Tac-Toe game. It also includes updates to the game configuration to support this new feature.

Changes:
- Added "join" to gameState.txt
- Added move recommendation logic to recommend.nr
- Added recommendedMove.json with a sample recommended move
- Updated gameState.json with a sample game state
- Updated package.json to include the "lockfile" dependency
- Updated index.ejs to display the current turn
- Updated style.css to add a new class for winning cells
- Added recommend.js to provide move recommendation service
- Updated index.js to handle game state saving and recommendation retrieval
  • Loading branch information
victorKariuki committed Oct 5, 2024
1 parent 42b6ee4 commit ca47cd9
Show file tree
Hide file tree
Showing 11 changed files with 470 additions and 232 deletions.
14 changes: 14 additions & 0 deletions assets/gameState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"gameBoard": [
"O",
"X",
" ",
" ",
"O",
" ",
"X",
"X",
" "
],
"currentPlayer": "O"
}
1 change: 1 addition & 0 deletions assets/gameState.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
join
Binary file added assets/nuru
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/recommend.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tumia mtandao

fanya game = mtandao.peruzi("https://lab.breviamlogistics.co.ke/")
4 changes: 4 additions & 0 deletions assets/recommendedMove.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"move": 8,
"timestamp": "2024-10-05T01:23:30.083Z"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"express": "^4.21.0",
"helmet": "^8.0.0",
"http-errors": "~1.6.3",
"lockfile": "^1.0.4",
"morgan": "~1.9.1",
"socket.io": "^4.8.0"
},
Expand Down
Loading

0 comments on commit ca47cd9

Please sign in to comment.