import random
import os
from util import getTurtleAndScreen
# Random slashes
# CAC, 2023
width=800
height = 600
cellSize=50
numCols=width//cellSize
numRows=height//cellSize
filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen("Slashes",width,height,filename,moveWorld=True)
screen.bgcolor("beige")
turtle.color("blue")
turtle.pensize(2)
# To have it animate the drawing, uncomment these lines.
# This can be helpful while debugging.
#screen.tracer(1)
#turtle.showturtle()
for row in range (0,numRows):
for col in range(0,numCols):
x = col*cellSize
y = row*cellSize
if(random.randint(0,1)==0):
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.goto(x+cellSize,y+cellSize)
else:
turtle.penup()
turtle.goto(x+cellSize,y)
turtle.pendown()
turtle.goto(x,y+cellSize)
turtle.penup()
turtle.goto(0,0)
screen.mainloop()