Skip to content

nikoescobal/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby: Building Tic-Tac-Toe with Ruby

A CLI tic-tac-toe game built with Ruby & Object Oriented Programming (OOP)

The objective of this project was to put into practice the core concepts of object oriented programming, mainly -- how to utilize classes and how to access their attributes. Here, I created an executable program of tic-tac-toe, a popular game played on a grid with 3 x 3 squares, which is played via the command line.

Screen Shot 2021-02-04 at 4 42 08 PM

How to Play:

  1. Player 1 is assigned X and Player 2 is assigned O, with player 1 starting first.
  2. Each player then takes turns selecting an empty square in the board, starting with Player 1 to move.
  3. A player wins if he/she can occupy 3 consecutive squares in a horizontal, diagonal or vertical line.
  4. This is done by entering any value from 1-3 for the x-coordinate (row) and the y-coordinate(column), respectively, during each player's turn.
  5. The first player to get 3 of their marks in a row (diagonally, vertically, or horizontally) is declared the winner.
  6. If all 9 squares are filled, and neither player has occupied 3 squares ina row with their given shape, then the game ends as a draw.

Built with

  • VS Code
  • Ruby

Getting Started

Prerequisites

Before you can run the program, you need to make sure Ruby is installed on your computer.

Installation

In order to play the game on your local machine, please run the following commands on your terminal:

  1. run git clone git@github.com:nikoescobal/tic-tac-toe.git
  2. run cd tic-tac-toe
  3. run ruby bin/main.rb to start the game
  4. Enjoy!

Author:

👤 Nikolas Escobal

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

  • Microverse
  • The Odin Project
  • El-Potato-Slayer (Thanks for all the help, broski ❤️)

📝 MIT License

This project makes use of the MIT license.

About

Building a tic-tac-toe game with Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages