Tic-tac-toe (American English), noughts and crosses (Commonwealth English and British English), or Xs and Os/“X’y O’sies” (Ireland), is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is the winner. It is a solved game with a forced draw assuming best play from both players.
- Number of players 🙍♂️🙎🏻♀️: 2
- Set up time ⏱: minimal
- Playing time ⏱: ~1 minute
- Skill(s) required 💪: Strategy, tactics, observation
- Symbols ⭕️❌: Noughts and crosses (Xs and Os)
- Each player should select the number from the board! (only numbers from 1 to 9!)
In order to win the game, a player must place three of their marks in a horizontal, vertical, or diagonal row.
The following example game is won by the second player, O:
Players soon discover that the best play from both parties leads to a draw. Hence, tic-tac-toe is most often played by young children, who often have not yet discovered the optimal strategy.
- Gameplay Instructions
- RSpec test Instructions
- Built With
- Getting Started
- Dependencies
- Contributing
- Acknowledgments
- Author
- License
- To begin the game firstly, follow Getting started section
- Find someone to play with.
- As the file is executed the game will ask you to first input Player X name. The same will be repeated for player O.
- Player X will be prompted to enter a number from 1-9 representing a field in the tic-tac-toe grid(3x3), once the player obliges, his symbol will be marked in his selected spot.
- Player O will be asked to repeat as above.
- The game will keep alternating players until a win or draw is achieved.
- To win the game, a player must fill out a line with his symbol vertically, horizontally, or diagonally.
- A draw is reached when neither player manages the above and the grid is filled.
- To test this game install RSpec, for it boot up your terminal and punch in `gem install rspec` to install RSpec.
- `cd` into Tic-Tac-Toe-Game project directory
- Type `rspec`
To get a local copy up and running follow these simple steps.
git clone https://github.com/AbdumurodovaZulfizar/Tic-Tac-Toe-Game.git
cd Tic-Tac-Toe-Game
- Open Ruby file on your editor
- Open your terminal(Command Prompt) and type bin/main.rb
👩🏻💼 Zulfizar Abdumurodova
- GitHub: Abdumurodova Zulfizar
- Twitter: Abdumurodova Zulfizar
- LinkedIn: Abdumurodova Zulfizar
🙍♂️ Angel Diaz
- GitHub: Angel Diaz
- Twitter: Angel Diaz
- LinkedIn: Angel Diaz
Ruby 3.0.1
Contributions, issues and feature requests are welcome!
You can do it on issues page.
Give a ⭐️ if you like this project!
- Microverse for international opportunities.
- Special thanks to all code reviewers.
Copyright 2021 Zulfizar Abdumurodova & Ángel Díaz
- MIT for this project.