Skip to content

Instantly share code, notes, and snippets.

@whutch whutch/mineavoider.js
Last active Dec 9, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.