Represents the grid of cells containing snakes and fruits. Grid is used in the MyBot::think function to create your bot. More...
Public Member Functions | |
| Cell | get (int x, int y) const |
| Returns a Cell at (x, y) or throws if x and y are invalid. | |
| Cell | get (Pos pos) const |
Returns a Cell at pos or throws if pos is invalid. | |
| int | get_height () const |
| Returns the height of the grid. | |
| int | get_width () const |
| Returns the width of the grid. | |
| int | get_current_tick () const |
| Returns the current tick with 0 being the first tick and FINAL_TICK being the last. If get_current_tick() == FINAL_TICK, then the game will finish at the end of this tick. | |
| std::vector< Pos > | find_fruits () const |
| Returns all fruit as a std::vector<Pos> | |
| Pos | find_self_head () const |
| Get the position of your head. | |
| std::vector< Pos > | find_self_positions () const |
| Get the ordered positions of all your parts. The first element is the head. | |
| Pos | find_other_head () const |
| Returns the head of the other snake. | |
| std::vector< Pos > | find_other_positions () const |
| Get the ordered positions of the other snake. The first element is their head. | |
Also see the std library vector that is returned from multiple methods. You can think of a vector as analagous to a python list.
| Cell Grid::get | ( | int | x, |
| int | y ) const |
x is valid inclusively from 0 to Grid::get_height() -1 and y is valid inclusively from 0 to Grid::get_width() -1.
A valid pos has an x-component inclusively from 0 to Grid::get_height() -1 and has y-component from 0 to Grid::get_width() -1.