sample.lua 1.49 KB
Newer Older
nachtgold's avatar
nachtgold committed
1
--- This is a brief overview of all usable functions within the bot logic.
nachtgold's avatar
nachtgold committed
2

3
4
5
6
7
8
9
--- That method is called each frame.
-- Here you can implement you bot logic. The return value must be an radiant angle.
-- A negative angle means turn left and a positive angle 
-- means turn right. With 0, the snake keeps its direction.
-- @return new angle relative to the head direction
-- @usage function step()
--   return 45 
nachtgold's avatar
nachtgold committed
10
-- end
11
12
function step()
    return 45
nachtgold's avatar
nachtgold committed
13
end
nachtgold's avatar
nachtgold committed
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- That method returns all food as list.
-- @param max_distance all food within the distance is included
-- @param minimum_food_value all lower food values are filtered (min: 0, max: unknown)
-- @usage local food = findFood(max_distance, 0.8)
-- for i, item in food:pairs() do
--   item.d -- angle in radian
--   item.dist -- distance
-- end
function findFood(max_distance, minimum_food_value)
end

--- That method returns all segments of all snakes within a certain radius as list. 
-- All attributes of each item in the segments list are measured between the center of your head the the center of the item center.
-- @param max_distance all segements within that distance are included
-- @param include_own If true, your snake segments are included. Otherwise you get only enemy segments
-- @usage 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
function findSegments(max_distance, include_own)
nachtgold's avatar
nachtgold committed
38
end