🐍
[PY] Intro to Computational Media 2.0
CS4All Resources
  • Curriculum Overview
  • How to Use this Curriculum
  • 📬Leave Us Feedback
  • Curriculum Extras
    • 🔮Curriculum Extras Overview
    • Imposter Syndrome (pt. 1)
      • Imposter Syndrome (pt. 2)
    • Timers in Processing.py
    • Time Functions: Crazy Clock Mini Project
    • Pathfinding Algorithms and Facial Scanning
    • Playing with Pixels
  • Unit 1: Draw & Draw With Functions
    • 🔮Unit 1 Overview
    • U1LA1.1: Processing.py Introduction & Deconstruction
    • U1LA1.2 Line Functions and Parameters
    • U1LA1.3: Rectangles, Ellipses, and Layering
    • U1LA1.4: Other Shapes & Styling
    • 🗃️U1LA1 Mini Project: Taijitu Symbol
    • U1LA2.1: Intro to Color with RGB and HSB
    • 🤓EXTRA: Color & Data Storage
    • 🤓EXTRA: Color Palette Practice
    • ✨U1LA3.1: Introducing Variables
    • ✨U1LA3.2: Creating Custom Variables
    • ✨U1LA4.1: What is Abstraction?
    • ✨U1LA4.2: Intro to Functions and Function Calls
    • U1LA4.3: Draw with Functions
    • U1LA4.4: Using the Random Function
    • 🗃️U1LA4 Mini Project: Custom Emoji
    • U1LA5.1: Your Custom Function Library
    • 🎨Unit 1 Final Project: Abstract Album Art
  • Unit 2: Respond and Draw On Canvas
    • 🔮Unit 2 Overview
    • ✨U2LA1.1: Conditionals and If Statements
    • ✨U2LA1.2: Conditionals and if, elif, and else statements
    • ✨U2LA1.3: Logical Operators And/Or
    • 🗃️U2LA1 Mini Project: Make a Traffic Light
    • U2LA2.1: Draw with Mouse
    • U2LA2.2: The Map Function
    • ✨U2LA3.1: Data Type Scavenger Hunt
    • ✨U2LA3.2: Functions that Return Values
    • 🤓U2LA3.3: Functions with Purpose
    • U2LA4.1: Collision Functions and Libraries
    • U2LA4.2: Mouse Clicks and Shapes as Buttons
    • 🗃️U2LA2 Mini Project: Light Switch Game
    • U2LA5.1: Key Presses and Nested Conditionals
    • 🎨Unit 2 Final Project: Interactive Drawing App
  • Unit 3: Loops, Arrays, Media
    • 🔮Unit 3 Overview
    • U3LA1.1: While Loops
    • U3LA1.2: For Loops Pt. 1
    • U3LA1.3: Nested For Loops (For Loops Pt 2)
    • 🗃️U3LA1 Mini Project: Wallpaper Design
    • U3LA2.1: Introduction to Lists
    • U3LA2.2: Random Values from Lists
    • 🗃️U3LA2 Mini Project 1: Fortune Teller
    • U3LA2.3: Loops and Lists
    • U3LA2.4: Updating and Deleting from Lists
    • 🗃️🤓 U3LA2 Mini Project 2: CodeWars List Challenges
    • U3LA3.1: Loading Images
    • 🗃️U3LA3 Mini Project: Vision Board
    • 🎨Unit 3 Final Project: Random Meme Generator
  • Unit 4: Motion, Objects, Transformation
    • 🔮Unit 4 Overview
    • U4LA1.1: Intro to Motion with Flipbooks
    • U4LA1.2: Move in All Directions and Make it Bounce
    • U4LA2.1: Introduction to Classes and Objects
    • U4LA2.2: Reading and Updating Object Properties
    • U4LA2.3: Methods Off Canvas
    • U4LA2.4: Objects on Canvas
    • 🗃️U4LA2 Mini Project: Build a Tamagotchi
    • U4LA3.1: Creating Many Objects
    • 🤓🗃 Optional U4LA3 Mini Project: Rebuild with Objects
    • U4LA4.1: Translation Battleship
    • U4LA4.2: Rotations
    • 🤓U4LA5.1: Sine and Oscillating Motion
    • 🤓U4LA5.2: Cosine and Circular Motion
    • 🎨Unit 4 Final Project: Animated Greeting Card or PSA
  • Unit 5: Final Project
    • 🔮Unit 5 Overview
    • 🎨Course Final Project Guide
Powered by GitBook
On this page
  • Prompt
  • Culturally Responsive Best Practices
  • Extensions
  • Do-Now/Launch
  • Prompt Launch
  1. Unit 2: Respond and Draw On Canvas

U2LA2 Mini Project: Light Switch Game

Unit 2 Mini Project Light Switch Game

PreviousU2LA4.2: Mouse Clicks and Shapes as ButtonsNextU2LA5.1: Key Presses and Nested Conditionals

Last updated 1 year ago

Prompt

Congratulations! Your great aunt’s second cousin twice removed (on your mother’s side) has recently left you a spooky old house. This is great, because “free house”. As you can imagine, however, this does come with its fair share of problems, because it is spooky, and it is old.

The biggest problem your great aunt’s second cousin twice removed’s attorney warns you about when handing over the deed is that the wiring in the house is pretty old and nonsensical. Sometimes, a light switch controls multiple lights: it might turn more than one light on at a time, and will also turn some lights off. Because the house is spooky, you need to figure out how to turn all of the lights on as quickly as possible.

The attorney recommends you try to make this into a game to help you practice and to distract you from the dark foreboding shadows that definitely are not hiding anything you need to worry about (but let’s turn the lights on just in case?).

Create a Processing.py program that will have at least 6 buttons - your light switches. Each light switch should control several other lights, and maybe also the light you clicked. Create a solvable puzzle game in which you need to find the right order to press the switches so all lights are turned on at once.

Requirements:

Work with a partner to complete the following:

  1. Create a game with at least six clickable buttons.

  2. Create a flowchart of your game so you can guarantee that there is a combination of switches that you can click to turn them all on, solving the puzzle.

  3. Create a Processing.py program where each switch turns a combination of lights on and/or off. Utilize a dictionary to store the colors (or whatever property you are changing) for all of the lights!

  4. Look for places of repeated code - can these be abstracted into functions?

  5. Add any necessary design elements to make this game look appealing!

Sample Output

N/A - figure it out!

Culturally Responsive Best Practices

This game allows students to play with an algorithm and user interactions to make a mini-puzzle. The best opportunity to be culturally responsive is to once again allow for an ample amount of student choice - they can choose to design the puzzle as they wish, or can make adjustment to the end-goals of the game as long they are hitting the key concepts assessed by this mini project.

Extensions

  • Figure out how to draw a new background and “scene” if you win, so that the player knows they have completed the challenge.

  • Figure out how to keep score, and make something happen if the user has clicked too many times without solving the puzzle.

Do-Now/Launch

Ask students what buttons can control - make sure they understand that buttons can control things outside of themselves. (EX: A circle button can change the color of a different, rectangular button when clicked) During the lesson launch, feel free to play up the prompt to make this as fun and engaging to your students as possible!

Prompt Launch

This prompt is really a clever facade to get students to approach a complex logic puzzle; the coding is no more difficult than what they did in their button lessons, but the logic of making this work will be a trial.

For this reason, it is recommended that students use this as their first big pair-programming project. Having a thought partner for this activity will go a long way in making it feel manageable. It’s strongly suggested that pairs make a plan - via flowchart, wireframe, or other - and show it to the teacher before they are allowed to begin programming.

Once students begin programming, they are encouraged to work on one computer and maintain the driver/navigator roles. While this isn’t a clear-cut project with an equal number of ‘at bats,’ swaps can be controlled by time. Consider playing music and announcing student swaps every two songs (or roughly every 10 minutes). Be mindful when circulating to ensure students are staying true to this structure.

🗃️