Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent.
Support Ruby Q. by submitting ideas and responses
as often as you can.
Enjoy!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. follow the discussion. Please reply to
the original quiz message, if you can.
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 page2 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
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.
Oh, man! I remember that. There was one for the econ students at St.
Olaf loooong ago, I actually wrote my own from scratch once. In mine,
there were also woolen mills (or, in an early version, wollen mills –
I speld ril gud as a kid), and the win condition was to have a given
amount of
land, plus enough bolts of fabric to make wedding dresses for your
population,
and enough people that you could have hundreds of happy families. (The
question of whether wool was a good choice for a wedding dress was never
answered).
I wrote a super minimal BASIC interpreter to avoid translating the
code. (Yes, I am aware that’s insane. I’ll seek help.)
On Mon, Nov 2, 2009 at 5:29 AM, James Edward G. II [email protected] wrote:
I wrote a super minimal BASIC interpreter to avoid translating the code.
(Yes, I am aware that’s insane. I’ll seek help.)
Wow, I thought translating the code would be fairly simple, but it’s a
morass of gotos and one-letter variables. I think I’d have written the
interpreter a lot quicker But now my stubborn side has kicked in
and I’m going to finish the translation instead.
I wrote a super minimal BASIC interpreter to avoid translating the
code. (Yes, I am aware that’s insane. I’ll seek help.)
Hah, ingenious!
I really didn’t want to go about translating that BASIC either, but
instead, I was just going to make my own version based on whatever I
just read about the game. Making a simple BASIC interpreter is so much
cooler though, it should be a ruby quiz in and of itself really (make it
a DSL for extra credit :P).
BTW, does anybody have any ideas for how a (fun) multiplayer version of
Hamurabi would look like? What I was thinking: Add in a model of free
markets to set price of land, so there would then be real trading
between players. Then a smart player could influence prices through
supply, to his opponents’ detriment, if he could see the state of their
kingdoms. And then there could be all sorts of nice strategies and
counter-strategies in the struggle to be the best. Also: quick (say 30
seconds or a minute at most), timed rounds, ending at round ten or so,
at which point the winner is announced, and the game is restarted.
What do you guys think of that? Sound like any fun? A problem might be
finding other players to actually play with live! In which case a
slower, non-timed version that emailed you when it was your turn might
be more appropriate (and less of a time sucker).
On Mon, Nov 2, 2009 at 10:25 AM, Ehsanul H. [email protected]
wrote:
BTW, does anybody have any ideas for how a (fun) multiplayer version of Hamurabi would look like? What I was thinking: Add in a model of free markets to set price of land, so there would then be real trading between players. Then a smart player could influence prices through supply, to his opponents’ detriment, if he could see the state of their kingdoms. And then there could be all sorts of nice strategies and counter-strategies in the struggle to be the best. Also: quick (say 30 seconds or a minute at most), timed rounds, ending at round ten or so, at which point the winner is announced, and the game is restarted.
What do you guys think of that? Sound like any fun? A problem might be finding other players to actually play with live! In which case a slower, non-timed version that emailed you when it was your turn might be more appropriate (and less of a time sucker).
You could also have disaffected people moving from city to city,
adjusting the populations upward and downward respectively.
and I’m going to finish the translation instead.
Yeah, I’m am looking forward to seeing your translated version so I
can tell if my interpreter is even doing the right things.
I started cleaning it up a bit today, but ran out of time. There’s
still a lot more that could be done.
It also has a pretty big bug in it. My simple stack solution for
GOTO, GOSUB, and FOR doesn’t really work. It looked like it worked
most of the way through the code because, GOTO’s and GOSUB’s only
appear on their own lines or at the end of a compound instruction.
The FOR loop at the end isn’t like that though, and my interpreter
doesn’t really run it 10 times because it cannot resume into the
middle of a compound instruction line. Drat, foiled again.
I did have a ton of fun playing with this problem. Thanks again to
the organizers for a great problem!
And then there could be all sorts of nice strategies and
You could also have disaffected people moving from city to city,
2009/11/3 Martin DeMello [email protected]
Existing disaster is when there is no public responsibility for
healthcare.
When the world is full of pharisees who pass by on the other side.
Human concern for others is something with a value beyond rubies!!
Well, here goes. I did it the bad way (no flowcharts or anything) and
it was pretty painful (meaning I regretted it later). I got it to the
point where it is semi-reasonable but it’s not very um, Rubyish. I
ironed out all the showstopper bugs but I’m sure there’s quite a few
more. In any case it works after a fashion (compared the output to a
running instance of Applesoft BASIC in JavaScript) and it doesn’t
make my eyes bleed (no guarantees on yours).
Existing disaster is when there is no public responsibility for healthcare.
When the world is full of pharisees who pass by on the other side.
Human concern for others is something with a value beyond rubies!!
Yeah, not having public healthcare could garner you a few extra
bushels of wheat per year, but increase your chances of plague and
decrease your immigration rates. There’s a nice continuum between
HAMURABI and Civilisations