-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The three rules of Ruby Quiz:

1.  Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent.

2.  Support Ruby Quiz by submitting ideas and responses
as often as you can.

3.  Enjoy!

Suggestion:  A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby Talk follow the discussion.  Please reply to
the original quiz message, if you can.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

RSS Feed: http://rubyquiz.strd6.com/quizzes.rss

Suggestions?: http://rubyquiz.strd6.com/suggestions

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

## Hamurabi (#223)

Boo Rubyists,

This week's quiz was submitted by Martin DeMello[1]

Back in the microcomputer age, there was a fascinating little game
called Hamurabi (no, that isn't a typo - there was an eight character
limit). The game mechanics were pretty simple: you were the ruler of a
kingdom, and every year you had to decide what proportion of your
grain to allocate to planting, and what proportion to feeding the
people. The game engine would then set up the formulae, toss in a few
random numbers and simulate your crop and population growth. For all
its simplicity, though, it was a lot of fun to play, and oddly
compulsive.

The Wikipedia page[2] links to a couple of implementations in BASIC;
pick one and reimplement it in Ruby.

Extra credit: if someone can come up with a fun multiplayer version,
I'll be impressed :)

Have fun!

[1]: http://zem.novylen.net
[2]: http://en.wikipedia.org/wiki/Hamurabi

-- 
-Daniel
http://rubyquiz.strd6.com