Debugems to Share

Scratch Debug'ems


Each Scratch Debug'em has one or more errors for you to fix. 
Download each one (attached to the bottom of the web page) and fix it.

Please do not post Debug'ems on the Scratch web site because solutions will get posted which will ruin the fun!
Learn more about Debug'em and other Deconstruction Kits here.
Scratch Debug'em 
(See attachments below
 this table)
Overview and Directions      Concepts      Discussion/Recap
 KeyControlBasics The I, J, K, and L keys should move to the cat up, left, down, and right.

BUG TO FIX: the K (down) key doesn't work.
General Computing 
the x/y coordinate system, loops, conditionals, comments

Scratch-Specific
FOREVER, IF, KEY_PRESSED, Scratch's X/Y coordinate system.
Simply moves a sprite with the I, J, K, and L keys.
 
 HelpMeFly_Debugem This is an animation of flying sprites. 

BUG TO FIX: One of the sprites doesn't fly.
General Computing 
loops

Scratch-Specific
broadcast, forever block, if on edge bounce block, blocks for moving
 
 GreatChase_Debugem Cat tries to catch Fox according to a few rules.

BUG TO FIX: 
Fix the Cat code so the rules are obeyed and the Cat can catch the fox. HINT: use some of the green and orange blocks provided.
General Computing:
Logic operators, variables, loops, conditional statements

Scratch-Specific
broadcast, forever block, backgrounds, variables.
 
 StarWarsCats_Debugem
A two-player sword fight game. Both cats behave the same way and try to kill each other by stabbing their opponent's stomach or tail tip.
 
OrangeCat (on the left) is controlled by  keys W, A, S, and D. RedCat (on the right) is controleed by keys I, J, K, and L.

BUGS TO BE FIXED:
~~~~~~~~~~~~~
RedCat's key controls for J and L don't work. The J key should advance it forward (as OrangeCat's D key does) and the L key should make it retreat (as OrangeCat's A key does). HINT: Use the blocks that are provided.
 General Computing
Two-player games, collision detection, sequencing code, symmetry, event-handling.

Scratch-Specific
Collision detection by sensing when colors are touching. The "STOP ALL" brick. Costume switching.
 
CoordinateGame_Debugem This game supplies the user with the X and Y coordinates of points and asks the user to click on a box to indicate if the point is in the upper-left, upper-right, lower-left, or lower-right quadrant of the 2D coordinate system. If the players guesses right 10 times, they win. One of the boxes has a bug (it says the user guessed wrong when the user was right). 



General Computing: 2D coordinate system.  
 VacationCat_Debugem This interactive story lets the user choose vacation destinations for the Scratch Cat. If the user clicks on a starfish, the cat goes to the ocean. If the user clicks on a rocket, the cat goes to the moon. If the user clicks on a lizard, the cat should go to the desert but there is a but and the cat goes to the moon. General Computing: sending and receiving messages (inter-process communication) 

Scratch-Specific
Broadcasts
 
HelloInManyLanguages and
HelloList_Debugem.

Open HelloInManyLanguages, run it, and study the code. Then open HelloList_Debugem which should display the same animation (but do so using a list instead a lot of SAY blocks). There's a bug - the cat says just the first word over and over instead of saying all the words over and over.

Fix the bug. Also, change the time that each word is displayed to 1 second or less. Note that unlike the original program, you only have to make this change in one place! Write your solution so that it would work no matter what the size of the list is. (Hint: use the LENGTH OF LIST block.)

General Computing
lists, local variables, conditionals (if, if-else)


Scratch-Specific
LENGTH OF LIST block

In this project you refactored HelloInManyLanguages. (To refactor a program means to change the way it is coded without changing its behavior or user interface.) Note that the original program has a long FOREVER loop with a lot of SAY blocks. The new version stores all the words in to a list (which makes them available for use elsewhere) and a very short loop.

A list is a data structure that is found in many programming languages. A list is a linear sequence of items which may have duplicates.

By taking out the the number 23 you avoided "hard codeding" a "magic number" and replaced it with code that was more general-purpose (using the mod operator). Software developers make a habit of making their code general purpose (within reason) to accommodate possible future changes.

TimerCat_Debugem

Displays a timer in the form "hours:minutes:seconds".

Fix the timer. It works well for the first minute. After that, the minutes and hours continue to work fine but the seconds go to 60 and beyond. HINT: You cam fix it simply by adding one block. NOTE that the code uses a triply-nested loop ( a loop within a loop within a loop).

General Computing
nested loops, operators that aren't the usual mathematical, logical, or relational ones

Scratch-Specific
JOIN operator for string concatenation

Regarding the triply-nested loop, note that the loop that executes the most number of times is the inner loop, then the middle loop, then the outer loop.

Regarding Scratch's JOIN operator: we are used to mathematical operators (e.g. +,, -, *, and /), logical operators (e.g. AND, OR, NOT), and relational operators (e.g. >, <, <=, >=). Programming laguages have the aforementioned operators as well as many more for performing actions on data. The JOIN operator is used to create a "string" (sequence of characters) by adding/"concatenating" together strings, numbers, variables, etc.


Dance_Debugem

Use mouse to choose dancer's poses.

Make a simple dance machine. When the mouse hovers over Pose 0, the dancer should switch to the costume "0th Pose;" when the mouse hovers over Pose 1, the dancer should switch to the costume "1st Pose" and so forth. When the mouse hovers over "Dance!" the dancer should cycle through the poses.

Regarding Mouse Hovering:
Take a look at the pointer sprite. You probably can't see it on the screen - it is a single pixel. The code that I have provided keeps the pointer sprite right at the tip of the mouse pointer. This makes it easy to tell when the mouse is hovering over another sprite. For example, if the mouse is hovering over Pose0, the Pointer sprite will be touching Pose0.

You should only need to add code to the Dancer and Pointer sprites.

Note: If you use broadcasts to communicate, try using BROADCAST AND WAIT for the Dance. You may have to play around with the timing a bit.

General Computing
conditional logic, designing code which involves communication among entities (e.g.sprites, objects) and deciding among several alternatives

Scratch-Specific
Sensing (TOUCHING); Using BROADCAST AND WAIT instead of BROADCAST can prevent some synchronization problems

Can you think of a way of having the sprites communicate that is different than your implementation?
Debugem Overview and Directions      Concepts      Discussion/Recap
       
Subpages (1): Pair Programming
ċ
CoordinateGame_Debugem.sb
(64k)
Jean Griffin,
May 18, 2012, 1:45 PM
ċ
Dance_Debugem.sb
(91k)
Jean Griffin,
Mar 11, 2011, 8:32 AM
ċ
Dance_DebugemSltn.sb
(90k)
Jean Griffin,
Mar 11, 2011, 8:32 AM
ċ
DuelingCats_Debugem.sb
(103k)
Jean Griffin,
Jun 21, 2011, 12:11 PM
ċ
GreatChase_Debugem.sb
(1732k)
Alexander Vuong,
May 24, 2012, 8:18 AM
ċ
HelloInManyLanguages.sb
(49k)
Jean Griffin,
Mar 11, 2011, 8:36 AM
ċ
HelloList_Debugem.sb
(57k)
Jean Griffin,
Mar 11, 2011, 8:36 AM
ċ
HelloList_DebugemSltn.sb
(55k)
Jean Griffin,
Mar 11, 2011, 8:37 AM
ċ
HelpMeFly_Debugem.sb
(103k)
Ankha Stanley,
May 24, 2012, 8:40 AM
ċ
KeyControlBasics_03-22-11_Debugem.sb
(55k)
Jean Griffin,
Mar 22, 2011, 1:39 PM
ċ
StarWarsCats_Debugem.sb
(104k)
Ankha Stanley,
May 24, 2012, 9:17 AM
ċ
TimerCat_Debugem.sb
(53k)
Jean Griffin,
Mar 11, 2011, 8:25 AM
ċ
TimerCat_DebugemSltn.sb
(52k)
Jean Griffin,
Mar 11, 2011, 8:26 AM
ċ
VacationCat_Debugem.sb
(1051k)
Ankha Stanley,
May 23, 2012, 1:25 PM
Comments