Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI Opponent added #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TheRaj71
Copy link

@TheRaj71 TheRaj71 commented Oct 4, 2024

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
Copy link
Owner

arujjval commented Oct 5, 2024

Mention the issue it is resolving.

@TheRaj71
Copy link
Author

TheRaj71 commented Oct 6, 2024

Mention the issue it is resolving.

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

@arujjval
Copy link
Owner

arujjval commented Oct 8, 2024

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