0% found this document useful (0 votes)
82 views

Copy of Activity Guide - Loops Make - Unit 6 Lesson 8

The document outlines an activity guide for a coding lesson focused on using loops and event handlers in an app. It details the functionality of buttons that change the color, shape, and position of an icon, along with the necessary variables and lists for implementation. Additionally, it provides a rubric for evaluating the completeness and correctness of the code written by students.

Uploaded by

brockvincik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Copy of Activity Guide - Loops Make - Unit 6 Lesson 8

The document outlines an activity guide for a coding lesson focused on using loops and event handlers in an app. It details the functionality of buttons that change the color, shape, and position of an icon, along with the necessary variables and lists for implementation. Additionally, it provides a rubric for evaluating the completeness and correctness of the code written by students.

Uploaded by

brockvincik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 6 Lesson 8

Name(s) Brock Vincik Period 8th Date 11/22/24

Activity Guide - Loops Make


Step 1 - Try the app
Try using the different combinations of inputs.
● What does each button change and what does it not
change?
Button 1: Changes the color of the icon but does not change its
shape.
Button 2: Changes the shape of the icon but does not change
its color.
Button 3: Moves the icon around the screen but does not alter
its color or shape.

Discuss with a Partner


● Where (if at all) do you think this app is using a list?
The app may use a list to store the different shapes available for the icon.
● Where (if at all) do you think this app is using a loop? A loop may be used to apply different colors or shapes to
the icon through repeated actions when a button is pressed.

Step 2 - Plan
Fill in the information in the table below for each event handler you'll need to create

Element ID Description of What the Event Handler will Do

colorButton
Changes the icon's color to a random color using a loop to ensure varied outcomes.

shapeButton
Changes the icon's shape randomly without repeating the last shape used.

moveButton
Moves the icon to a random position on the screen using a loop for animated effect.

Fill in the table below for each variable you'll need to create.
Variable Name What the Variable Stores

colors

An array or list of color values used for changing color.

shapes
An array or list of shape types available for icons.

Computer Science Principles 1


Unit 6 Lesson 8

Computer Science Principles 2


Unit 6 Lesson 8
Step 3 - Write Your Code
● Write the code for the app, using your plan above and the comments provided in Code Studio to help
● Steps You Can Follow
○ Create all the variables from your table above.
○ Give your variables a starting value using the assignment operator (=).
○ Create blank event handlers (onEvent) for each screen element in your table above.
○ Write the code to make each of the three buttons work.
○ Hint: in order to create random colors use the rgba() block with randomNumber(). Read the
documentation for those blocks if you need more help.
○ Use your debugging skills to identify unexpected behavior and fix your program.
○ Comment your code as you go, explaining what each event handler does.
● Extension Ideas
○ Create a way to hide the three buttons when you have a lock screen that you like
○ Add sounds to each button.
○ Change the code for the "shapes" button to guarantee that you never randomly get the same shape
twice in a row.
Step 4 - Submit
Before you submit, check the rubric below to make sure your program meets the requirements of the task.
Category Extensive Evidence Convincing Limited Evidence No Evidence
Evidence

Input onEvents are created onEvents are created onEvents are created onEvents are not
for all the required for most of the inputs. for some of the inputs. created for any inputs.
inputs.

Variables and Variables and lists are Variables and lists Some information is There are no variables
Lists created and are created and stored in variables and or lists which store the
appropriately used for appropriately used for lists and appropriately necessary information
all pieces of most pieces of updated throughout for the app to work
information used in the information used in the app. correctly.
app. the app.

Loops The program correctly The program The program correctly The program does not
uses loops for all three correctly uses a loop uses lists for one of include or correctly
buttons to generate the for two of the buttons the buttons to use any loops.
expected output. to generate the generate the expected
expected output. output.

Output All three buttons work Only two of the Only one of the None of the buttons
as expected to move buttons work as buttons work as work as expected.
icons, change their expected. expected.
colors, and change
their icon to a random
new icon.

Code runs No errors are present Some errors are Many errors are The code does not
without errors. in the required code. present in the present in the required run.
required code. code.

Comments Comments are used to Comments are used Comments are Comments are not
correctly explain the to explain the present, but are not present.
purpose and purpose and used to explain the
functionality of both the functionality of either purpose or
function and event the function or event functionality of the
handlers. handlers. function or event
handlers.

Computer Science Principles 3

You might also like