Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python: How do I do specifically do the following for my code: 1 . Have a GUI asking for the amount of lakes, mountains, AND
Python: How do I do specifically do the following for my code:
Have a GUI asking for the amount of lakes, mountains, AND rivers to be RANDOMLY generated.
Lower the 'island' land generating circles beachsand grass to on the grid prevent generating lakesmountains off of land
INCREASE the size of the circles times than it currently already is to take up more of the grid. AKA, circles widened three times than they already are.
Have "rivers" cut through ENTIRE island slice in half, not cut half way and begin another cut
Make the mountains triangles instead of circles.
Really need help on this. My code so far:
import turtle
import random
# Define colors
ocean #
sand #ffff
grass #cc
lake #ff
mountaincolor ## Gray color for mountains
# Store mountain positions
mountainpositions
def drawcircleradius linecolor, fillcolor:
myturtle.colorlinecolor
myturtle.fillcolorfillcolor
myturtle.beginfill
myturtle.circleradius
myturtle.endfill
def moveturtlex y:
myturtle.penup
myturtle.gotox y
myturtle.pendown
def drawlake:
x random.randint
y random.randint
moveturtlex y
drawcircle lake, lake
def drawmountains:
x random.randint
y random.randint
mountainpositions.appendx y
screen turtle.Screen
screen.bgcolorocean
screen.titleIsland Generator"
myturtle turtle.Turtle
myturtle.pensize
myturtle.shapecircle
# Draw the sand area
drawcircle sand, sand
# Draw the grass area
moveturtle
drawcircle grass, grass
# Draw lakes as bigger random dots
numlakes # Number of lakes to draw
for in rangenumlakes:
drawlake
# Draw mountains
nummountains # Number of mountains to draw
for in rangenummountains:
drawmountains
# Draw mountains as separate color
for pos in mountainpositions:
moveturtlepos pos
drawcircle mountaincolor, mountaincolor
# Draw rivers
numcuts intinputHow many rivers do you want on your Island?
moveturtle
myturtle.colorocean
for in rangenumcuts:
myturtle.pendown
myturtle.left numcuts
myturtle.forward
myturtle.penup
myturtle.backward
turtle.done
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started