Code Sketch


Cats using Tangrams (Dora and Lucy)
By: Pallavi R. Naik
cleari()

//showAxes()
//showGrid()

//
def shape3 = Picture{
    right(135)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
}.thatsStrokeColored(black)

def shape4 = Picture{
    right()
    forward(100)
    left(135)
    forward(70.71)
    left(90)
    forward(70.71)   
}.thatsStrokeColored(black)

def shape1 = Picture{
    right(135)
    forward(141.42)
    left(135)
    forward(200)
    left(135)
    forward(141.42)
}.thatsStrokeColored(black)

def shape5 = Picture{
    left(45)
    forward(70.71)
    left(135)
    forward(100)
    left(135)
    forward(70.71)
}.thatsStrokeColored(black)

def shape6 = Picture{
    forward(100)
    right(135)
    forward(70.71)
    right(45)
    forward(100)
    right(135)
    forward(70.71)
}.thatsStrokeColored(black)

def shape7 = Picture {
    left(45)
    forward(141.42)
    left(135)
    forward(100)
    left(90)
    forward(100)
}.thatsStrokeColored(black)
/////////////////////////////////




/////////////////////////////////////
// Dora And Lucy

def darkGreen = Color(0, 103, 33)
def lightBlue = Color(234, 248, 253)
def colors =
    cm.linearGradient(
       50, -70, 
        darkGreen, 
        50, 20, 
        lightBlue, 
        false)         
          
setBackground(colors)   

  def lightbrown =
        cm.linearGradient(
        20, 0, 
        white, 
        -50, 0, 
        Color(249, 166, 36), 
        ) 
def coffee = Color(235, 203, 153)




def dora =  picStack(
            Picture{},
    
shape3
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 100)
,

shape5
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 100)
,

shape5
.thatsScaled(0.5, 0.5)
.thatsRotated(-180)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 100)
,

shape1

.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(-40, 10)
,

shape1
.thatsRotated(-180)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(10, -40)
,

shape7
.thatsRotated(90)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(10, -40)
,

shape6
.thatsRotated(45)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(-70, -90)


)

dora
.thatsTranslated(-100, -100)
.draw

//////////

def lucy =  picStack(
            Picture{},
    
shape3
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 00)
,

shape5
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 00)
,

shape5
.thatsScaled(0.5, 0.5)
.thatsRotated(-180)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(00, 00)
,

shape1
.thatsRotated(-90)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(10, -40)
,

shape1
.withFlippedX
.thatsRotated(-90)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(60, -90)
,
shape7
.thatsRotated(90)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(lightbrown)
.thatsStrokeColored(coffee)
.thatsTranslated(110, -40)
,


shape6
.thatsRotated(00)
.thatsScaled(0.5, 0.5)
.thatsFilledWith(Color(240, 159, 31))
.thatsStrokeColored(coffee)
.thatsTranslated(85, -15)


)

lucy
.thatsTranslated(00, -100)
.draw

setPosition(-250,-100)
right(00)
setPenColor(coffee)
setPenFontSize(30)
write("Dora")


setPosition(130,-100)
right(00)
setPenColor(coffee)
//setFont(Matura MT Script Capitals)
setPenFontSize(30)
write("Lucy")

/////////////////////////////