Python Turtle: How do I increase my circle size by 2x its current diamater, add/fix random mountain generation, keep lakes and mountains generating on the island (not off in the ocean), and have 'river' cuts going through the WHOLE circle instead of just stopping at the middle?My code so far: import turtleimport random # Define colorsocean = "#000066"sand = "#ffff66"grass = "#00cc00"lake = "#0066ff"mountain_color = "#808080" # Gray color for mountains 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() def draw_lake(): x = random.randint(-100, 100) y = random.randint(-50, 100) move_turtle(x, y) draw_circle(30, lake, lake) screen = turtle.Screen()screen.bgcolor(ocean)screen.title("Island Generator") my_turtle = turtle.Turtle()my_turtle.pensize(4)my_turtle.shape("circle") # Draw the sand areadraw_circle(150, sand, sand) # Draw the grass areamove_turtle(0, 30)draw_circle(120, grass, grass) # Draw lakes as bigger random dotsnum_lakes = 2 # Number of lakes to drawfor _ in range(num_lakes): draw_lake() #Draw mountainsnum_mountains = 5 # Number of lakes to drawfor _ in range(num_mountains): draw_mountains() # Draw mountains as separate colorfor pos in mountain_positions: move_turtle(pos[0], pos[1]) draw_circle(15, mountain_color, mountain_color) # Draw riversnum_cuts = int(input("How many rivers do you want on your Island? "))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 increase my circle size by 2x its current diamater, add/fix random mountain generation, keep lakes and mountains generating on the island (not off in the ocean), and have 'river' cuts going through the WHOLE circle instead of just stopping at the middle?
My code so far:
import turtle
import random
# Define colors
ocean = "#000066"
sand = "#ffff66"
grass = "#00cc00"
lake = "#0066ff"
mountain_color = "#808080" # Gray color for mountains
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()
def draw_lake():
x = random.randint(-100, 100)
y = random.randint(-50, 100)
move_turtle(x, y)
draw_circle(30, lake, lake)
screen = turtle.Screen()
screen.bgcolor(ocean)
screen.title("Island Generator")
my_turtle = turtle.Turtle()
my_turtle.pensize(4)
my_turtle.shape("circle")
# Draw the sand area
draw_circle(150, sand, sand)
# Draw the grass area
move_turtle(0, 30)
draw_circle(120, grass, grass)
# Draw lakes as bigger random dots
num_lakes = 2 # Number of lakes to draw
for _ in range(num_lakes):
draw_lake()
#Draw mountains
num_mountains = 5 # Number of lakes to draw
for _ in range(num_mountains):
draw_mountains()
# Draw mountains as separate color
for pos in mountain_positions:
move_turtle(pos[0], pos[1])
draw_circle(15, mountain_color, mountain_color)
# Draw rivers
num_cuts = int(input("How many rivers do you want on your Island? "))
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()
Step by step
Solved in 2 steps