Black Rock City

ChatGPT prompt "Write a javascript program using the Turtle API that will draw a map of Black Rock City"

Log in to post a comment.

const turtle = new Turtle();

turtle.penup();
turtle.goto(-100, 100);
turtle.pendown();

// Draws the outer rectangle of Black Rock City
turtle.forward(200);
turtle.right(90);
turtle.forward(200);
turtle.right(90);
turtle.forward(200);
turtle.right(90);
turtle.forward(200);

// Draws the "Man" statue at the center of Black Rock City
turtle.penup();
turtle.goto(0, 0);
turtle.pendown();
turtle.right(45);
turtle.forward(50);
turtle.right(135);
turtle.forward(35.355);
turtle.right(135);
turtle.forward(50);

// Draws the radial streets around the Man statue
for (let i = 0; i < 8; i++) {
  turtle.penup();
  turtle.goto(0, 0);
  turtle.pendown();
  turtle.right(45 + (45 * i));
  turtle.forward(100);
}