Menu Close

Chomp Movement

Chomp has several methods to move around. The character can be controlled using the keyboard, move in a random direction, or use a custom algorithm to complete the map.

The algorithm is named Gluttony and was designed to move across the map as much as possible while eating all of the dots. The code currently doesn’t have any avoidance options. This will come in a future update.

Chomp uses the following rules to move around.

  1. It checks if there are any dots in the immediate directions.
  2. Then counts the number of dots in a line and chooses the largest number to travel.
  3. Then gets every dot until it reaches the end and then repeats the process.
  4. If there are no dots visible, it then checks in front and side to side and counts the dots on the entire screen.
  5. Then takes a “suggestion” of the largest quantity and moves in that direction.

 

When Chomp is being directed around the maze, there is a possibility of getting stuck in a loop. This can be caused by having the same number of dots in several directions. To address this issue.

  1. When Chomp is at an intersection point with multiple directions available, it places down a marker in that cell.
  2. This marker has the direction that was chosen.
  3. The next time the Chomp hits the same cell, it will be forced to make a different choice.