[LRUG] Ruby Golf - Monday 9th May

Andrew McDonough andrew at andrewmcdonough.co.uk
Fri May 6 08:23:03 PDT 2011

Hi everyone,

I just want to give you a bit more information about the Ruby Golf
evening at LRUG on Monday.  As mentioned previously, you will be
working in teams to solve 9 'holes'.  Leaving time for an introduction
and some time at the end to collect the scores,  we will probably only
get 45mins of coding time so the challenges will all need to be fairly
simple (4-5 mins each).  Some other code golf competitions have
complex scoring where each individual hole is scored with points for
completion and number of characters relative to other teams, but to
make sure it runs smoothly on the night, given the time constraints,
we'll be running a really simple system:

1. The winning team must have completed all holes (with all tests
passing).  This is more important than the character count.
2. Of those teams who have completed all holes, the winner is the team
with fewest characters in the entire class (all nine holes).
3. We won't count whitespace in the class, to make the solutions
easier to demonstrate.

We can run further breakdowns on the mailing list afterwards, as I
will ask people to fork the repo and commit their solutions to their
fork.  If there are any particularly elegant solutions, we might ask
people to demonstrate on the evening if there is spare time.

So that you know exactly what you are getting, I have put an example
course with one hole up on github:


You'll need ruby 1.8.7 and RSpec 1.3.  If you clone the repository and
run 'rake', you will see the tests fail.  Now have a look at the specs
in spec/golf_spec.rb.  You need to write the method to implement the
.hole1 method in lib/golf.rb.  When you have done this, run rake again
to see if you have successfully completed the hole. If you complete
the course, it will also tell you a character count.  When the course
is passed, you can refactor to reduce the character count.

As well as the LRUG ruby golf evening, James Almond from Sheffield
Ruby User Group contacted me, and they (ShRUG) are going to run a ruby
golf evening on the same day, possibly using the same course, so we
can compare solutions afterwards.  We will use the same hashtag,
#rubygolf, for both meetings.

I haven't had many suggestions for holes, so if you do have any ideas
for a simple problem that would take 4-5 minute to solve, please mail
me off the list.  You don't need to write the specs, just describe the
idea and if I use it, I'll give you credit at the meeting.



Andrew McDonough
CTO, Tribesports

More information about the Chat mailing list