{% extends 'core/base.html' %} {% load static %} {% block title %}
This is a brief overview of all usable functions within the bot logic.
Every bot is allowed to store 100MB within the global namespace and the data persists until the bot dies. So the bot can save data from frame to frame.
step () | That method is called each frame. |
init () | This method is called upon creation of a bot Initialialize your environment here. |
findFood (max_distance, minimum_food_value) | That method returns all food as list. |
findSegments (max_distance, include_own) | That method returns all segments of all snakes within a certain radius as list. |
log (message) | That method sends messages to the development console. |
function step()
return 0.005
end
max_distance
all food within the distance is included
minimum_food_value
all lower food values are filtered (min: 0, max: unknown)
local food = findFood(max_distance, 0.8)
for i, item in food:pairs() do
item.d -- angle in radian
item.dist -- distance
end
max_distance
all segements within that distance are included
include_own
If true, your snake segments are included. Otherwise you get only enemy segments
local segments = findSegments(50.0, false)
for i, item in segments:pairs() do
item.d -- angle in radian
item.r -- radius of the item
item.dist -- distance
item.bot -- id of the other snake
end
message
this string will be transfered to the console