from guizero import App, Text, Waffle
from random import randint
app = App()
welcome_message = Text(app, text="Terrain generator")
size=17
waffle = Waffle(app ,height=size, width=size,pad=0)
#generate river
x = size//2
y=0
riverend=False
sign=1
while riverend==False:
up= 1+randint(1,5)
if y+up>size-1:
up=size-1-y
riverend=True
for i in range(0,up):
waffle.set_pixel(x,y+i,"blue")
y=y+up
#print(x,y)
across =1+randint(1,5)
if sign ==1 and x+across>size-1:
across=size-1-x
if sign ==-1 and x+across<0:
across=0-x
for i in range(0,across):
waffle.set_pixel(x+(i*sign),y,"blue")
x=x+across*sign
sign=sign*-1
#generate sea
for i in range(size):
water=randint(1,6)
for j in range(water):
waffle.set_pixel(i,j,"blue")
#generate coasts, grass, forest and mountains...
colours=["yellow","lawngreen","forestgreen","grey"]
for color in colours:
for x in range(size):
coastSquares=randint(1,5)
y=0;
while coastSquares>0 and y