Assignment 1: Fun with Flags

 Assigned Thursday, 25 January Due Wednesday, 31 January, 11:59 p.m.

Getting started

1. Open code.pyret.org (CPO) and ensure it’s connected to your `vassar.edu` Google account.
2. Click New File and name it `asmt01.arr`.

Help!

• You’ll want to consult the Pyret documentation. It’s accessible from CPO by clicking on the pirate button. That’s Bonny, named after pirate Anne Bonny.

In particular, we recommend at least quickly browsing through the `image` documentation before you start working on this assignment!

• Your friendly coaches and instructors are also here to help with this assignment one-on-one. Check the schedule of student coaching hours and your instructor’s office hours.

Exercise 1 4 points

Task: Write Pyret expressions to generate the flag of Switzerland.

Exercise 2 4 points

Task: Write Pyret expressions to generate the flag of the Republic of the Congo.

Exercise 3 (coach-free) 4 points

Task: Write Pyret expressions to generate the flag of Panama.

Note that this is a coach-free problem. That means you’re asked to do it entirely on your own to test your understanding and ensure you’re not receiving too much help. If you really get how to put together the flags in the previous exercises, this one shouldn’t be significantly harder than what you’ve already done.

Hints:

• Take your time! If there’s something you can’t figure out, don’t panic! Show us how close you can get.
• Try making the individual parts in the interactions pane and giving them names in the definitions pane when you’re happy with how they look.
• Make a plan for how to combine the parts. Imagine you’re stitching the flag out of pieces of fabric. How could you do that by sewing edges together (using `above` and `beside`) or by layering the pieces of fabric on top of one another (using `overlay`, `overlay-align`, `overlay-xy`).

Challenge exercise (coach-free) 1 point

This is a challenge exercise, meaning that you can get an A/A− on the assignment without completing it, but you can complete it if you want a challenge or want to try for 100%. On this particular assignment, the challenge problem works out to be 7.7% of the grade, so you can get up to 92.3% without doing it.

Here’s one last flag that’s a bit trickier to draw than it may seem:

Task: Write Pyret expressions to generate the flag of Greenland.

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

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

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

• exact positioning,
• exact size ratios,
• borders,
• exact angles, or

For instance, you can use `"red"` as the color name even if it’s a slightly different shade of red than on these flags. If you want to be more accurate, a comprehensive list of the color names Pyret understands can be found here.

For this assignment, we won’t be grading on style (but we will on future assignments!)

Submitting the assignment

1. Download your file (FileDownload) and ensure it’s named `asmt01.arr`.