Objectives


Work Log


Use conditional statements to control the flow of your programs. Create a sketch that asks people to make difficult choices that have surprising consequences.

  1. Ideation
    1. Chris raised the idea that an iconic representation of ‘choice making’ would be the red pill/blue pill from [The Matrix(1999)] - making choices that are binary and difficult to know the consequences of.
    2. I came up with the reference of [Turtles Are Surprisingly Fast Swimmers(2005)], where a common housewife is challenged to make the right decisions to become a spy. I thought this premise was funny and would fit our frame of the assignment well.
  2. Making
    1. building the central logic

      1. We needed a ‘storyline’ of this little game. Since Chris and I both share a passion in spreadsheets, we communicated through this tool. After some discussion, we agreed on the overall storyline and options/choices to make.

        Screenshot 2024-09-23 at 1.45.27 PM.png

    2. Building the code logic

      1. We need 4 queries - each with two choices; one fail screen that has a restart option; one success screen
        • As you can see from the sketch, we wanted different fail screens for each query, but that would complicate things too much so we narrowed it down to one.
      2. We split up and each came up with the best ways to make this structure possible.
        • Because it gets confusing with the details of each prompt, I simplified the screens into the same layout and color coded them for differentiation to build ‘a skeleton’ of the code.
        • At first, I nested 4 if statements.
          • https://editor.p5js.org/jinnie75/sketches/hz1LRdgWP: in this draft the choice made in the first query is stored and the second query is bypassed, since it has the same if condition as the first query.
          • Since the choice the user makes in one query is independent from a choice made in a different query, I figured I’ll need a choice variable indicating which of the options were selected to be initialized at each query, and a qnum variable to mark which query the user is at.
        • I also declared a state variable - if you stay alive you continue on to the next query; otherwise you escape the cascade.
      3. When we regrouped we decided to go on with this structure. We split our workload - Chris was responsible for visualization of the actual screens and I worked on developing the restart logic of our fail screen.
      4. The final output: https://editor.p5js.org/Chris-ITP/sketches/7e5UzxDys
      5. Work process: Collaborating remotely worked well for us. Our schedules were difficult to arrange for the same location and the same time, and we each needed some alone time to figure out how to write the code. We paid extra attention on writing readable code and commenting, so that we could understand each others’ work. Our discussions were short and sweet, talking about why we coded in such a way and what should be done next.
        • some of our conversations on the spreadsheet..
        • comments made it easy to understand what each code block was for, to pick up and modify from each others’ work
  3. Thoughts
    1. We could make the choice structure much more complicated - such as creating choices where it doesn’t matter if you choose either option; where results aren’t just limited to your success in becoming a spy but has consequences on other aspects like your relationships and so on.
      1. when we do, I wonder if there could be a more effective code structure.
    2. Also, we intended to have different looking fail screens but that would make the code much too complicated so we compromised with a common fail screen. I wonder if a more effective code structure could enable that as well.
    3. I wonder if nesting conditionals (as opposed to my current structure of 4 lateral conditionals) is a better structure.

Learning Materials


Questions