Code Sketch


yadnesh shahare
By: Mhalsakant School
Category: Art
// Define a single square box
def square() { 
    setPenColor(randomColor)
    repeat(4) {
        forward(30)
        right(90)
    }
}

// Define a ladder (a stack of 10 squares going up)
def ladder() {
    repeat(10) {
        square()
        forward(30) // Move up to the next rung
    }
}

// Main execution code
clear()
setSpeed(fast)       // Increased to fast so you don't have to wait too long!
setPenThickness(4)

// Loop 10 times to draw 10 ladders side-by-side
repeat(10) {
    ladder()        // 1. Draw one vertical ladder of 10 boxes
    hop(-300)       // 2. Fly back down to the starting baseline (10 boxes * 30 units = 300)
    right(90)       // 3. Turn right
    hop(30)         // 4. Move over to the next column
    left(90)        // 5. Face forward again, ready for the next ladder
}