Skip to content

Instantly share code, notes, and snippets.

@chintanparikh
Created November 13, 2012 06:43
Show Gist options
  • Select an option

  • Save chintanparikh/4064353 to your computer and use it in GitHub Desktop.

Select an option

Save chintanparikh/4064353 to your computer and use it in GitHub Desktop.
generatePath
protected void generatePath(Point position)
{
if (position == playerPosition)
{
queue.add(playerPosition);
}
else
{
Point next = findNextTile(position);
if (next != null)
{
queue.add(next);
generatePath(next);
}
else
{
position = this.position;
generatePath(position);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment