/ruby_tic_tac_toe

This repository is created to make a popular game tic-tac-toe using ruby. The main purpose of this project is to understand and implement the concepts of Object Oriented Programming in Ruby.

Primary LanguageRubyMIT LicenseMIT

ruby_tic_tac_toe

Contributors Forks Stargazers Issues

This game is a virtual representation of the classic Tic-Tac-Toe game.

All public class methods are tested with RSpec.

Tic tac toe game



Explore the docs »

Report Bug · Request Feature

Rules For Tic-Tac-Toe

  1. The game is played on a grid that is 3 by 3 squares.
  2. It is a game of two players that use X and O to mark moves in empty squares.
  3. The first player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner.
  4. The game is over when all 9 squares are full. If no player has 3 marks in a row, the game ends in a tie.
  5. Below is a virtual implementation where marks can be placed by selecting from numbers 1 to 9 when prompted.

| (1) | (2) | (3) |

| (4) | (5) | (6) |

| (7) | (8) | (9) |

  1. A winning position would like the image below at the end. As soon as someone gets three of their marks in a row, the game ends.

| O | X | O |

| X | X | X | --- Player 'X' wins with this row!

| O | O | O |

For a detailed explanation, please have a look at this guide.

Getting Started

Prerequisites

Ruby installed on local machine
Text editor (preferably: VSCode, Atom, Sublime)

Starting the game

  1. If you have installed Ruby on your machine: Clone the project into your local machine using git clone command or download the zip file. Go into the project directory using cd directory name command. Open your terminal and type bin/main.rb command. Enter players' names, select the letters which players play with. On the displayed board choose the cells by numbers between 1 and 9 to mark your selected letter ('X' or 'O').
  2. If you have not installed Ruby, please, install Ruby and repeat step 1.
  3. Run rspec in the terminal of your root directory to run the described tests or run rspec --format doc to see a more detailed description of the written tests.

Installation

Contributions, issues and feature requests are welcome! Start by:

  • Forking the project
  • Cloning the project to your local machine
  • cd into the project directory
  • Run git checkout -b your-branch-name
  • Make your contributions
  • Push your branch up to your forked repository
  • Open a Pull Request with a detailed description to the development branch of the original project for a review

Built With

This project was built using these technologies.

  • Ruby
  • RSpec
  • Visual Studio Code

Contributors

👤 Prajwal Thapa

👤 Glory David

👤 Marylene Sawyer

Show your support

Give a ⭐️ if you like this project!

Acknowledgements