Handout for students- week 6

advertisement
Project GUTS
Coding Challenges
Week 6- CS Concept Challenges: Logic, Conditionals, Data Collection, Multiple push and toggle buttons, collisions, graphs, sliders, traits,
breeds, keyboard control, take camera, detection, looping & nested loops, stamp vs. pendown vs. stampgrid, Boolean logic
Names: ____________________________
____________________________
Description
39
Create a databox to keep track of time. Re-set clock at setup. Give turtles a wiggle movement, use the clock to stop the
movement after 500 ticks.
40
Add a push button for “hide databox” and another for “show databox”. Use the push buttons to hide the clock databox
and show it again as the program is running.
41
Create many agents of 1 breed, giving them 2 different colors. Use the collision block to make them change colors.
Make a graph that keeps track of the number of agents of each color. Make push buttons to hide and show the graph.
42
Have three push buttons, one to add one agent, another to add two agents and separate them, and another to add three
agents and separate them. Have the agents draw a shape.
43
Create a slider, call it ‘angle with 0-360 range’. Create a few turtles with pen down that wiggle. Use the slider to change
the agents’ Wiggle.
44
Create 2 breeds, 1 animal agent that moves around, the other a breed (‘food’) that does not move. As the animal agent
moves it loses energy, when it ‘eats’ the food it gains energy. If the animal agent’s energy gets too low, it dies. Add a
graph & data box to track the animal agent’s energy.
45
Use the above model to view the model from the perspective of the animal agent AND use keyboard controls to move it
around Spaceland to ‘eat.’
46
Create two breeds that wiggle around the world. Then, have 1 breed chase the other when they get within 20 steps.
47
Make the breed being chased in the above project run away when the chasing agent gets within 10 steps.
48
Use 1 agent to make a shape using a push button widget (not a toggle). Have the agent move to a slightly new position
and/or angle to repeat the pattern, like a spirograph. Include a “yield” block so the repeated drawing is visible.
Verified
Project GUTS
Coding Challenges
49
Make a model with a coloring agent that uses the blocks, Stamp, Pendown & Stampgrid to color the terrain. Change the
size of the coloring agent to see the effect on each of these procedures. Make a moving agent that reacts to terrain color,
and see whether its reaction depends on which type of block is used to color the terrain. In the description box of your
project, describe the difference between these three coloring blocks and how you were able to ‘prove’ it.
50
Create 10 agents of a single breed and give the agents a new trait called age. Scatter the agents randomly along the left
hand edge of spaceland, facing the right edge. Set the agents’ color to one specific color, set their size to a random 1-4,
and set their age to a random 10. Put the pen down. Copy this create block twice to create 10 agents with all the same
traits except that each group of 10 is a different specific color (to 30 total agents of 3 different colors). Create push
buttons (not toggle) to make the Boolean logic commands that make the agents move based on their traits. Make
separate buttons for each of the Boolean commands (one with a simple Boolean, one using an “and”, one using an “or”,
one using a “not” or “not equal”) and one that combines all these possible Boolean commands.
Project GUTS
Coding Challenges
Download