Code Sketch


House
By: Omsparsh Phal Dessai
Category: Art
//house
clear
showAxes
showGrid()
setSpeed(fast)

//house
setPenColor(blue)
setPenThickness(2)
setFillColor(yellow)
left
hop(100)
right(180)

def polygon(size: Int, sides: Int, steps: Int ) {
    if (steps==0){
        
    }
    else{
        forward(size)
        right(360/sides)
        polygon(size, sides, steps-1)
    }
}
polygon(200, 4, 4)
left(60)
setFillColor(brown)
polygon(200, 3, 3)


//door
right(60)
hop(100)
right()
hop(200)
right()
hop(25)
right()

def rectangle(length: Int, breadth: Int, steps: Int) {
    if (steps==0){
        
    }
    else{
        forward(length)
        right()
        rectangle(breadth, length, steps-1)
    }
    
}

rectangle(100, 50, 4)


//window 1
hop(100)
left()
hop(55)
right(180)

polygon(35, 4, 4)

right
hop(35)
left(150)

polygon(35, 3, 3)

left(30)
hop(35)
right()
hop(125)

polygon(35, 4, 4)

right
hop(35)
left(150)

polygon(35, 3, 3)


left(120)
hop(45)
right()
hop(195)
left()
hop(40)
right(180)

setFillColor(green)
rectangle(80, 30, 4)