How Many Blocks

See all articles from SYNC v2 n5
Three alphabet blocks
Three alphabet blocks

The Problem

Like most new computer owners, I was testing my new equipment with some games. My fun was interrupted, though, when I realized that I was being watched. As I turned, I was confronted by my five year-old daughter, Scooter. Wearing a sad face and eyes that reminded me of a beagle puppy, she muttered, “How ’bout me?” Needless to say, I was at a loss for words because there do not seem to be many programs available for her age bracket. The obvious solution was to write a program just for her.

Program Requirements

The first step was to outline the requirements for the program:

1) The knowledge or skill involved should be within the child’s present ability to avoid excessive failure.

2) The program should be fun and game-like to hold the child’s attention.

3) The program should also be educational so that the child will learn from it.

4) The means of positive/negative feedback should be within the child’s present ability to comprehend.

5) The program will need minimal cues for an adult to give assistance to get the child started.

Methods of Meeting the Requirements

The next step was to decide how to fulfill these requirements. Printed words were out of the question since Scooter had not learned to read or write yet. She was vaguely familiar with single printed digits and was learning to count. Pictures using the computer’s graphics capabilities could also serve as a means of communication.

The Program Concept and Aim

The third step was to get the basic program concept and aim. I decided on a program to develop her abilities to count and associate the counting process with the single numerals. For positive feedback I chose the “happy face,” and for the negative feedback, the “sad face.” See Listing 1 for the 4K ROM program and Listing 2 for the 8K ROM.

Using the Program

Only 10 keys are involved in the child’s interaction with the computer (1 to 9 and NEWLINE). I had considered making a keyboard overlay with a piece of paper marked for the ten active keys, but that would have been an open invitation to lean on the unmarked surface with the possibility of miskeying the computer. Instead I just marked the case of the computer with a small arrow pointing to the NEWLINE key and emphasized that she must touch only one key at a time. After all, learning to use the keyboard is a part of the learning exercise, too.

After entering the program, hit RUN and NEWLINE. The words “HOW MANY BLOCKS?” will appear on the first line, and a row of from one to nine blocks will be displayed on the next line. The child should count the blocks and press the key for that number and NEWLINE. If the answer is correct, the “happy face” will appear on the screen. If the answer is wrong, a “sad face” will appear. To continue, hit NEWLINE. To stop, hit any key and NEWLINE.

I hope that the pre-schoolers will enjoy this program and learn something at the same time. It is not offered as a ready-made solution for every reader. Rather it is hoped that other Sinclair users will be inspired to develop programs for a hitherto neglected user group.

Program Notes

Lines 10-70 set up the faces.

Line 100 picks the random number for the block display. On the 4K the RANDOMIZE statement is not necessary for a program on this simple level.

Lines 110 and 510 are the guides for the adult. The child will disregard them in short order.

Lines 120-140 control the block display.

Line 200 inputs the child’s answer.

Line 210 clears the screen to prevent display overflow.

Line 220 makes sure that only a single digit is entered as the answer. A zero or multiple digits will cause the computer to re-display the previous number of blocks and request the answer again.

Line 230 decides whether the answer is right or wrong, that is, which face to display as feedback.

Line 300 displays a “sad face.” Note that on the 4K ROM version the three commas between each string make the computer skip three fields between the displaying of each graphic line so that they will line up correctly in the corner of the screen. On the 8K ROM only 2 commas are needed. This method was chosen instead of multiple print statements.

Line 310 bypasses displaying an unwanted “happy face” after the “sad face.”

Line 400 displays a “happy face.” All the comments on Line 300 apply here.

Line 500 spaces one line downward.

Line 600 inputs the command to continue or to stop. NEWLINE alone will cause the computer to continue.

Line 610 clears the screen for the next group of blocks and prevents display overflow.

Lines 620-640 have several functions. First, they decide whether to continue or to stop. If instructed to continue, they then decide whether the child’s previous answer is right or wrong. If the answer is right, a new set of blocks will be displayed. If the answer is wrong, the previous set will be displayed again. This will continue until the correct answer is given.

Listing 1. How Many Blocks (4K ROM). In the strings, [gX] is the graphic on key X (underlined in the original); # is a space.

 10 LET A$="[gA][gA][gA][gA][gA][gA][gA][gA][gA]"
20 LET B$="[gA]#######[gA]"
30 LET C$="[gA]#[gW][gW]#[gW][gW]#[gA]"
40 LET D$="[gA]##[gR][gW][gE]##[gA]"
50 LET E$="[gA]#[gW]###[gW]#[gA]"
60 LET F$="[gA]##[gW]#[gW]##[gA]"
70 LET G$="[gA]###[gW]###[gA]"
100 LET A=RND(9)
110 PRINT "HOW MANY BLOCKS?"
120 FOR I=1 TO A
130 PRINT "[gQ]#";
140 NEXT I
150 PRINT
200 INPUT B
210 CLS
220 IF B<1 OR B>9 THEN GOTO 11
0
230 IF B=A THEN GOTO 400
300 PRINT A$,,,B$,,,C$,,,B$,,,D
$,,,B$,,,G$,,,F$,,,E$,,,B$,,,A$
310 GOTO 500
400 PRINT A$,,,B$,,,C$,,,B$,,,D
$,,,B$,,,E$,,,F$,,,G$,,,B$,,,A$
500 PRINT
510 PRINT "HIT N/L TO CONTINUE"
600 INPUT H$
610 CLS
620 IF H$="" AND NOT B=A THEN G
OTO 110
630 IF H$="" THEN GOTO 100
640 STOP

Listing 2. How Many Blocks (8K ROM; over 1K RAM).

 10 LET A$="[gA][gA][gA][gA][gA][gA][gA][gA][gA]"
20 LET B$="[gA]#######[gA]"
30 LET C$="[gA]#[gD][gD]#[gD][gD]#[gA]"
40 LET D$="[gA]##[g2][g6][g1]##[gA]"
50 LET E$="[gA]#[gD]###[gD]#[gA]"
60 LET F$="[gA]##[gD]#[gD]##[gA]"
70 LET G$="[gA]###[gD]###[gA]"
100 LET A=INT (RND*9)+1
110 PRINT "HOW MANY BLOCKS?"
115 PRINT
120 FOR I=1 TO A
130 PRINT "[g5]#";
140 NEXT I
200 INPUT B
210 CLS
220 IF B<1 OR B>9 THEN GOTO 1
10
230 IF B=A THEN GOTO 400
300 PRINT A$,,B$,,C$,,B$,,D$,,B
$,,G$,,F$,,E$,,B$,,A$
310 GOTO 500
400 PRINT A$,,B$,,C$,,B$,,D$,,B
$,,E$,,F$,,G$,,B$,,A$
500 PRINT
510 PRINT "HIT N/L TO CONTINUE"
600 INPUT H$
610 CLS
620 IF H$="" AND B<>A THEN GOTO
110
630 IF H$="" THEN GOTO 100
640 STOP

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.