Built a tic-tac-toe game on the command line where two human players can play against each other and the board is displayed in between turns.
Tic-tac-toe (American English), noughts and crosses (British English), or Xs and Os is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner.
- The game is played on a grid that's 3 squares by 3 squares.
-
You are X, your opponent is O. Players take turns putting their marks in numbered squares.
-
The first player to get 3 of their marks in a row (up, down, across, or diagonally) is the winner.
- When all 9 squares are full, the game is over. If no player has 3 marks in a row, the game ends in a tie.
- Download repo or clone the repo to your computer
https://github.com/rna/tic-tac-toe-game.git
- Run the file in the terminal
bin/main.rb
- Enter each player name by its turn
- Game starts once enter your names
- As per the game rules, the first player will get
X
and other player will getO
. - Players will take turns until the game concludes.- You can start the game again or you can exit by selecting the required option.
- The player's marks (Xs and Os) will change once you restart the game.
- Happy gaming!!
- Ruby
rpsec --format documentation