Skip to content

i4pg/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe

This is a simple implementation of the classic game Tic Tac Toe. It is part of the curriculum for The Odin Project's JavaScript course.

Demo

You can play the game online here.

Features

  • Two players can play the game (X and O).
  • Players can take turns marking spaces on a 3x3 grid.
  • The game ends when a player gets three in a row or all spaces are filled without a winner.
  • The winner is displayed at the end of the game.
  • The game keeps running and calculating points.
  • It supports single player so you can play against a computer.
  • The computer uses a simple algorithm that takes all the available moves, then loops twice. First, it tries each move and plays it if it's a winning move; otherwise, it goes to the next move. Second, if there is no winning move, it tries each possible move and plays there if it's preventing the opponent from winning; otherwise, it chooses a random place to play.
  • It has a mobile-first responsive design, using Bulma.io.

Showcase

Here are some screenshots of the Tic Tac Toe game:

Getting Started

Usage

You can play the game online here.

Installation

To run this program locally, you can clone the repository to your local machine using the following command:

git clone https://github.com/i4pg/tic-tac-toe.git

Then open the index.html file in your web browser to start playing the game.

Contributing

Contributions to this project are welcome. To contribute, follow these steps:

  1. Fork this repository.

  2. Create a new branch with your changes:

    git checkout -b my-new-branch
  3. Make your changes and commit them:

    git commit -am 'Add some feature'
  4. Push your changes to your forked repository:

    git push origin my-new-branch
  5. Create a pull request on this repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.