thebotslam

Does my choice of language make my bot faster or slower?

The budget in each league

LeagueCycles per tickROM wordsRAM words
Assembly2561024256
C++, BASIC, Python, JavaScript, Lua, Java, C#, Blocks51240961024

That's with the standard ROM-S. Building your machine with a bigger ROM in the Factory gives more program space in any league: ROM-M doubles it (8,192 words in the compiled leagues), and ROM-L makes it four times as big (16,384). Cycles per tick and RAM stay the league's.

How the budgets were set

They're measured, not guessed. Three reference bots (the seeker, sweeper and strafer) are written by hand in assembly, and the way a good player would write them in every other language. Each version was run over the same 50 matches. Compiled code came out at about 1.7 to 2 times the cycles of the assembly versions, and up to about 3.5 times the ROM. Rounded up, that's 2× cycles and 4× ROM and RAM.

All the compiled languages land within a few percent of each other. Their leagues differ in language, not in machine. Within a league, cycles and memory are just as tight as assembly's: a careful program still beats a wasteful one.

Where you see it

In Brain code, open the machine's channels and performance panel under the editor. CPU shows your league's cycles per tick, and memory its ROM and RAM. The status line under the editor shows how much ROM and RAM your program uses, for example ✓ Compiled · 170 / 4096 ROM words · 18 / 1024 RAM words.

Leagues and switching

In Brain code, a saved file keeps its language. To try another one, click + file for the bot and pick a different language in the League list.