Tic-Tac-Toe is a very popular game, which consists of making a sequence of three symbols in either a row, column or diagonal in a 3x3 board.
- Select the first player's name.
- The first player gets to choose which sign they want to use; This should only be one character.
- Select the second player's name, following the instruction given on step 1. The names should be unique.
- The second player gets to choose a sign but it has to be different from the first player's sign.
- The game will begin. The Tic-Tac-Toe board will be printed with empty rows and columns.
- To win this game one player must make a sequence of three signs either on rows, columns or diagonals.
- The selected player gets to choose the position where they want to place their sign, by inputting rows and colums. The input should be equal to or in between 1 to 3 integer values.
- After that, the coordinates will be validated and recorded. Afterwards, the second player will be selected to take a turn.
- The selected position can't be chosen twice;
- The game will take turns until a player wins or no more positions are available on the board, in this case it will be a draw!
This is a tic-tac-toe game built with ruby and oop principles
In this project, all the logic and manipulation is put in the files inside lib folder except for these that require consistant outputs.
---------------------------------------------------------------------------------------------------------------------
In this game there are 4 main files
1- main.rb: This file is responsible for getting validated inputs from the user, outputting messages, and calling all the required methods.
2- player.rb: This file is responsible for storing player variables such as (name, sign).
3- board.rb: This file is responsible for the creating the board, and applying the coordinates.
4- tictactoe.rb: This file is responsible for the game logic, validations, comparisions and board manipulation.
---------------------------------------------------------------------------------------------------------------------
The game consists of 6 steps:
1- get the players' names and validate that they are unique.
2- get player one's sign and validate that it's a character.
3- get player two's sign and validate that it's a character and unique from player one's sign.
4- display the board and ask for a move.
5- validating the given move by checking that the coordinates are not already taken and that they are equal to or between 1-3. This process runs for both players.
6- checks for the win conditions. If any player wins, it will display the player that won, else it will display "it's a draw".
- Ruby
- VS Code
To get this project up and running, you must already have ruby installed on your computer.
To get this project set up on your local machine, follow these simple steps:
- Open Terminal.
- Navigate to your desired location to download the contents of this repository.
- Copy and paste the following code into the Terminal: git clone https://github.com/El-Potato-Slayer/Tic-Tac-Toe
- Hit enter.
- Once the repository has been cloned, navigate inside the repository and type: bin/main.rb This will run the game and you will be able to play it using the terminal.
- Have fun!
👤 Chad van Wyk
- Github:@El-Potato-Slayer
- LinkedIn:@Chad Van Wyk
- E-mail: Email
- Twitter:@elpotatoslayer
👤 Lamia Sristy
- Github: @LamiaSristy
- Linkedin: @LamiaSristy
- E-mail: Email
- Twitter: @LamiaSristy
Give ⭐ Star me on GitHub — it helps!
This project is MIT licensed.