This project is part of the Microverse Ruby Module.
Report Bug
·
Request Feature
Tic-tac-toe (US), noughts and crosses (UK), 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.
Game Rules:
- Two player game
- First player plays with the 'O' symbol
- Second player plays with the 'X' symbol
- Players take turns choosing a cell of the board to mark their symbol.
- A player can only choose an empty cell.
- The first player to complete a succession of 3 of their assigned symbol (O's or X's) in a row, column or diagonal wins!
- If all of the cells are filled with a symbol and no player matched 3 symbols, the game ends in a tie.
- Clone this repository
git clone https://github.com/crgc/tic-tac-toe.git
- Change into folder
cd tic-tac-toe
- Run the following command
bin/main.rb
Once you run the game, follow the prompts and instructions inside the terminal.
- You will be prompted to type the Player 1 name and Player 2 name (press enter after each name)
- The first player will pick between the 'X' and 'O' symbol
- The second player will play with the unpicked symbol
- The game will prompt which player turn's it is
- The player in turn should type a valid cell name (1-9) and enter it to mark the board
- After each turn, you will see the updated board with the selections of the players. Example of a game board after the first player types in "2" in their turn:
[ ][X][ ] [ ][ ][ ] [ ][ ][ ]
- A player can only mark an empty cell. If they choose a cell that is already marked, they will be prompted again
- The first player to match a succession of 3 of their assigned symbol - in row, column, or diagonal pattern - wins
- If all cells are marked and no player matched 3, the game ends in a tie
- To run the RSpec tests, run the following commands:
bundle install
bundle exec rspec
- Ruby
- RubyMine
👤 Carlos González
- GitHub: @crgc
- Twitter: @aclerkofpomier
- LinkedIn: Carlos González
👤 Miguel Gómez
- GitHub: @MiguelArgentina
- Twitter - @Qete_arg
- LinkedIn: Miguel Gómez
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
This project is MIT licensed.