# Pages … Home Zena Abulhab CS151 - Computational Thinking: Visual Media Zena's CS151 Project 2 Page History

## Key

• This line was removed.
• Formatting was changed.

...

This is an alternate scene with the objects arranged differently. Most notably, there are fewer birds and the sun is bigger here. With multiple objects arranged like this, the function "turtle.setheader(0)" is very useful, because it sets the turtle to be facing right again, like it does by default, so you don't have to remember what direction the turtle was facing when planning the next move.

I did an extension (extension 5), for which I added fill colors to make my scene look more interesting. This was done by using "turtle.fill(True)" at the start of whatever needed to be filled in, such as brown for the boat hull, and "turtle.fill(False)" at the end to stop filling the shape. I also added in a better-looking water background by making a filled-in square as the first thing, with everything else drawn on top afterwards. For example, the sails were drawn (in white) by using the following code:
turtle.fill(True) turtle.color("white") turtle.forward(length) turtle.forward(2*length*math.sqrt(3)) turtle.right(150) turtle.forward((length*4)) turtle.right(120) turtle.forward(2*length) turtle.fill(False)
turtle.fill(True) --- tells the turtle to fill whatever it draws next
turtle.color("white") --- tells the turtle to fill with white
turtle.forward(length) --- tells the turtle to go forward by the "length" input, which is determined, as I mentioned before, by what scale the user chooses
turtle.forward(2*length*math.sqrt(3)) --- draws the "x*sqrt(3)" side of the 30-60-90 triangle that will be the mast
turtle.right(150) --- turns the turtle right 150 degrees
... *the rest of the triangle is drawn in a similar fashion*
turtle.fill(False) --- turns the turtle fill function off so the things drawn next are not filled mistakenly

For my second extension (extension 4), I added waves and more birds. Instead of individually placing them all, I made use of the "random.randint()" command, which can be used to draw many shapes at random coordinates. For the waves, I first made a wave function, then a function called "current" that calls many of them at random spots, which is written the following way:

...