Code Sketch


House
By: Pravita Sawant
Category: Programming
clear()
setSpeed(fast)
showAxes()
setPenColor(black)
setPosition(100, 0)
setFillColor(Color(113, 31, 51, 252))
def shape(side: Int, size: Int) =
    {
        if (size <= 0) {}
        else {
        }
        repeat(side) {
            forward(size)
            right(360 / side)
        }
    } //> def shape(side: Int, size: Int): Unit

def rect(side: Int, size: Int) =
    {
        if (size <= 0) {}
        else {
            repeat(side) {
                forward(50)
                right(90)
                forward(size)
                right(90)
            }
        }
    } //> def rect(side: Int, size: Int): Unit

left()
shape(3, 200)

setPosition(100, -200)
setFillColor(Color(207, 51, 6, 217))
shape(4, 200)
setFillColor(Color(113, 31, 51, 252))
setPosition(90, -120)
shape(4, 35)
setPosition(88, -120)
shape(3, 32)

setPosition(-50, -120)
shape(4, 35)
setPosition(-52, -120)
shape(3, 32)

setPosition(25, -200)
rect(2, 150)

setFillColor(Color(0, 226, 19))
setPosition(20, 40)
rect(2, 20)