The objective of this project was to put into practice the core concepts of object oriented programming, mainly -- how to utilize classes and how to access their attributes. Here, I created an executable program of tic-tac-toe, a popular game played on a grid with 3 x 3 squares, which is played via the command line.
- Player 1 is assigned X and Player 2 is assigned O, with player 1 starting first.
- Each player then takes turns selecting an empty square in the board, starting with Player 1 to move.
- A player wins if he/she can occupy 3 consecutive squares in a horizontal, diagonal or vertical line.
- This is done by entering any value from 1-3 for the x-coordinate (row) and the y-coordinate(column), respectively, during each player's turn.
- The first player to get 3 of their marks in a row (diagonally, vertically, or horizontally) is declared the winner.
- If all 9 squares are filled, and neither player has occupied 3 squares ina row with their given shape, then the game ends as a draw.
- VS Code
- Ruby
Before you can run the program, you need to make sure Ruby is installed on your computer.
In order to play the game on your local machine, please run the following commands on your terminal:
- run
git clone git@github.com:nikoescobal/tic-tac-toe.git
- run
cd tic-tac-toe
- run
ruby bin/main.rb
to start the game- Enjoy!
👤 Nikolas Escobal
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- Microverse
- The Odin Project
- El-Potato-Slayer (Thanks for all the help, broski ❤️)
This project makes use of the MIT license.