Skip to content

Instantly share code, notes, and snippets.

@jywarren
Forked from anonymous/ant.js
Last active September 15, 2015 16:54
Show Gist options
  • Save jywarren/6812acd130f3fdc7896f to your computer and use it in GitHub Desktop.
Save jywarren/6812acd130f3fdc7896f to your computer and use it in GitHub Desktop.
An ant script saved from https://github.com/jywarren/antfarm
onRun = function() {
var redness = lookFor('blue',3);
if (redness == "N") this.direction = 0;
if (redness == "E") this.direction = 90;
if (redness == "S") this.direction = 180;
if (redness == "W") this.direction = 270;
this.direction += Math.random()*10-5;
field.trail(this.x, this.y, 'red', 50); // x, y, rgb, amount
}
onBump = function() {
this.direction += 90;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment