Python Turtle: How do I fix the code to make it generate lakes as bigger random dots, and mountains as a separate color (gray) from the grass area? (Big error: lake generates as entire circle inside land, want it generating like mountains).AKA: How do I separate each of the values to generate on its own without conflicting eachother. import turtleocean = "#000066"sand = "#ffff66"grass = "#00cc00"lake = "#0066ff"mountain = [[-60, 115], [-65, 200], [-10, 145], [-30, 70], [50, 115], [100, 150], [70, 200], [30, 70], [10, 180], [-10, 220]]def draw_circle(radius, line_color, fill_color): my_turtle.color(line_color) my_turtle.fillcolor(fill_color) my_turtle.begin_fill() my_turtle.circle(radius) my_turtle.end_fill()def move_turtle(x, y): my_turtle.penup() my_turtle.goto(x, y) my_turtle.pendown()num_cuts = int(input("How many rivers do you want on your Island? ")) screen = turtle.Screen()screen.bgcolor(ocean)screen.title("Island Generator")my_turtle = turtle.Turtle()my_turtle.pensize(4)my_turtle.shape("circle") draw_circle(150, sand, sand)move_turtle(0, 30)draw_circle(120, grass, lake)for i in mountain: move_turtle(i[0], i[1]) draw_circle(6, grass, grass)move_turtle(0, 150)my_turtle.color(ocean) for _ in range(num_cuts): my_turtle.pendown() my_turtle.left(360 / num_cuts) my_turtle.forward(150) my_turtle.penup() my_turtle.backward(150) turtle.done()
Python Turtle: How do I fix the code to make it generate lakes as bigger random dots, and mountains as a separate color (gray) from the grass area? (Big error: lake generates as entire circle inside land, want it generating like mountains).
AKA: How do I separate each of the values to generate on its own without conflicting eachother.
import turtle
ocean = "#000066"
sand = "#ffff66"
grass = "#00cc00"
lake = "#0066ff"
mountain = [[-60, 115], [-65, 200], [-10, 145], [-30, 70], [50, 115], [100, 150], [70, 200], [30, 70], [10, 180], [-10, 220]]
def draw_circle(radius, line_color, fill_color):
my_turtle.color(line_color)
my_turtle.fillcolor(fill_color)
my_turtle.begin_fill()
my_turtle.circle(radius)
my_turtle.end_fill()
def move_turtle(x, y):
my_turtle.penup()
my_turtle.goto(x, y)
my_turtle.pendown()
num_cuts = int(input("How many rivers do you want on your Island? "))
screen = turtle.Screen()
screen.bgcolor(ocean)
screen.title("Island Generator")
my_turtle = turtle.Turtle()
my_turtle.pensize(4)
my_turtle.shape("circle")
draw_circle(150, sand, sand)
move_turtle(0, 30)
draw_circle(120, grass, lake)
for i in mountain:
move_turtle(i[0], i[1])
draw_circle(6, grass, grass)
move_turtle(0, 150)
my_turtle.color(ocean)
for _ in range(num_cuts):
my_turtle.pendown()
my_turtle.left(360 / num_cuts)
my_turtle.forward(150)
my_turtle.penup()
my_turtle.backward(150)
turtle.done()
Trending now
This is a popular solution!
Step by step
Solved in 2 steps