Skip to content
Game 5 Unit 7 of 8 1 hr learning time

Word List

Store ten words in DATA, read them with READ, and play through ten rounds with score tracking.

88% of Word Scramble

One word isn’t a game. Ten words, getting longer each round — that’s a game. DATA and READ let you store a word list inside the program and step through it automatically.

DATA and READ

  10 FOR i=1 TO 5
  20 READ w$
  30 PRINT "Word ";i;": ";w$
  40 NEXT i
  50 DATA "cat","sun","bird","fish","lemon"

DATA "cat","sun","bird","fish","lemon" stores five strings inside the program. READ w$ fetches the next one. The Spectrum keeps an invisible pointer that advances after each READ — the first call gets “cat”, the second gets “sun”, and so on.

DATA lines can go anywhere in the program. They aren’t executed as instructions — the Spectrum just scans them when it needs the next value. Putting them at the end (lines 900-910) keeps them out of the way.

Ten Rounds

   1 REM Word Scramble - Unit 7
   5 BORDER 0: PAPER 0: INK 7: CLS
  10 FOR i=0 TO 31
  12 PRINT AT 0,i; PAPER 2;" "
  14 NEXT i
  16 PRINT AT 0,1; PAPER 2; INK 7;"Round 1"
  18 PRINT AT 0,22; PAPER 2; INK 6;"Score: 0"
  20 LET sc=0
  30 FOR n=1 TO 10
  32 READ w$
  34 REM === Scramble ===
  36 LET t$=w$
  38 LET s$=""
  40 IF LEN t$=0 THEN GO TO 48
  42 LET p=INT (RND*LEN t$)+1
  44 LET s$=s$+t$(p TO p)
  46 LET t$=t$(1 TO p-1)+t$(p+1 TO LEN t$)
  47 GO TO 40
  48 IF s$=w$ THEN GO TO 36
  50 REM === Display round ===
  52 CLS
  54 FOR i=0 TO 31
  56 PRINT AT 0,i; PAPER 2;" "
  58 NEXT i
  60 PRINT AT 0,1; PAPER 2; INK 7;"Round ";n
  62 PRINT AT 0,22; PAPER 2; INK 6;"Score: ";sc
  64 PRINT AT 4,10; INK 5;"Unscramble:"
  66 LET c=(32-LEN s$*2)/2
  68 FOR i=1 TO LEN s$
  70 PRINT AT 8,c+i*2-2; PAPER 1;" "
  72 PRINT AT 9,c+i*2-2; PAPER 1;" "
  74 NEXT i
  76 FOR i=1 TO LEN s$
  78 PRINT AT 8,c+i*2-2; PAPER 1; INK 6; BRIGHT 1;s$(i TO i)
  80 BEEP 0.05,5+i*2
  82 NEXT i
  84 INPUT "Your guess? ";g$
  86 IF g$=w$ THEN GO TO 120
  88 REM === Wrong ===
  90 BORDER 2
  92 LET m$="Wrong!"
  94 PRINT AT 12,(32-LEN m$)/2; INK 2; BRIGHT 1;m$
  96 BEEP 0.3,-5
  98 BORDER 0
 100 PAUSE 15
 102 FOR i=1 TO LEN w$
 104 PRINT AT 8,c+i*2-2; PAPER 1; INK 2; BRIGHT 1;w$(i TO i)
 106 BEEP 0.08,i*2
 108 NEXT i
 110 PAUSE 60
 112 GO TO 150
 120 REM === Correct ===
 122 LET sc=sc+1
 124 BORDER 4
 126 LET m$="Correct!"
 128 PRINT AT 12,(32-LEN m$)/2; INK 4; BRIGHT 1;m$
 130 FOR i=1 TO LEN w$
 132 PRINT AT 8,c+i*2-2; PAPER 4; INK 7; BRIGHT 1;w$(i TO i)
 134 BEEP 0.06,10+i*2
 136 NEXT i
 138 BEEP 0.1,24
 140 PAUSE 40
 142 BORDER 0
 150 NEXT n
 160 CLS
 170 PRINT AT 4,8; INK 5;"Score: ";sc;" out of 10"
 900 DATA "cat","sun","bird","fish","lemon"
 910 DATA "planet","castle","trumpet","dinosaur","adventure"

Round 7 — scrambled castle on blue tiles, score 4

The FOR n = 1 TO 10 loop runs every piece you’ve built — scramble, tiles, reveal, guess, feedback — ten times. Each round:

  1. READ the next word from DATA
  2. Scramble it (with the safety check)
  3. CLS and redraw the header bar with the round number and score
  4. Draw tiles and animate the scrambled letters
  5. INPUT the guess and give colour-coded feedback
  6. NEXT advances to the next round

The header bar updates every round — “Round 1” becomes “Round 2”, and the score climbs (or doesn’t). The player always knows where they are.

Words Get Longer

The DATA is ordered by length: 3-letter words first, 9-letter words last.

900 DATA "cat","sun","bird","fish","lemon"
910 DATA "planet","castle","trumpet","dinosaur","adventure"

Short words have fewer possible arrangements — “cat” can only be scrambled into 5 different patterns. “adventure” has over 300,000. The difficulty curve is built into the data, not the code.

Changing the Content

This is the moment the visual progression doc promised: the learner discovers they can change the game’s content by editing DATA lines without touching the code. Replace “cat” with “dog” and round 1 has a different word. Add animals, countries, colours — the game becomes yours by changing two lines.

Try This

Themed lists. Replace all ten words with a theme: animals, colours, food, countries. The game plays identically but feels completely different.

Fifteen rounds. Add five more words on line 920 and change the loop to FOR n = 1 TO 15. No other code changes needed.

What You’ve Learnt

  • DATA — stores values in the program: DATA "cat","sun","bird"
  • READ — fetches the next value: READ w$
  • Automatic pointer — each READ advances to the next item
  • Difficulty curve from data — short words first, long words last
  • Content is separate from code — change the DATA, change the game