Skip to content

Instantly share code, notes, and snippets.

@whutch
Last active December 9, 2015 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whutch/f8d34b3f5808f52a117a to your computer and use it in GitHub Desktop.
Save whutch/f8d34b3f5808f52a117a to your computer and use it in GitHub Desktop.
A Bot Land mine avoider
init = function () {
started = false;
count = 0;
}
update = function () {
if (!started && (x != 0 || y != 0))
moveTo(0,0);
else
started = true;
if (count == 0) {
count = 5;
revealMines();
}
else
count -= 1;
if (x == 0)
direction = 1;
if (x == 9)
direction = -1;
if (!isEnemyMineAt(x + direction, y))
moveTo(x + direction, y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment