Tic Tac Toe Game in Ruby
π Content
About | Installing | How to Play | Built with | Author
π§ About
This is an assignment for the Microverse course. The goal of this project is to create a Tic Tac Toe game using the programming language Ruby. The game works inside the console. Each number (1 to 9) corresponds to a position on the board. When one of the players reaches a win condition (3 consecutive symbols - X or O ) the game says who the winner is.
π§ Built with
π΄ Live Demo
π Installing
Pre-requisites
- Ruby installed on local machine. Please go to this link if you need to install it.
Usage
- Clone or download this repository;
- Unpack (if downloaded);
- On the command prompt or console type bin/main;
- The game will start and the players can play!
π How to Play
- The first player will control the X pieces, the second player the O pieces
- The first player can choose from 1 to 9
- Those numbers correspond to a position in the board
- The second player can choose after from 1 to 9, but can't choose a place that already have a piece on it.
- The game goes until any player can have a sequence of 3 pieces (rows, columns or diagonals)
- Sometimes can be a draw!
- Good game and have fun!!!
Rules
RULES FOR TIC-TAC-TOE
The game is played on a grid that's 3 squares by 3 squares.
You are X, your friend is O. Players take turns putting their marks in empty squares.
The first player to get 3 of her marks in a row (up, down, across, or diagonally) is the winner.
When all 9 squares are full, the game is over. If no player has 3 marks in a row, the game ends in a tie.
In this virtual implementation, you and your friend can place a mark by selecting from the numbers 1 to 9 when prompted. This is illustrated below:
| (1) | (2) | (3) |
| (4) | (5) | (6) |
| (7) | (8) | (9) |
A winning position would like the image below at the end. As soon as someone gets three of their marks in a row, the game ends.
| O | X | O |
| X | X | X | --- Player 'X' wins with this row!
| O | O | O |
For a detailed explanation, please have a look at this guide.
Testing
Install Rspec
$ gem install rspec
To test the code, run rspec from root of the folder using terminal as follows
rspec
Rspec is used for the test.
βοΈ Author
π€ Witah Georjane
- Github: @Georjane
- Twitter: @WittyJany
- Linkedin: @witah-georjane
π€ Contributing
Contributions, issues and feature requests are welcome!
Feel free to check the [issues page]https://github.com/Georjane/Tic-Tac-Toe-Game/issues).
π Show your support
Give a βοΈ if you like this project!
π License
This project is free to use as learning purposes. For any external content (e.g. logo, images, ...), please contact the proper author and check their license of use.