Tic Tac Toe

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 row is the winner.

2
1
Ruby

Tic-Tac-Toe

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.

Tictactoesample

Live demo

Play it online here

Built with

  • Ruby
  • RSpec
  • VSCode

Getting started

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]

Prerequisites

You must have Ruby installed on your computer

Game Instructions

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.

Running the tests

For running the automated tests type rspec spec/tictactoe_spec.rb in the root
directory of the project

Author

👤 Carlos Santamaría

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a 🌟 if you like this project!

📝 License

This work is released under the CC0 license