The streets and avenues start from coordinates (?180, ?140) and are 40 pixels apart in both x and y. The empty grid is available in the file grid.gif. The project generate.sb starts with an empty grid. There is a square blue sprite Wall that is used to draw the axes and the wall segments. Four variables (from-x, from-y, to-x, to-y) store the coordinates of the two mouse clicks; then the wall segment is drawn by the pen. The script for placing beepers in the sprite Beeper is similar, except that the beeper image is stamped. In both cases, clicking the X terminates the scripts. The design of the Karel framework is complicated by the goal of hiding as much of the framework scripts as possible. The scripts for the movement of the Karel sprite itself have to remain within the script area of the sprite, since an instruction can only move the sprite whose script it is in. However, the Check script for setting the sensing and beeper variables has been moved to an additional sprite called Checker. This sprite also contains the script CheckMove that checks that a move is not blocked by a wall. The implementation of Checker is described below. Picking up and putting down a beeper are implemented in the Beeper sprite by changing costumes and stamping. There are two costumes: a green beeper costume and a white background for erasing the beeper. The latter also has black lines for restoring the grid. The framework for multiple beepers on an intersection uses 4 additional costumes for 2, 3, 4, 5 beepers on an intersection. The number partially overlays the green beeper image so that the existence of a beeper is still checked the same way; in addition, by checking for the other colors, the number of beepers can be determined. Checking for the presence of walls or a beeper is done by checking if a sprite touches a color or if two colors touch. Karel is touching a beeper if the sprite is touching green. In order to check for walls, the costume for the Karel sprite has three differently colored feelers, long pale lines stretching out forward, up and down. The script examines if any of these colors touches a blue wall and uses the results to set the sensing variables. The semantics of Scratch are that touching-conditions refer to the sprite in whose script they appear. Therefore, it is actually the Checker sprite which we see on the stage, while the Karel sprite is hidden during its initialization! The costumes of the two sprites are identical so it doesn’t matter which one we are looking at. Move instructions in the script for the Karel sprite move that sprite (although we don’t see it move); after each move instruction, the Check script in the Checker sprite is called. The first task of this script is to move the (visible) Checker sprite to the position of the (invisible) Karel sprite and to set its direction to be the same. This is easy to do since the Sensing palette contains a reporter for the x- and y-positions and the direction of an arbitrary sprite: Once that has been done, the touching-conditions are checked to set the sensing and beeper variables.