This is what you will see during FTL travel
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(0.8);
const turtle = new Turtle();
let left = true;
let step = 0;
function isPrime(n){
for(let i = 2; i <= Math.floor(Math.sqrt(n)); i++){
if( n % i === 0){
return false;
}
}
return true;
}
function walk(i) {
turtle.penup();
turtle.goto(0, 0);
turtle.pendown();
turtle.setheading(i/10);
for (let j = 0; j < 150; j++) {
if (isPrime(i+step)) {
if (left) {
turtle.left(2);
}
else {
turtle.right(2);
}
left = !left;
}
turtle.forward(1);
step += 1;
}
return i < 3600;
}