Skip to content

AI Opponent added - #31

Open
TheRaj71 wants to merge 1 commit into
arujjval:mainfrom
TheRaj71:AI-OPPONENT-V1.1
Open

AI Opponent added #31
TheRaj71 wants to merge 1 commit into
arujjval:mainfrom
TheRaj71:AI-OPPONENT-V1.1

Conversation

@TheRaj71

@TheRaj71 TheRaj71 commented Oct 4, 2024

Copy link
Copy Markdown

This pull request enhances the tic-tac-toe game by adding new features and improving existing functionality. The most important changes include adding AI mode, restructuring the event listeners, and refactoring the game logic for better readability and maintainability.

New Features

  • Added AI mode to allow players to play against the computer. (js/script.js js/script.jsL18-L117)
  • Introduced a mode selection dropdown to switch between multiplayer and AI mode. (js/script.js js/script.jsL18-L117)

Event Listeners

  • Refactored event listeners for sound toggle and game reset into separate functions. (js/script.js js/script.jsL18-L117)

Game Logic

  • Refactored the handleCellClick function to incorporate AI moves and end game conditions. (js/script.js js/script.jsL18-L117)
  • Added makeMove, makeAIMove, findBestMove, and minimax functions to handle AI decision-making. (js/script.js js/script.jsL18-L117)

Code Cleanup

  • Improved readability by restructuring the checkWinner and isBoardFull functions. (js/script.js [1] [2]
  • Consolidated repeated code into helper functions and removed unnecessary comments. (js/script.js [1] [2]

@arujjval

arujjval commented Oct 5, 2024

Copy link
Copy Markdown
Owner

Mention the issue it is resolving.

@TheRaj71

TheRaj71 commented Oct 6, 2024

Copy link
Copy Markdown
Author

Mention the issue it is resolving.

Issue 26 (user can siwtch between multiplayer and ai mode)

@arujjval

arujjval commented Oct 8, 2024

Copy link
Copy Markdown
Owner

please make this PR to development branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants