Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 10 commits ahead of andrewmcdonough:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
fixtures
lib
solutions
spec
.gitignore
.rvmrc
Gemfile
README.rdoc
Rakefile

README.rdoc

Ruby Golf

Requirements

* ruby 1.8.7
* RSpec 1.3

Setup

If you have a github account, fork this and then clone your new forked version onto your machine. If you don't, then just clone this. Either way, cd into the resultant folder on your machine and run 'rake' on the command line - you should get some failing tests followed by a character count.

How to play

Ruby Golf is a game whereby the player is required to solve a number of problems (holes) in the fewest characters possible. The course consists of nine holes that you must implement. The holes are class methods that need to be added to the Golf class (lib/golf.rb). The requirements for these methods is specified by a set of RSpec examples for each hole (spec/golf_spec.rb). To run the specs, simply run:

rake

The first time you run this, all tests will fail. The aim is to get all tests to pass. rake will also report the number of characters you took to complete the course. The fewer characters you use, the better - whitespace doesn't count.

These tests were designed to run in ruby 1.8.7, with no gems other than rspec. Use another version of ruby if you want. Use the internet if you want. Creative solutions are allowed but please don't just go and look up the solutions off an LRUG blog or something.

Something went wrong with that request. Please try again.