✨Tips and tricks
Here are some tips and tricks for creating your bot
Last updated
Here are some tips and tricks for creating your bot
Last updated
The Manhattan Distance is a useful way to calculate distances on a grid-based map such as this one:
Source: https://iq.opengenus.org/euclidean-vs-manhattan-vs-chebyshev-distance/ Here's our implementation of the Manhattan Distance, which you are free to use in your code:
In case you're looking to visualise the entire game map in some form (e.g. as an array), here's an example implementation:
game_state
has been updated (Dealing with asynchrony)Due to a limitation in the way Agents interact with the game environment, there may be a lag in the update of the game_state
your Agent receives on each 'tick'. For example, when an Agent produces an action, the effects of this action may not become observable in the next 'tick', but will be updated in the following 'tick' after that.
As a workaround, you can pre-plan and store your Agent's action, e.g.:
self.planned_actions.append('p')
Then have your Agent choose the next planned action (e.g. using action = planned_actions.pop()
) after checking whether the game state has updated.
One method is to check whether the current game_state.tick_number
is greater than the previous tick_number
by a certain delay threshold (e.g. one or two ticks) before sending your next move.
Another method is using game_state.entity_at(my_location)
to check whether your action has been executed (e.g. if game_state.entity_at(my_location) = 'p'
, then you know your Agent has successfully placed its bomb).
Since your Agent is a class object, instead of returning one action at a time, you can also store and pre-plan a list of moves in one go. As the game executes, you can then tell it to choose from your pre-planned set of moves instead of having to process a new move.
For example to store a move: self.planned_actions.append('b')
Then to use your planned action:
This can be useful to help you navigate to specific objects across the Game map, or in a workaround to any game_state
update syncing issues (see Tips and Tricks note above).
Monte Carlo Tree Search A Python implementation
Reinforcement Learning: An Introduction Sutton & Barto (2017)
Our own Tabular Q-Learning Tutorial (using OpenAI Gym's Taxi)