
Battlecode: MIT's longest-running hardcore programming competition - Cixelyn
http://cory.li/battlecode-intro/
======
aaroniba
BattleCode was the best thing I did while at MIT, and one of the most unique
and rewarding experiences of my life.

The way David and I were able to win it in 2003: at that time, robot positions
were stored as two doubles (x,y). You could move yourself by a precise amount
or read the precise x,y position of another robot, each in only 1 bytecode. So
instead of using broadcastMessage(String), checking that no other team was
trying to screw with our messages, all of which took lots of bytecodes to get
right. Instead of that, our robots communicated through the low bits of double
values in their positions. Kind of like bees dancing for each other. This gave
us enough of an edge to beat out all the other players. This was 100% David
Greenspan's idea, by the way. I just worked hard to help code it up.

MIT classes are supposedly a lot of hard work, but at that point I had never
worked as hard on anything as I did on our BattleCode player.

~~~
sskates
Working on Battlecode was the same way for me, most intense time I've ever
spent at MIT. Lots of teams were really into it which made it all the more
competitive and fun.

In 2009 one of our rivals was a solo coder who was in the top 8 of the
previous year (we became friends through the competition and still hang out to
this day). He relayed to me a story of how one of the other teams had tried to
sabotage his efforts. They sent a female member of their team over to his room
to convince him to drink with her. It didn't work, although that was mostly
because he already liked to drink and code.

~~~
trun
Drunkasaurus! Oh man, 2009 was a good year :)

I'll echo what skates and iba said -- battlecode was probably one of the most
productive things I did in school. when everyone else is trying to teach you
how to properly to document your preconditions, battlecode is purely about GSD
(get s __* done) - an extremely valuable lesson for an aspiring young
entrepreneur.

my favorite battlecode hack: we used to assign a fixed "cost" to certain
methods, namely Arrays.hashCode(). one of the more experienced players figured
out that everyone was using this to checksum their radio broadcasts. he then
proceeded to reverse engineer the hash code algorithm and spam teams with
enormous messages that had legitimate checksums but were actually just
megabytes of trash! the poor opponents would just sit there chewing cpu until
the engine finally killed them for using too much heap :)

edit: actually read through cory's post - glad to see he already mentioned
this one!

------
sskates
I highly, highly recommend any current MIT undergrad who is serious about
starting a company to compete to win in Battlecode during IAP. It's as close
to starting a company as you can get.

Watching your bots win and lose while trying to prioritize fixes is exactly
what prioritizing things in your startup is like, without all of the downsides
of taking forever to get traction.

There's also a long legacy of alums going on to found successful YC startups
(Dropbox and Etherpad being the best examples). You also get to say you've won
MIT's biggest programming competition, which gives you a huge amount of
credibility.

Also feel free to reach out to me if you're interested in starting a
company/doing Battlecode and currently an undergrad at MIT! (My team won in
2009 and 2010 and I'd be happy to help.)

------
mpapi
Battlecode (RoboCraft!) taught me a whole lot about the sorts of tradeoffs you
have to make as an engineer in the real world in a way that nothing else at
MIT really did. It definitely put freshman-year me in my place, too. Pretty
sure it was my first MIT all-nighter.

It's an awesome experience for the directors as well, as the competition
itself is basically a small startup. 3 or 5 students responsible for coming up
with an idea (for that year's game objective), pitching to investors (sponsor
companies), shipping a product (game engine + docs + online scrimmages),
supporting several hundred users (contestants), keeping servers up,
orchestrating a live tournament, placing an order for $2500 worth of pizza,
getting up and speaking in front of a thousand
contestants/spectators/sponsors, fixing bugs in the tournament bracket viewer
in the middle of the tournament... Not something that every undergrad gets to
do, that's for sure.

------
leelin
Now I feel old! I participated in the first two Battlecode's ever, but that
was back when it was simply 6.370. The first year was a board game and we
stared at ASCII graphics all IAP long. By my M.Eng year, Aaron Iba and co.
turned everything around and kicked off the golden age of 6.370.

Amazingly, they still have the final prizes posted from 2002 and most years in
between. Our team won the hilarious gag prize: "greatest design mismatch
between document and code." First place that year was $500. Last year when I
went, some of the gag prizes were $1000, including prizes like "last team to
submit a jar before the submission deadline"

<http://web.mit.edu/ieee/6.370/2002/web/bracket.shtml>

~~~
sskates
I am curious- what was the atmosphere at the finals like when you were a
contestant?

I remember when I first went in 2008, it felt like the superbowl for nerds.
Competitors would get up on stage and provide commentary while their swarms of
virtual robots would duke it out on screen. There would be a bunch of oohs and
aahs from the audience as each team of robots tried to gain the upper hand.
The entire auditorium would erupt in cheers at the end of the match for the
winner. I remember thinking Albert Ni was a coding god after seeing his team
walk off stage as champions of the tournament.

~~~
leelin
I believe 2004 was the turning point when the audience was very engaged --
that was the first year spectating was lots of fun, 34-101 was packed,
cheering all around, etc.

In 2001 and 2002, spectating was not fun at all, partly due to technical
issues mid-contest. To make things more entertaining, Prof. Daniel Jackson
asked Guy Steele to get up and talk about the new features in Java 1.4, and
discuss when generics in java.util would be fully supported. Not joking....

------
mindstab
Battlecode is actually also open to the public and the two years some friends
and I did it (09 and 10 I believe) we came in #1 and #2 outside of the MIT
teams (since we didn't have it as a class and it was only free time it was a
bit harder to compete) but I agree with all the points, it was a great
experience and I encourage everyone to give it a go at least once!

~~~
dthunt
LINK!

~~~
sskates
<http://www.battlecode.org/>

------
barbs
Ah man... I'd love to see a documentary on this, in the style of _Wordplay_ or
_Spellbound_.

Meanwhile, here are some programming battle games you can play at home!

Core War (Redcode, assembly dialect): <http://www.corewar.info/>

Robocode (Java/.NET): <http://robocode.sourceforge.net/>

Scalatron(Scala): <http://programminggames.org/Scalatron.ashx>

BitBath (Java): <http://bitbath.org/>

------
rekwah
I participated in the public competition a few years back with a few other
classmates. We had a blast, but definitely underestimated the amount of time
required to reach the upper echelon in the tournaments (finished middle of the
pack). As a side benefit, we were actually able to convince our university to
honor this class as a directed study and pick up a few credit hours as well.

I highly recommend this competition to anyone even remotely interested. You're
at a disadvantage entering with no experience from previous years, but it's
still a very worthwhile experience.

------
Cixelyn
For those that are interested, the new 2013 release is now live[1]. Should be
a fun game this year -- enough spec changes that even seasoned Battlecode
veterans will have to sit down and think quite carefully about how to write a
bot.

Shared sensor data now makes higher-level strategies a ton more viable, so
it'll be fun to see what contestants come up with.

There's a quick start available if you want to just clone and hack some things
together in git[2] and hg[3] flavors.

[1] <https://www.battlecode.org/contestants/releases/>

[2] <https://github.com/Cixelyn/bcode2013-scaffold>

[3] <https://bitbucket.org/Cixelyn/bcode2013-scaffold>

------
LoneWolf
This reminded me of the last AIChallenge (<http://ants.aichallenge.org>) it
was a great experience and made me choose between adding features, improve
existing ones or fix hard to find problems with a relatively short time
remaining since I found it near the end.

I didn't even knew about BattleCode, now I plan to keep an eye on it and if it
is possible to people outside MIT to participate I will try to.

~~~
nicolethenerd
It is possible! Go for it! From the FAQ:

"Do I have to be an MIT student to participate? Nope! Non-MIT students are
welcome."

(www.battlecode.org)

~~~
FrojoS
This is the best thing about MIT! I have yet to encounter a club that is not
open to everyone. So much for elitism.

------
kwang88
Really awesome post. I'd also strongly recommend 6.470 (Web Design) to any
current MIT undergrads. I competed in both 6.370 and 6.470 and had a different
take than the author of this piece -- I found that 6.470 was a much more
startup-y experience, although the emphasis is much more on product rather
than pure software development. That said, both are excellent.

Additionally, the ratio of number of teams to prize money was (historically)
more favorable for the Web Design competition, although my information is out
of date and things have likely changed.

------
jpdoctor
From a curious alum, and excuse the inside baseball: Long ago, there used to
be a 6.270 contest. I noticed this is a 6.370 contest. Anyone know the history
if they're related?

~~~
sskates
6.270 was a lego robot building competition during IAP. Is it not still
around?

~~~
leourbina
6.270 is alive and kicking. This year's website can be found here
<http://scripts.mit.edu/~6.270/>

------
Raz0rblade
Try this virtual life emulation much cooler

<https://www.youtube.com/watch?v=2W6TaNaV6W4>

And slightly less retro, if your on mitt challenge make it 3d

~~~
nicolethenerd
It is 3D. In recent years, both a 3D and 2D view has been available - the 3D
view (complete with the "circle of awesome", an automated camera which
analyzes the match to figure out where the action is - at least, they had that
a few years ago) is flashy for the spectators, while you can get a much better
sense of the overall strategy by watching the 2D view. Both views are
displayed onscreen at the final tournament.

------
Raz0rblade
less retro more fun here <https://www.youtube.com/watch?v=2W6TaNaV6W4>

------
stevearc
Great post, Cory! It's super awesome that you're open-sourcing all your
players. I would have loved that when I was competing.

------
ilamont
Are there examples of other schools that have tried this type of programming
competition?

