Skip to content

jmcgough/tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe

This is a simple Tic Tac Toe game implemented in HTML, CSS, and JavaScript.
This was generated while testing out aider with Gemini and Grok AI, Gemini started it, Grok fixed it, and added minimax correctly. Gemini for the README.md and code cleanup.

Features

  • Multiple Game Modes: Supports Computer vs. Computer, Player vs. Computer, and Player vs. Player modes.
  • Player Names: Allows players to enter their names (except in Computer vs. Computer mode).
  • Alphanumeric Input: Validates player names to allow only alphanumeric characters, spaces, and underscores.
  • Responsive Design: The game board is designed to be responsive and adapt to different screen sizes.
  • Computer AI: Implements a Minimax algorithm for the computer's moves, providing a challenging opponent.
  • Clear UI: Provides a clean and intuitive user interface.

How to Play

  1. Open the tictactoe.html file in your web browser.
  2. Select the desired game mode (Computer vs. Computer, Player vs. Computer, or Player vs. Player).
  3. If you selected Player vs. Computer or Player vs. Player, enter the player names and click "Start Game".
  4. Click on an empty cell to make your move.
  5. The game will automatically check for a winner or a draw after each move.
  6. Click "Play Again" to start a new game with the same settings.
  7. Click "Change Options" to return to the game mode selection screen.

Technologies Used

  • HTML
  • CSS
  • JavaScript

Minimax Algorithm

The Computer vs. Computer and Player vs. Computer modes use the Minimax algorithm to determine the best move for the AI player. The algorithm explores all possible game states to a certain depth and chooses the move that maximizes the AI's chances of winning.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Authors

  • Jeffrey B. McGough - @jmcgough
    Initial work and project creator

Acknowledgments

  • This project was developed with assistance from:
    • Grok, an AI created by xAI.
    • Gemini 2.0 Flash - For additional AI support.
    • Aider - An AI-powered coding assistant.

About

Traditional Tic Tac Toe Game - HTML/CSS/JS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages