Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 4.75 KB

README.md

File metadata and controls

67 lines (50 loc) · 4.75 KB

Ruby Golf Hamburg, 13.11.2013

We had the second Ruby Golf competition this year. Our goal was to compute a score for each hole and provide a web site to check live rankings. See axelerator/ruby_caddy for the Rails app used to compute the scores and display the ranking.

Ranking

An honorable mention of the most effective solution in the category "Gaming The System" goes to team Peter Schröder who put their code inside the method signature and thus managed to get down to 1 character per method most of the time. Great idea, but too far off for being counted as a real implementation. Also because it mainly was an input/output mapping, no algorithmic implementation. So we had to disqualify this entry.

  1. Tammo & Timo (Also "Gaming The System" since all code was converted to whitespace which could be evaluated on runtime. Since all whitespace is eliminated for counting, the solutions all have the same length which is the code for evaluating the whitespace. Cheaty, but still this implemented the tasks we asked for.)
  2. Team Schröder 2 (An alter ego of team Peter Schröder providing their solution before they became too creative.)
  3. Jan
  4. Marc
  5. anton
  6. Daniel
  7. Thomas von Deyen
  8. Ben
  9. Tim

If you check ruby_golf.rb, you'll find a compilation of the shortest non cheating solutions from all golfers:

  • Hole 1: 33 characters from Daniel
  • Hole 2: 43 characters from Jan
  • Hole 3: 62 characters from Daniel
  • Hole 4: 98 characters from Jan
  • Hole 5: 24 characters from Jan and Thomas von Deyen
  • Hole 6: 117 characters from Jan
  • Hole 7: 110 characters from Jan
  • Hold 8: 138 characters from Jan

Let me say that without any cheating, Jan probably would have won.

Learnings

  • Don't exclude whitespace completely, maybe just the initial indentation.
  • Don't ignore method signature in counting characters.
  • Test with more examples to avoid quickfix solutions not implementing the proper algorithm and prevent simple input/output mappings instead of real code.
  • Check code during competition and give hints what to avoid.
  • Try to even out team sizes since bigger teams definitely have an advantage.

Competition

To start coding on this challenge, first install all gems:

bundle install

Then, execute the test using guard:

bundle exec guard

Each time you change ruby_golf.rb, the tests are re-run and give you the state of your implementation and code metrics used for ranking.

Rules

  • only touch ruby_golf.rb
  • implement your solution within the pre-defined module methods
  • only non-whitespace characters within the method body are counted, no need to optimize the method definition
  • you can implement helper methods within the module, but be aware that they are counted towards the size of each method they're used in
  • stick to what stdlib gives you
  • DON'T use custom gems
  • DON'T go and annoy the organizers by being clever and exploiting their code