Assignment 1: Flags

Assigned: Thursday, 9 September
Due: Thursday, 16 September, 11:59 p.m.

Learning goals

  • Navigate Pyret documentation
  • Use the images library

Getting started

  1. Open and ensure it's connected to your Google account.

  2. Make a new file named asmt1.arr.

Note: Assignments will be graded anonymously, so don't include your name with your program.

Getting Help

  • You'll want to consult the Pyret documentation. It's accessible from CPO by clicking on the pirate button in the top left corner.

    In particular, we recommend taking a look at the image documentation before working on this assignment!

  • If you have any questions, please post on Campuswire. Don't post any code unless requested by the coaches or instructors, though.

  • Your friendly coaches and instructors are also here to help with this assignment one-on-one, in person and on Zoom. Check your section's website for a schedule of office hours.


Write code to generate four flags:

  1. Madagascar

Flag of Madagascar

  1. Turkey

Flag of Turkey

  1. Jamaica

Flag of Jamaica

  1. Greenland

Flag of Greenland

Set up your code so that the four flags are output in the interactions window (on the right) when we press the Run button. Make sure nothing else is output (no sub-images, numbers, strings, or otherwise).

Grading criteria

When we grade the assignments, we will be looking for accuracy in

  • the shapes that are present,
  • their general locations,
  • sizes, and
  • orientations.

We do not care about

  • exact positioning,
  • exact size ratios,
  • borders,
  • exact angles, or
  • precise color shades.

For instance, you can use "green" as the color name even though it produces a brighter green than on some of these flags. If you want to be accurate, a comprehensive list of the color names Pyret understands can be found here.

For this assignment, we won't be grading on style. However, you should start familiarizing yourself with good Pyret style, which will be graded on future assignments.

Submit assignment

  1. Download your file (FileDownload) and ensure it's named asmt1.arr.

  2. Upload your assignment on Gradescope.

Note: You can submit as many times as you want before the deadline. Only your latest submission will be graded.


This assignment is adapted from Kathi Fisler and colleagues at Brown University.