Code Monkey home page Code Monkey logo

wheel_of_fortune's Introduction

Wheel of Fortune - OO Ruby with Tests

In this lab you will be building a simplified Wheel of Fortune game using Ruby Classes and Rspec Tests.

Setup

First, make sure you've installed the rspec gem.

From the command line (inside the cloned repo directory) run:

gem install rspec # individually install the rspec gem
# or
bundle install # install all the gems listed in the Gemfile

Next, check that the rspec tests are working (they should be failing!):

rspec
# or
rspec spec/wheel_of_fortune_spec.rb

Building the Game

Take a look inside wheel_of_fortune.rb and you'll see some boilerplate code for our WheelOfFortune class.

Instance of WheelOfFortune will have three important methods:

  • making guesses ("Can I have a 'z'...?")
  • printing the game board ("Wh__l of Fortun_")
  • checking if the game is over (true/false)

Follow the tests to get started!

Tips

You can run your game from the command line by typing:

ruby wheel_of_fortune.rb

Hint: Take a look at the Drive Code at the bottom of the file!

You can also load your code into Pry to test your assumptions:

pry
> require 'wheel_of_fortune.rb'
> w = WheelOfFortune.new({...})
> w.to_s

Mega Bonus

It turns out Wheel of Fortune and Hangman have a lot in common! Can you take this lab even further, and build a hangman game?

      _______
 |/      |
 |      (_)
 |      \|/
 |       |
 |      / \
 |
_|___
h_ng m_n

wheel_of_fortune's People

Contributors

nathanallen avatar

Watchers

James Cloos avatar Ben Manning avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.