About | User Interface | Input | Output | Class Definitions | Built With | Live Demo | Getting Started | Authors
This project is to demonstrate our knowledge of Object Oriented Programming Language in Ruby, building 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.
According to Wikipedia 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...readmore
The game starts by calling the bin/main.rb file where all other classes are called/required. The game is played on the CLI
- At the beginning of the game, the two players are requested to enter their names, one after the other.
- The first person to enter his/her name automatically becomes player 1 and is requested to enter values between [1 - 9] to mark a piece on the board.
- Player 1 is automatically assigned to piece "X" and player 2 piece "O"
- The board class is instantiated at the beginning of the game with unmarked spots 1 to 9 on a 3x3 grid.
- The game board is re-rendered on the screen to show player's current placement of piece. Example if player 1 takes position 5, is replaced with "X" and becomes unvailable till the end of the game.
- This repeats until win or draw conditions are met
- Players instructions are error messages are displayed at each intervals to guide the players
The game class initializes the board class and the player class. It handles the check winner and draw methods as well as switch player method.
Will interact with Board class to select where to place pieces Pieces placed will be represented by X or O
Will display the game board as well as locations of marked spots Take input from players to determine where to show marked spots
- Ruby
To get a local copy of the repository please run the following commands on your terminal:
$ cd <folder>
$ git clone https://github.com/acushlakoncept/tic-tac-toe.git
To run the code:
$ bin/main.rb
$ gem install rspec
To test the code, run rspec
from root of the folder using terminal.
Rspec is used for the test.
👤 Uduak Essien
- Github: @acushlakoncept
- Twitter: @acushlakoncept
- Linkedin: acushlakoncept
👤 Elijah Ayandokun
- Github: @elijahtobs
- Linkedin: Elijah Ayandokun
- Twitter: @ElijahTobs
Contributions, issues and feature requests are welcome!
Give a ⭐️ if you like this project!
- Project originally taken from The Odin Project
- Project inspired by Microverse