Skip to content

Tictactoe cleanup #36

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AntwanAbboud
Copy link

What i changed:

  • I changed the winner function. I removed the if statements that were checking winning conditions and added a list with all possible winning conditions to see if the board contained any of them. Then, it also checks what the first box (if not empty) in the matching winning condition contains (X or O).
  • I changed the first move that the AI plays. It always took around 5 seconds to play its first move since it had to check all the outcomes through the minimax system. This is not efficient on the first move since it always plays the same move (if it moves first). So, I added an if-statement to check if the board was empty, in which case the AI makes a specific move.
  • Some minor repetitions that i resolved

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.

1 participant