/ruby-tic-tac-toe

A Ruby application, which allows the user to play Tic Tac Toe on the command line.

Primary LanguageRuby

Ruby Tic Tac Toe

Description

A Ruby application, which allows the user to play Tic Tac Toe on the command line.

Preview

Tic Tac Toe Preview

Features

  • Play a new game, or load a saved game
  • Choose to play the following games:
    • Human vs Human
    • Human vs Computer
    • Computer vs Computer
    • Computer vs Human
  • The computer player is unbeatable
  • When a game has finished, opt to play another game or exit
  • Save during the game
  • Exit during the game

Getting Started

Note: if Ruby is not already installed, you can find instructions here.

git clone https://github.com/itsellej/ruby-tic-tac-toe
cd ruby-tic-tac-toe
bundle install
ruby lib/play.rb

Language

The language used to create this application is Ruby.

Testing

The testing library used is RSpec. To run the tests, type rspec in the terminal.

Edge Cases Considered

  • Cases where the user is prompted to enter input again:
    • Game type selection: if 'new' or 'existing' is not entered
    • Loading a saved game: if the game name entered does not exist
    • Player type selection: if 'h' or 'c' is not entered
    • Move selection: if 1-9, 'save' or 'exit' is not entered during game play
  • If the file containing the saved games is empty, a new game is automatically selected

Related Blog Posts