CMU 15-112: Fundamentals of Programming and Computer Science
Collab 1 (Due Monday 7-Sep at 8pm ET (Pittsburgh-time))



Terminology:
Teams include you and your 1 or 2 partners that you paired off with on Friday and will work very closely with this weekend. Groups include the other 4-5 people you split off into at the end of Friday recitation. Cohorts are the groups of 12-ish students originally split off by your TA from the main recitation.

General instructions
Each team of 2-3 meets over the weekend to complete these tasks. All work, without exception, must be done together. Absolutely no solo work is allowed in a collab. Meetings should occur in Zoom (or Gather Town if you are feeling adventurous).
TA's must be invited to all meetings, even though they'll only sometimes attend, and then perhaps for short periods. Share your meeting links and times with your TA's by email or google doc. Cohort TA's are available via email (or other channels, if they set those up) for questions over the weekend, as is Piazza, but teammates are strongly encouraged to help each other first, and then to ask their groupmates for help second, then Piazza, then Cohort TA's if live help is needed. Groupmates can help, but cannot see code nor be shown code. No other sources are allowed. As always, using stackoverflow or chegg or any other such website will be considered an academic integrity violation.
Turtle Puzzles
Each team (you and your partner(s)) must solve all three turtle puzzles shown in the youtube videos. You "solve" a puzzle by writing a program that produces the same behavior. Your solutions do not need to be "pixel-perfect" to receive full credit, but should look very similar to the videos. You must write your solutions collaboratively using repl.it, and you must work with your teammate at all times. You may use and modify the demo apps, which contain all the Turtle calls you'll need. Note: There is no autograder for these problems!

Download the turtle demos here

  1. Turtle Puzzle 1
    Youtube link

  2. Turtle Puzzle 2
    Youtube link

  3. Turtle Puzzle 3
    Youtube link

Create a New Turtle Puzzle

  1. Each team must create a new Turtle Puzzle that is similar in spirit to the 3 you just solved, but different enough to be interesting and non-trivial to solve (but also not impossible to solve). Have fun with it. Be creative. You can use a small number of additional turtle methods if you wish, but then you have to document that your sample solution used those additional methods. Also, make a super-short video for your puzzle (for that, we recommend Quicktime screen recordings on a Mac, or Xbox Game Bar on Windows). Keep it short and to-the-point, similar to the videos fo the 3 puzzles you just solved. You must work together at all times using repl.it and may be asked to briefly present your new puzzle (and solution) during the wrap-up meeting.

  2. You should make a short video of your puzzle (like the ones above) and then send your puzzle (but not the solution) to the other teams in your group at least 12 hours before the wrap-up meeting.

  3. You will also receive puzzles from the other groups. Your team should collaboratively make a genuine effort to solve these, but do not spend more than 30 minutes on each puzzle. You may be asked to comment on these puzzles in the wrap-up meeting.

Standard Problems
Your TA has assigned your team one of these three problems. You must solve this one specific problem collaboratively using repl.it, and you must both be able to present the entire problem (including your problem-solving process) to your group during the wrap-up meeting. You do not need to do the other two problems.

Download the starter code here and the cs112_f20_week1_linter.py

  1. isPerfectSquare(n)
    Write the function isPerfectSquare(n) that takes a possibly-non-int value, and returns True if it is an int that is a perfect square (that is, if there exists an integer m such that m**2 == n), and False otherwise. Do not crash on non-ints nor on negative ints.

  2. nearestOdd(n)
    Write the function nearestOdd(n) that takes an int or float n, and returns as an int value the nearest odd number to n. In the case of a tie, return the smaller odd value. Note that the result must be an int, so nearestOdd(13.0) is the int 13, and not the float 13.0.

    Hint: Remember that the built-in round function works in surprising ways. Instead of round(n), you should use roundHalfUp(n) from this week's notes. That said, there are good ways to solve this problem without using rounding at all, if you prefer.

  3. rectanglesOverlap(left1, top1, width1, height1, left2, top2, width2, height2)
    A rectangle can be described by its left, top, width, and height. This function takes two rectangles described this way, and returns True if the rectangles overlap at all (even if just at a point), and False otherwise. Note: here we will represent coordinates the way they are usually represented in computer graphics, where (0,0) is at the left-top corner of the screen, and while the x-coordinate goes up while you head right, the y-coordinate goes up while you head down (so we say that "up is down"). This is different from the coordinates used in turtle graphics!

Wrap-Up Meeting
Your TA will schedule a wrap-up meeting before the Monday deadline. (If convenient for all of you, you may have this meeting Sunday.) You must have completed all of your tasks BEFORE the wrap up meeting, even though the meeting is before the Monday 8pm deadline. During this meeting, you will be asked to present your solutions and discuss your collaborative problem-solving process. Everyone on your team should fully understand all of the turtle puzzles and your assigned standard question, and must be able to present this knowledge to the TA. If you collaborate well and worked together at all times, this will be no problem! (If you did not collaborate well or tried to divide the work, this will be obvious.) The TA will determine your grade based on whether you completed your tasks and whether you and your teammate(s) are able to present your work well.

Video Discussion: Why Computers Baffle Me
In the wrap-up meeting, watch this video of comedian Andrew Norelli's Ted Talk "Why Computers Baffle Me" and discuss! Comedy aside, what serious points is the comedian making? How could we use this to improve what we ourselves build using computation?
Note: You are graded on attentiveness, participation, and courtesy. (Please pay attention and be respectful.)
Submission
After the wrap-up meeting you will each download local copies of any repl.it work. Each of you will submit a zip file containing all of your work for collab1 to Autolab. We will provide more information on submission later in the weekend.