malinatran / tic-tac-toe-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tic Tac Toe

Malina Tran

Objectives

  • Build a simple tic tac toe game that allows for a human player
  • Ensure that the AI never loses and wins whenever possible
  • Create a user interface

Approach

Upon identifying the basic strategies of tic tac toe, I set up the game to allow the AI to always start first, select the center square, and subsequently select one of the four corners of board game. The game logic is as follows: the AI's goals are to identify opportunities for a win (three in a row), to block the human player from achieving a possible win, and to make a strategic move based on the game's progression.

Future Improvements

  • Given the AI's comparative advantages in this current version, I would enable this game to switch between the computer and player starting first.
  • Rather than randomize remaining squares (if only three squares are remaining), I would employ a smarter selection based on neighboring squares and potential win.
  • Other ideas for improving the game include: allowing a two-player version, including a scoreboard, and also incorporating rounds for multiple plays and an overall winner.

About


Languages

Language:JavaScript 76.3%Language:HTML 12.6%Language:CSS 11.0%