fraktalsyndrom / AAAH-SNAYKUU

An engine/API for programming (and battling) Snake bots in Java!
GNU General Public License v3.0
14 stars 10 forks source link

Thinking time is not well-defined #11

Open booski opened 12 years ago

booski commented 12 years ago

As the code works now, each snayk is given its own thread to think in, but the supervising thread only waits the set number of milliseconds until demanding a result. This leads to the real thinking time for each snayk being dependent on the number of cores available on the given machine, and in the case of having more snayks than cores, potentially uneven thinking time allotments for the different snayks.

For example, in a game with three snayks on a machine with two cores, each snayk will (on average) have only 2/3 of the specified thinking time available.

Furthermore, a snayk that uses near the maximum amount of thinking time will more often fail to finish thinking in time when pitted against equally CPU-intensive snayks, while it will have extra time available when pitted against simpler snayks.

In short, thinking time needs to be overhauled to become more predictable and reproducible across systems and snayk lineups.

fraktalsyndrom commented 12 years ago

Agreed. This is a relevant and known issue. One solution is to simply have the snakes decide on their moves in turn order, but that would considerably slow down the gameplay during larger snake battles.

fraktalsyndrom commented 6 years ago

After further consideration I don't think of this as an issue. It is a part of the challenge for skillful Snaykuu brain designers to consider that their personal share of CPU power during the allotted thinking time will vary depending on the number of snakes participating in the game. Additionally, a bot that has the ability to adapt its decision making process with regards to how much time is remaining will thus have a well deserved advantage over ones that don't.

Keeping the issue open for a while for input from others, but my opinion is that the current design is good.

booski commented 6 years ago

Let me rephrase the issue a bit. I do agree that there is a valuable extra dimension to the challenge by the thinking time depending on several different factors, however I don't think the current situation is making any good use of that dimension. I have several concrete measures in mind that need not exclude one another:

My general thinking behind wanting to make these values explicit is that I think there is very little difference between turning down the thinking time and increasing the number of snayks. By implementing some selection of the above we would make that distinction clearer and at the same time making it possible to write a bot geared to a specific challenge profile.