This is an implementation of the popular TIC-TAC-TOE Game created using the Ruby programming Language
Game Rules
- Each player is going to choose a number out of 9 positions.
- First player should enter his name and press enter.
- Second player should enter his name and press enter.
- First player should enter his symbol [X or O] and press enter.
- To choose a position you have to type the corresponding number and press enter.
- The game will check if the chosen number is valid or not valid.
- If it's not valid (i.e already taken number or not of the game positions - from 1 to 9 ) it will ask for another input.
- If it's valid it will display the board with the chosen position replaced by the symbol of the player [X, O].
- Then it will ask the next player to take a turn.
- It will repeate the same for the second player.
- The game continues until it reaches either a winning or a draw condition.
Winning conditions There are 8 winning conditions...
- First three: to have occupied a full row with the same symbol [X, O]
- Second three: to have occupied a column with same symbol [X, O]
- Last two: to have occupied a full diagonal with same symbol [X, O]
Draw condition
- If 9 movements are made with no winner then the game is a draw.
- Ruby
- RSpec
https://www.loom.com/share/8164eae2131c45b8be568bc3511e2193
- Navigate to the project's directory using the
cd
command
To run this program on your local machine, simply follow the steps below:
- Open your terminal - Windows:
Win + R
, then typecmd
| Mac:Command + space
, then typeTerminal
- Navigate to a directory of your choosing using the
cd
command - Run this command in your OS terminal:
git clone https://github.com/German-Cobian/Tic-Tac-Toe
to clone this repo in your local machine cd
into theTic-Tac-Toe
folder- Run
ruby bin/main.rb
and play the game from command line following the prompts it supplies
This project is tested with RSpec which is a computer domain-specific language (DSL) testing tool written in the Ruby programming language. To get Rspec running do the following:
- Run
gem install rspec
in the terminal. This command installs Rspec on your computer - Ensure that RSpec is installed by running
rspec --version
which lists the installed version - You should get output similar to the following:
RSpec 3.10 rspec-core 3.10.1 rspec-expectations 3.10.1 rspec-mocks 3.10.2 rspec-support 3.10.2
- The rspec gem comes packed with all you need to get started including the 5 gems listed above
- Run the following command to initialize Rspec:
rspec --init
This generates a /spec folder and a .rspec file at the root of your project - Finally, to run the tests, simply run
rspec
👤 Mih Julius Ndim
- GitHub: @Mihndim2020
- Linkedin: Mih Julius
- Twiter: @mihndim
👤 German Cobian
- GitHub: @German-Cobian
- Twitter: @German-Cobian1
- LinkedIn: @german-cobian
👤 Charles Chukwunweike Eneh
- GitHub: @charlyeneh
- Twitter: @twitterhandle
- LinkedIn: LinkedIn
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page
Give a ⭐️ if you like this project!
Guidelines for this project provided by The Odin Project
This project is MIT licensed.