Skip to content

This is the TicTacToe game using different classes for each object involve in the game

Notifications You must be signed in to change notification settings

candanedo/TicTacToePOO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToePOO

This is the TicTacToe game using different classes for each object involve in the game

Tic-tac-toe (also known as noughts and crosses 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 wins the game.

The following example game is won by the first player, X

For this particular task we are going to code the program that simulates the game on ruby language, basically following the rules explain previously and also adding the option to ask the player´s name.

Furthermore, we will also make sure that the program validates the input of the user, that way we can prevent the game from crashing. The grid will be displayed on the terminal.

First clone the repository containing the program, and some other files that will be explain after.

Once you had cloned the repository you can locate either of these files: tictactoeClasses.rb OR TicTacToe_classes_dif_files/exec.rb By running any of these files you`ll be able to play the Tic Tac Toe game.

The program will ask for your name and your oponent´s name, then for the first move from player one who is the X symbol, then the other one; until some one wins or there is a tie.

The program will validate if you want to play another round, as long as you type in s or S the game will restart, if you type any other key the game ends.

Ruby Gem

In order to use the gem you need to open the directory named Gem, once you´re inside, you´ll notice there are some files named TicTacToe-1.0.0.gem and TicTacToe-1.0.1.gem, these files contain the code from all the files packing all classes needed for the game. The difference between those is that the 1.0.0 version will need to be initialize on the interactive ruby console.

In the other hand, if you go ahead and install the gem version 1.0.1 in your console it will allow you to use the game without the need of initializing the game. To install go to terminal in the same directory and type gem install TicTacToe-1.0.1.gem and then require the gem on the interactive ruby.

If you want to take a look to all the repositories created during the duration of this challenge; such as the ruby koans, the first versions of the deliverables and more you can access to https://github.com/candanedo?tab=repositories

About

This is the TicTacToe game using different classes for each object involve in the game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages