Color Frequency Counter
Objectives
- Learn about arrays
Assignment
- Create a clean program that will count the number of occurrences of each color and display the result on the screen. The idea is that each "pixel" is a color. Your robot is to go in a line counting the number of pixels of each color and then output the counts of each. Your robot should stop when it touches a "wall".
- Each pixel will be about one inch square.
- Pixels of the same color may be next to each other.
Suggestions
-
- Start just by counting the number of times you encounter one specific color. This can be done without an array and will get you started.
- Then create seven variables (one for each color) and do it for all colors
- Then use an array with just one element. Use black (index of 1) and just count the number of times you encounter black.
- Then add blue to your colors and two elements in the array
- Finally make it so that your array has seven elements (one for each color)
- Stop when you touch something
- Additional requirements
- The final version must use an array to store the counts for each color
Submission instructions
- Due date is found on Canvas
- Each person should create a pdf document that contains the following information
- Your name
- Your partner's name
- A brief description of what you did
- A brief description of what your partner did
- How your team improved over any mistakes made last time
- Indicate which hints (if any) your team used
- How well you achieve each objective.
- Create one zip folder for the team
- place your code (making sure it has a comment that includes the lab assignment and the name of all team members)
- place each member's pdf in the folder
- Have one team member submit it in canvas.
Hints
- Essential when setting up an array
- Converting a color to an index
Challenges
- Have the robot speak the color and counts
- Have the robot speak or display the color with the largest number of occurrences. If there is a tie, just output the first one
This topic: CenterForComputing
> WebHome >
SyllabiFall2022 >
CSC102SylF2022 > CSC102F2022Lab7
Topic revision: r2 - 2022-08-23 - cathybareiss