What resolves first, weed growth or bot movement?

Say you are hugging the outline of a weed and issue the next command RIGHT to continue, (see my beautiful ascii image below).
Is it possible that the weed growth resolves first and suddenly fills the empty square to the right, for you to then collide with what was empty space the tick before?

x = Weed
- = Bot Path
> = Next Step

X X X X
X X X X
-  -  >

@Gilad the order in which actions are performed can be seen in this section of the engine:

It looks like player actions are performed first, then weeds are grown. I don’t however see a check for the player’s position in the grow code, so I suspect the weed can be grown onto your position :thinking: @EC team (@deefstes ) might need to look at this:

Hey guys, yes, thanks for the scrutiny. @kobus-v-schoor is correct that the bot actions are performed first and then the weeds are grown.

It is true that a weed can grow onto a bot’s position but that won’t be seen as a collision. The collision detection will only happen on the next game tick after the bot’s next movement has been performed, at which point it will have vacated the cell that is now occupied by the weed.

What it does mean of course is that the weed has effectively grown over the bot’s trail and so once the trail is completed, it might not result in a clearing of the weed. But this is true for a weed that grows over a bot’s trail way behind the bot, or on the cell where the bot found itself at the end of the game tick.

Bear in mind also that, for a bot to be running right on the edge of a weed will always be a dangerous game. We discussed the scenario above where a weed grows onto the cell that a bot finds itself on, which is not a problem for the bot as I explained. But consider that at the end of a game tick the weed might grow onto the cell directly in front of the bot, and on the start of the next game tick the bot will run straight into that brand new weed section of the weed.

2 Likes