Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main


Python


C++
JAVA
PHP
SQL
Assignments

Turtle


drawMethods_V1.py

# CAC, 3/2023
def drawForwardSlash(turtle,x,y,cellSize):
    """
    Draw a slash from (x,y) in the lower left
    to the upper right in a square of size cellSize
    :param turtle: The object to draw on
    :param x: x-coordinate of lower left corner of slash
    :param y: y-coordinate of lower left corner of slash
    :param cellSize: The size of the box
    """
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.goto(x + cellSize, y + cellSize)

def drawBackwardSlash(turtle, x, y, cellSize):
    """
    Draw a slash from (x+cellSize,y) in the lower right
    to the upper left in a square of size cellSize
    :param turtle: The object to draw on
    :param x: x-coordinate of lower left corner of slash
    :param y: y-coordinate of lower left corner of slash
    :param cellSize: The size of the box
    """
    turtle.penup()
    turtle.goto(x + cellSize, y)
    turtle.pendown()
    turtle.goto(x, y + cellSize)