How does it work?
- The functions inside
Grid handle the various drawing tasks on canvas.
- Every time, the item is placed inside canvas, it is recorded in
To be precise, it is recorded via
draw method of
- Then that
Grid is fed into
AI function that calculate distance field
CHEESE using breadth first search algorithm. Distance field is 2D array of how much a cell is far away from another cell(in this case, it is
move function takes that distance field from
AI and decide where to move for
MOUSE. In other words, it choose cell with least number given