A game in which two players alternately put Xs and Os in compartments of a figure formed by two vertical lines crossing two horizontal lines and each tries to get a row of three Xs or three Os before the opponent does. I'd like to point out that, this project is built in pure Ruby no packages, no Genfile needed.
- Ruby
- RSpec
- Unix shell
To get a local copy up and running follow these simple example steps.
Go to https://github.com/srizzuto/tic_tac_toe/
- Click on the code and copy the HTML code.
- Use terminal to clone this repository on your local machine.
- Run
git checkout -b your-branch-name
. Make your contributions. - Push your branch up to your forked repository.
To run the tests locally :
-
First option : run the run_all_spec executable file to run all the tests at once.
eg :
./run_all_spec
-
Second option : run each file in the spec folder individualy.
eg :
rspec ./spec/game_spec.rb
-
Open your terminal:
- On Windows =>
Win + R
- On Linux =>
ctrl + alt + T
- On Mac =>
Control + Option + Shift + T
- On Windows =>
-
Go to the directory where the game is located, it will be the one where you cloned the repository. Execute the main.rb by typing:
bin/main.rb
-
Alright! You are ready to play! After the welcome message, both of you will be asked to insert your names:
- Remember: You can't leave a player's name empty!
-
After the game assign you either if you'll be playing with 'X' or 'O' it's time to do your first move! You will do this by pressing a name between 1 and 9 and confirm the move by pressing Enter:
- Every move you do will be displayed in the board, replacing the selected number for the player's sign ('X' or 'O')
- The game won't allow you to put words or numbers outside the range between 1 and 9
-
Winning conditions: There are 8 approaches to win the game:
- If one of the players manages to put three signs in a line (horizontally) (3)
- If one of the players manages to put three signs in a line (vertically) (3)
- If one of the players manages to put three signs in a line (over a diagonal) (2)
-
Tie conditions:
- The game will declare a draw between the players if they run out of moves (9 total)
-
"I want to exit, how do I do this?" There are two ways to do this:
- Going through the whole game, after the win, loss or draw the game will ask you if you want to play again, you can hit Y to replay or N to exit
- If you want to leave inmediately, use
ctrl + C
and the game will be shutted down.
Have fun!
👤 Sebastian Rizzuto
- GitHub: @srizzuto
- Twitter: @sbstnrzzt
- LinkedIn: Sebastian Rizzuto
👤 Moises Hernandez Coronado
- GitHub: @Mhdez221993
- Twitter: @MoisesH42060050
- LinkedIn: Moises Hernandez Coronado
👤 Safa Aballagh
- GitHub: @Safafa
- Twitter: @safa aballagh
- LinkedIn: Aballagh Safa
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- To my coding partner who helped me through all the work
- To my Stand Up Team who kept my morale up!