Programming Contest Trouble

Last weekend, I worked all night programming a random player for a programming contest. Things like this always turn out to be harder than expected. Elegant code, nice class dependencies, doctests, Python 2.4.

Results: errors. It turns out the contest sandbox runs Python 2.2. I’m not complaining, host Fred is limited by his hosting provider. Hey, this is the real world. Some companies do use almost 4 year old versions1.

Ok, maybe I shouldn’t have used

for move in moves[::-1]:
    yield move

But did you know built-in function sum(seq, start=0) was introduced in Py 2.3.5?

return sum(scores)
NameError: global name 'sum' is not defined

You live, you learn.

Check my position, second last. But tonight, my random player will get lucky. I just submitted my 4th version, this time tested with Py 2.2. Good night!

1) Red Hat Enterprise servers, for example.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: