Multithreading / -processing


just wondering how much compute power i can utilize to provide an output.
Of course it would be more efficient to use Multithreading and/or Multiprocessing, but is it possible to do so?
Sure i can test it myself, but if it isn’t possible, this post could be moved to the feedback section.


Your bot/program will run in a VM having 1 CPU. Multi-threading is not practical here.

Okay, thanks for the answer. I thought something like this.

Just another Question here, to another Topic though:
I’m working on Code vs Zombies atm. The game tells me, i got 100 ms per turn. I measured that my init-code (read input & create gamestate) runs for about 350ms, but i am able to do other things afterwards and get no timeout error.
So, when does my 100 ms Timer starts?

The game rounds are in an infinite loop.
I guess, in each iteration, the server starts counting time after sending data to stdout (supply data to your bot).
It listens for input from stdin (your bot’s response to game) within a defined moment.
If no input was obtained before time-out, game over.

Your program startup time, init time, etc should have been done before entering the while loop.

I do not work for CG I do not know exactly how their backend server is set up. The above are my speculations.

In most multiplayers you get more time on the first turn. Normally it’s 1 second but it might vary depending on the game.

I start to measure time at the beginning of the while loop and my code to simulate the game engine and create the gamestate are within that loop.
So it it curious, that the game states i got 100 ms per turn, when i’m able to do stuff even after 350 ms have passed.
@MrAnderson true, but in Code vs Zombies there is no such statement + surpass this constraint in every round

You have to start your timer after the first input, and to stop it just before your output. Otherwise you measure the referee’s and opponent’s time.