This is the development in Ruby language of the classical game (aka noughts and crosses) in which two players take turns to place their marks ( 0 or X ) in the available positions of a 3 x 3 board. The first player who achieves to place three of their marks in a horizontal, vertical, or diagonal line is the winner.
Play it online here
- Ruby
- RSpec
- VSCode
To get a local copy of this repository up and running, follow these steps:
- Click the "Clone or download" button
- Copy the URL of the repository.
- Go to the terminal on your local machine and type: git clone
- Paste the URL you copied before.
- Change your local directory by typing cd Tic-Tac-Toe
- Type ruby bin/main.rb and press [Enter]
You must have Ruby installed on your computer
This is a two-player game in which every participant has a mark, either X or 0. The final goal is to place three his/her marks on a 3 x 3 board in a vertical, horizontal, or diagonal line.
After typing the player's names, the first turn will be for the player with the X's and then, the game will prompt alternating between the two players asking for the position in the board in which the player wants to place his/her mark.
Each player can choose only one position on the board per movement, so he/she must pick the more convenient position in order to achieve the goal to position three of his/her marks in line.
Sometimes, the player must use his/her turn for placing a mark that blocks the opponent's path to win. In such a case, the board is likely to be full without any of the participants winning. If that situation arises, the game will end in a draw.
For running the automated tests type rspec spec/tictactoe_spec.rb in the root directory of the project
π€ Carlos SantamarΓa
- Twitter: @Flakster
- Github: @Flakster
- Email: [email protected]
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a π if you like this project!
This work is released under the CC0 license