Skip to content

In this project, we build a Tic Tac Toe game. The main goal is to put into practice the main concepts of Object Oriented Programming using Ruby.

Notifications You must be signed in to change notification settings

Vagyasri/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe

We 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 is a 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 diagonal, horizontal, or vertical row is the winner.

Built With

  • Ruby
  • Rspec

Getting Started

To get a local copy run the following steps:

How to set up tests

  • Boot up your terminal and punch in "gem install rspec" to install RSpec
  • You can verify your version of RSpec with "rspec --version"
  • cd into project directory "Tic-Tac-Toe" and type "rspec --init" to initialize RSpec within the project
  • This will generate two files, ".rspec" and "spec/spec_helper.rb"
  • You can create the ruby test file inside the spec directory (eg: logic_spec.rb, player_spec.rb)

How to run tests

  • You can simply run "rspec" in the terminal by cd into the directory in order torun the tests
  • You can also run "rspec file-path" for the particular file you want to test from the directory
  • You can run "rubocop" inorder to check the linter errors

How to play "Tic-Tac-Toe"

  • This game can be played between any two people.
  • Run "ruby main.rb" in your terminal
  • Initially, it will be asked to enter your names (for player 1 and player 2)
  • You can enter minimum two characters of your name to move forward
  • The first player will play with '❌' and the other with '⭕️'
  • It will be player turnwise, Player 1 goes first, then Player 2, then again Player 1, likewise until you reach the following condition
  • For winning this game, one has to create a row/column/diagonal of three '❌'s or '⭕️'s first
  • If no one will be able to make so, it will be a tie and will ask for continuing another match or quit the game

Tip: If you're going first, then the best move you can make is to move into the center. This will maximize your chances of winning

🎊 🎉 Have fun 🎊 🎉

Author

👤 Bhagyashree Patra

👤 Peter Mbuthia

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Start by:

  • Forking the project
  • Cloning the project to your local machine
  • 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

Feel free to check the issues page, contribute to the Project by creating an issue.

Show your support

Give a ⭐️ if you like this project!

About

In this project, we build a Tic Tac Toe game. The main goal is to put into practice the main concepts of Object Oriented Programming using Ruby.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages