105
Page 0 Hong Kong Diploma of Secondary Education Examination 2012 Information and Communication Technology C.C.C. Chuen Yuen College School-based Assessment English Vocabulary Game Spelling Snake Name: Class: 6C (16)

English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 0

Hong Kong Diploma of Secondary Education Examination 2012

Information and Communication Technology

C.C.C. Chuen Yuen College

School-based Assessment

English Vocabulary Game

Spelling Snake

Name:

Class: 6C (16)

Page 2: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 1

Mr. Hung

He is my leading teacher and had taught me many

programming knowledge and skills. He made me to have

this game idea and to teach me to find solution for the

problems. I had gotten lots of supports from him.

Classmates from ICT class

They had helped me to solve problems and gave me

some useful idea and commons to improve the game.

When we were doing the project, we were giving

supports to each others. They made me had the for

finishing the project.

Page 3: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 2

Subject: Vocabulary Game

It is a project for design and creating an English Vocabulary Game to

improve children English vocabulary by playing computer games.

Design ideas:

A popular classical game ‘Snake’ is the proto type of this vocabulary

game. Base on it, the new game ‘Spelling Snake’ has been developed to

be multi-object tracing. A set of objects marked with letters from a word

are placed in the same time. Player needs to eat all the letters in the true

order for score.

Purpose:

By eating the letters in the true order, player is spelling the words. It can

let player to learn more vocabularies. And also, it makes player to

remember the words by spelling in an interesting way.

Features:

It is an action vocabulary game, different from most of traditional words

games which are static for typing words or choosing multiple answers. It

is more fun and exciting to attract children. And it can even perform

much better to let children learn English vocabulary. It is an innovative

vocabulary game.

The more about the game design, game testing and user guide will be

shown in the report.

Page 4: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 3

Introduction……………………………………………………………………………………….4

Objective...……..………………………………………………………………………………….5

Game design ……………………………………………………………………………………..6

System and Language……………………………………………………………………… …8

Flowchart……………………………………………………………………………………………9

Pseudocode………………………………………………………………………………………14

Program Listing…………………………………………………………………………………16

Algorithm Design………………………………………………………………………………38

Data Structure…………………………………………………………………………………..51

Variable List………………………………………………………………………………………58

Procedure List……………………………………………………………………………………62

Function List……………………………………………………………………………………..65

File List……………………………………………………………………………………………..66

User Guide………………………………………………………………………………………..69

Testing And Evaluation………………………………………………………………………80

Conclusion………………………………………………………………………………………..94

References………………………………………………………………………………………..95

3

Page 5: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 4

Now a day computer is a common and important tool

in our daily life. It brings us a lot of conveniences and

benefits such as searching information, complex

calculations, storage media, communication and

entertainments.

Therefore, we are developing many digital media for

learn English as well as playing vocabulary games instead

of books.

There can contain many different media that absent in

printed materials into games such as sound and

animation. Furthermore, there are more interactions

during playing games. Learning English by playing

vocabulary game may have better efficiency than

traditional learn materials and it is more attractive and

funny.

Page 6: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 5

Purpose

This is an English Vocabulary Game for children to play and aims to

improve their English vocabulary by playing the game

In addition the game should be interesting and fun to attract children

to play the game and interest in learning English.

The scheme of program

For improving Children’s English vocabulary, the game is to helping

them to learn more English vocabularies and to remember them.

Since the target users are children, the game will be developed to teach

some useful English vocabularies form the daily life and the words using

in the game will not be too difficult. Also, the game will make children to

spelling more of the words so as to help children to remember the

vocabularies.

For attract children to play the game, it is designed to be interesting and

fun. Also, it will be great if the game could lead children to interest in

English and learn English spontaneously and willingly

Target user

Target users are children which are studying in primary school.

Page 7: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 6

Game name:

( The snake will move along in the area. )

The Snake variety of games originated with the arcade game Blockade developed by

UPL and published by Sega-Gremlin in 1976. (From Wikipedia)

Game rule: press up, down, left or right in the keyboard

to control the Snake to eat the required letters to spell

the word.

Page 8: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 7

Page 9: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 8

Functions:

1) To teach English vocabulary

2) To help spelling vocabularies

3) Test their vocabulary level

4) To have fun in English

Page 10: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 9

Game language : English

Programming language : Turbo Pascal 7.0

Introduction of Turbo Pascal 7.0 :

It is Third generation language (3GL) which is a high

level language. High level language is closer to human

languages and more English-like.

Pascal is a procedural programming language. It has to

specify every detail of the logical steps or commands

during the program coding process. It solves a problem

step by step. It is easy for developing a program.

Page 11: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 10

Main program

Start

End

Game menu

Cover page

Exit?

Yes

No

Page 12: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 11

Cover page

Start

End

Draw cover pager

List choices

Press a key

Choice choosing

High light the

pointed choice &

record it to prepare

for entry the choice

Pressed

enter?

No

Yes

Page 13: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 12

Game menu

Start

End

Display interface

List menu

Press a key

Choice choosing

Pressed

enter?

No Yes

Setting speed

Play game

Page 14: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 13

Setting speed

Start

End

Display interface

List choice

Press a key

Choice choosing

Pressed

enter?

No

Yes

Set up the chosen speed

Page 15: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 14

Play game

Start

End

Game setting

Get words from file,

initialize variables

Display the game

Delay 0.01s Pressed a

key?

Time for

moving?

Control moving

direction

Meet on the wall

o eat itself?

Touching detect

Data update

Display the game

result

Eaten all the

words?

win lose

No

Yes

Yes No

No

No

Yes

Yes

Read key

Page 16: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 15

1 begin

2 Display cover page

3 List choices: ‘Start’ and ‘Exit’

4 input a choice

5 If chose ‘Start’

6 Then enter the game menu: go to step 7

7 Else end of program: go to step 45

8 Display game menu

9 Display menu of several kinds of vocabulary

10 Input a choice

11 Assign the file name base on the choice

12 Display the speed menu

13 List choice of speed: ‘slow’, ‘normal’ and ‘ fast’

14 Input a choice

15 Set up the speed base of the choice

16 Open word file to read the words and record into variables

17 Initialize all other variables

18 Display game integer face

19 Display the snake body

20 Produce the foods

21 Display the foods

22 Get the instant time

23 Set up the time for next movement

24 Start game

25 While not (win or lose) do

26 begin

27 While not pressed a key do

28 begin

29 Delay 0.01 second

30 Get the instant time for now

Page 17: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 16

Page 18: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 17

31 If now = next movement time

32 Then begin

33 change the moving direction

34 If the wall is in front of the head

35 Then lose. Go to step 44

36 change the snake head’s location

37 If ate snake body

38 Then lose. Go to step 44

39 If ate a food

40 Then begin

41 Increase a unit to the long of snake

42 add the character of food in the body

43 End;

44 Display the game

45 Produce the next moving time

46 End;

47 Input a key

48 End;

49 End of program

15

Page 19: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 18

{Title: Vocabulary Game }

{Name: Leung Siu Fung }

{Class: 6C }

{Class no.: 16 }

program SpellingSnake;

uses graph, crt, dos;

const

rt = 10;

rl = 10;

row = 12;

col = 12;

sqs = 30;

area = row * col;

cellx = row div 2 + row mod 2;

celly = col div 2 + col mod 2;

CellArea = cellx * celly;

namelist = 'namelist.txt';

var

GDriver, GMode : integer; {init graph}

hh, mm, ss, ms : word; {time}

ntmm, ntss, ntms, dt : integer; {next moving time}

c, i, j, k, k1, cn : integer; {counter}

ix, iy, jx, jy : integer; {locater}

long, bh, bt : integer; {long, head & tail of snake body}

wi, wt, vi, vlong :integer; {counter of words & characters}

score, dis, life : integer; {information: score, distance, life}

x, y : array[1..area] of integer; {location of snake boby}

cx, cy : array[1..cellx, 1..celly, 1..4] of integer; {list of useable space}

Page 20: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 19

clx, cly : array[1..CellArea] of integer; {list of useable cell}

chx, chy : array[1..CellArea] of integer; {location of food}

indexs : array[1..row,1..col] of integer; {index of space(1-4)}

indexc : array[1..cellx, 1..celly] of integer; {index of cell(1-carea)}

indexfd : array[1..row,1..col] of integer; {index of fd}

vb, eword : string;

csn : array[1..cellx, 1..celly] of integer;

{number of useable space in cell}

ch : array[1..CellArea] of char; {character of food}

v : array[1..area] of char; {character in body}

empty, fd : array[1..row,1..col] of boolean;

{record empty space & food}

fdc : array[1..cellx,1..celly] of boolean;

{record there is food in cell or not}

key, dire : char;

win, lose, eaten, exit, next : boolean;

eatch : array[1..20] of boolean; {record the charecter eaten or not}

filename : string;

openfile : text;

words : array[1..30] of string; {words form file}

{assign ix & iy}

procedure subixy(subx, suby : integer);

begin

ix := subx;

iy := suby;

end;

{assign jx & jy}

procedure subjxy(subx, suby : integer);

begin

jx := subx;

jy := suby;

end;

Page 21: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 20

{swatch two integer}

procedure swatch(var int1, int2 : integer);

var temp : integer;

begin

temp := int1;

int1 := int2;

int2 := temp;

end;

{get words form file}

procedure readwords;

begin

wt := 0;

wi := 0;

assign(openfile, filename);

reset(openfile);

while not eof (openfile) do

begin

wt := wt + 1;

readln(openfile, words[wt]);

end;

close(openfile);

end;

{swatch two space}

procedure SwSpace(swx, swy, sw : integer);

begin

swatch(cx[ix, iy, indexs[swx,swy]], cx[ix, iy, sw]);

swatch(cy[ix, iy, indexs[swx,swy]], cy[ix, iy, sw]);

subjxy(cx[ix, iy, indexs[swx,swy]], cy[ix, iy, indexs[swx,swy]]);

swatch(indexs[swx, swy], indexs[jx,jy]);

end;

{swatch two cell}

procedure SwCell(sw : integer);

Page 22: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 21

begin

swatch(clx[indexc[ix,iy]], clx[sw]);

swatch(cly[indexc[ix,iy]], cly[sw]);

subjxy(clx[indexc[ix,iy]], cly[indexc[ix,iy]]);

swatch(indexc[ix,iy], indexc[jx,jy]);

end;

{get time of now}

procedure time;

begin

gettime(hh, mm, ss, ms);

end;

{set the time to now}

procedure inittime;

begin

time;

ntms := ms;

ntss := ss;

end;

{check the time for next movement}

function meettime : boolean;

begin

meettime := false;

time;

if ((ss=ntss)and(ms>=ntms))

or ((ss=0)and(ntss=59)and(ms<ntms))

or ((ss>ntss) and (ms<ntms))then

meettime := true;

end;

{make the time of next movement}

procedure nexttime( nt : integer);

begin

ntms := ntms + nt;

Page 23: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 22

if ntms >= 100 then

begin

ntms := ntms mod 100;

ntss := (ntss+1) mod 60;

end;

end;

{clean located screen}

procedure clr(left, top, right, bottom, color : integer);

begin

setfillstyle(1, color);

bar(left,top,right,bottom);

end;

{clean screen of window and information}

procedure clrG;

begin

setfillstyle(1,black);

bar(rl+1,rt+1,row*sqs+rl,col*sqs+rt);

bar(410,10,550,100);

bar(11, 381, 629, 469);

end;

{draw window}

procedure window;

begin

setcolor(15);

rectangle(rl,rt,row*sqs+rl+1,col*sqs+rt+1);

setcolor(11);

rectangle(10, 380, 630, 470);

end;

{draw rectangle}

procedure rect(left, top, right, bottom, color : integer);

begin

setcolor(color);

Page 24: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 23

rectangle(left, top, right, bottom);

end;

{draw square}

procedure square(sx, sy : integer);

begin

rectangle((sx-1)*sqs+11, (sy-1)*sqs+11, sx*sqs+10, sy*sqs+10);

end;

{write sting}

procedure WriteSt(str : string; wx, wy, s1, s2, s3, cr : integer);

begin

setcolor(cr);

settextstyle(s1,s2,s3);

moveto(wx, wy);

outtext(str);

end;

{display charater in food}

procedure cha(chax, chay : integer; cch : char);

begin

settextstyle(0,0,2);

moveto((chax - 1) * sqs + 18, (chay - 1) * sqs + 18);

outtext(cch);

settextstyle(0,0,1);

end;

procedure light(str : string; lx, ty, rx, by, s1, s2, s3, cr1, cr2, cr3 : integer);

var cr, il : integer;

begin

inittime;

nexttime(10);

il := 2;

clr(lx, ty, rx, by, cr3);

WriteSt(str, lx, ty, s1, s2, s3, cr1);

while not keypressed do

Page 25: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 24

begin

delay(50);

if meettime then

begin

il := il mod 2 + 1;

clr(lx, ty, rx, by, cr3);

case il of

1 : cr := cr1;

2 : cr := cr2;

end;

WriteSt(str, lx, ty, s1, s2, s3, cr);

nexttime(50);

end;

end;

end;

{stop 3 second with write out 1, 2, 3}

procedure stop;

begin

if next then

begin

clr(450, 100, 550, 180, 0);

WriteSt('3',500, 200, 10, 0, 5, 14);

delay(1000);

clr(500, 200, 550, 300, 0);

WriteSt('2',500, 200, 10, 0, 5, 14);

delay(1000);

clr(500, 200, 550, 300, 0);

WriteSt('1',500, 200, 10, 0, 5, 14);

delay(1000);

clr(500, 200, 550, 300, 0);

inittime;

nexttime(dt);

next := false;

end;

Page 26: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 25

end;

{move to upper or lower choice of menu}

procedure choose(min, max : integer);

begin

case key of

#72 : c := c - 1;

#80 : c := c + 1;

end;

if c < min then

c := min;

if c > max then

c := max;

end;

procedure initspace;

begin

score := 0;

dis := 0;

life := 3;

cn := CellArea;

long := 0;

bt := 1;

dire := #75;

key := dire;

for j := 1 to row do

for i := 1 to col do

begin

empty[i,j] := true;

end;

empty[row-1,col] := false;

empty[row,col] := false;

end;

procedure initfd;

begin

Page 27: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 26

for i := 1 to CellArea do

eatch[i] := false;

for i := 1 to row do

for j := 1 to col do

fd[i,j] := false;

for j := 1 to celly do

for i := 1 to cellx do

fdc[i,j] := false;

end;

procedure initeat;

begin

eword := '';

wi := wi + 1;

vb := words[wi];

vi := 0;

vlong := length(vb);

for i := 1 to CellArea do

eatch[i] := false;

for i := 1 to vlong do

ch[i] := vb[i];

end;

procedure initcell;

begin

k1 := 0;

for j := 1 to celly do

for i := 1 to cellx do

begin

k1 := k1 + 1;

clx[k1] := i;

cly[k1] := j;

indexc[i,j] := k1;

csn[i,j] := 4;

for k := 1 to 4 do

Page 28: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 27

begin

case k of

1..2 : begin ix := (i-1)*2+k; iy := j*2-1;end;

3..4 : begin ix := (i-2)*2+k; iy := j*2;end;

end;

cx[i, j, k] := ix;

cy[i, j, k] := iy;

indexs[ix,iy] := k;

end;

end;

end;

{emptify the exit space, close the entered space}

procedure EmpSpace;

begin

empty[x[bh],y[bh]] := false;

if not eaten then

empty[x[bt],y[bt]] := true;

bt := bt mod area + 1;

end;

{check player win the game or not}

procedure check;

begin

if wi = wt then

win := true;

end;

{change the cell be not usabe}

procedure InCell;

begin

ix := x[bh] div 2 + x[bh] mod 2;

iy := y[bh] div 2 + y[bh] mod 2;

k := csn[ix,iy];

csn[ix,iy] := k - 1;

Page 29: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 28

if not fdc[ix,iy] then

begin

SwSpace(x[bh],y[bh], k);

if k = 1 then

begin

SwCell(cn);

cn := cn - 1;

end

end

else

if not eaten then

SwSpace(x[bh],y[bh], k);

if eaten then

if k <> 0 then

begin

cn := cn + 1;

SwCell(cn);

csn[ix,iy] := k;

fdc[ix,iy] := false;

end;

end;

{change the cell be usabe}

procedure ExCell;

begin

ix := x[bt] div 2 + x[bt] mod 2;

iy := y[bt] div 2 + y[bt] mod 2;

k := csn[ix,iy];

if not eaten then

begin

csn[ix,iy] := k + 1;

SwSpace(x[bt],y[bt], k+1);

if (not fdc[ix,iy]) and (k = 0) then

begin

cn := cn + 1;

Page 30: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 29

SwCell(cn);

end;

end;

end;

{display the snake body}

procedure drbody;

begin

clrG;

setcolor(9);

i := 0;

if bh >= bt then

for j := bh downto bt do

begin

i := i + 1;

square(x[j], y[j]);

cha(x[j], y[j], v[i]);

end

else

begin

for j := bh downto 1 do

begin

i := i + 1;

square(x[j], y[j]);

cha(x[j], y[j], v[i]);

end;

for j := area downto bt do

begin

i := i + 1;

square(x[j], y[j]);

cha(x[j], y[j], v[i]);

end;

end;

setcolor(14);

square(x[bh], y[bh]);

Page 31: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 30

cha(x[bh], y[bh], v[1]);

end;

{control direction of snake}

procedure control;

begin

case key of

#75 : if not(dire = #77) then dire := key;

#77 : if not(dire = #75) then dire := key;

#72 : if not(dire = #80) then dire := key;

#80 : if not(dire = #72) then dire := key;

end;

case dire of

#75 : if x[bh] = 1 then lose := true;

#77 : if x[bh] = row then lose := true;

#72 : if y[bh] = 1 then lose := true;

#80 : if y[bh] = col then lose := true;

end;

if not lose then

begin

case dire of

#75 : x[bh mod area + 1] := x[bh] - 1;

#77 : x[bh mod area + 1] := x[bh] + 1;

#72 : y[bh mod area + 1] := y[bh] - 1;

#80 : y[bh mod area + 1] := y[bh] + 1;

end;

case dire of

#75,#77 : y[bh mod area + 1] := y[bh];

#72,#80 : x[bh mod area + 1] := x[bh];

end;

bh := bh mod area + 1;

end;

end;

{creat location of food}

Page 32: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 31

procedure pdfood;

begin

initeat;

for i := 1 to vlong do

begin

k := random(cn)+1;

subixy(clx[k],cly[k]);

j := csn[ix, iy];

k1 := random(j)+1;

chx[i] := cx[ix, iy, k1];

chy[i] := cy[ix, iy, k1];

csn[ix, iy] := j - 1;

SwSpace(chx[i], chy[i], j);

SwCell(cn);

cn := cn - 1;

indexfd[chx[i],chy[i]] := i;

fd[chx[i],chy[i]] := true;

fdc[ix,iy] := true;

end;

end;

{display food}

procedure drfood;

begin

setcolor(12);

for i := 1 to vlong do

if not eatch[i] then

begin

cha(chx[i], chy[i], ch[i]);

square(chx[i], chy[i]);

end;

end;

{get the eaten character to the body}

procedure eat;

Page 33: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 32

begin

long := long + 1;

v[long+2] := ch[indexfd[x[bh],y[bh]]];

eword := eword + v[long+2];

bt := bt - 1;

if bt = 0 then

bt := area;

eaten := true;

fd[x[bh],y[bh]] := false;

ix := x[bh] div 2 + x[bh] mod 2;

iy := y[bh] div 2 + y[bh] mod 2;

vi := vi + 1;

if (vi = vlong) then

if eword = words[wi] then

score := score + vlong

else

life := life - 1;

if (vi = vlong) and (life <> 0) and (wi <> wt) then

begin

pdfood;

next := true;

end;

end;

{touching detest}

procedure detest;

begin

eaten := false;

i := 0;

if not empty[x[bh],y[bh]] then

lose := true;

if fd[x[bh],y[bh]] then

begin

eatch[indexfd[x[bh],y[bh]]] := true;

Page 34: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 33

eat;

end;

if life = 0 then

lose := true

else if (wi = wt) and (vi=vlong) then

begin

win := true;

clr(11, 381, 629, 469,0);

WriteSt('You Win', 30, 410, 6, 0, 3, 4);

end;

end;

{list out information}

procedure inform;

begin

moveto(410,20);

Outtext('Score :');

moveto(470,20);

Outtext(chr(score div 100 + 48));

moveto(480,20);

Outtext(chr((score mod 100) div 10 + 48));

moveto(490,20);

Outtext(chr((score mod 10 + 48)));

moveto(410,30);

Outtext('Disten :');

moveto(480,30);

Outtext(chr(dis div 1000 + 48));

moveto(490,30);

Outtext(chr(dis div 100 + 48));

moveto(500,30);

Outtext(chr((dis mod 100) div 10 + 48));

moveto(510,30);

Outtext(chr((dis mod 10 + 48)));

moveto(410,40);

Page 35: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 34

Outtext('Life');

moveto(480,40);

Outtext(chr(life + 48));

if not(lose or win) then

WriteSt('To spell : '+words[wi], 30, 410, 6, 0, 3, 14);

if lose then

begin

clr(11, 381, 629, 469,0);

WriteSt('Game Over', 30, 410, 6, 0, 3, 4);

end;

if win then

begin

clr(11, 381, 629, 469,0);

WriteSt('You Win!', 30, 410, 6, 0, 3, 4);

end;

if lose or win then

WriteSt('- Enter -', 530, 430, 6, 0, 3, 4);

end;

procedure initbody;

begin

v[1] := '@';

v[2] := ' ';

x[1] := row;

y[1] := col;

x[2] := row-1;

y[2] := col;

bh := 1;

Incell;

bh := 2;

Incell;

bt := 1;

end;

Page 36: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 35

procedure initial;

begin

setcolor(12);

settextstyle(0,0,1);

lose := false;

exit := false;

next := true;

initspace;

initcell;

initbody;

initfd;

pdfood;

window;

drbody;

drfood;

inform;

stop;

inittime;

nexttime(dt);

end;

{game engine}

procedure play;

begin

initial;

repeat

while not(keypressed or lose or win)do

begin

stop;

delay(10);

time;

if meettime then

begin

dis := dis + 1;

control;

Page 37: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 36

detest;

if not lose then

begin

Incell;

Excell;

EmpSpace;

end;

window;

drbody;

drfood;

inform;

nexttime(dt);

end;

end;

key := readkey;

until win or lose;

repeat

key := readkey;

until key = #13;

end;

{choosing speed}

procedure SetSpeed;

begin

clr(200,150,300,300,0);

rect(200,150,300,300,5);

c := 1;

WriteSt('Speed', 210, 160, 0, 0, 2, 9);

repeat

WriteSt('Slow', 220, 190, 6, 0, 2, 3);

WriteSt('Normal', 220, 220, 6, 0, 2, 7);

WriteSt('Fast', 220, 250, 6, 0, 2, 4);

case c of

1 : light('Slow', 220, 190, 220, 190, 6, 0, 2, 14, 11, 0);

2 : light('Normal', 220, 220, 220, 220, 6, 0, 2, 14, 15, 0);

Page 38: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 37

3 : light('Fast', 220, 250, 220, 250, 6, 0, 2, 14, 12, 0);

end;

key := readkey;

choose(1,3);

until key = #13;

case c of

1 : dt := 40;

2 : dt := 30;

3 : dt := 20;

end;

end;

{to load the game}

procedure Game;

begin

readwords;

play;

end;

{mene of vocabulary type}

procedure menu;

begin

clr(1,1,630,480,0);

WriteSt('Type Select', 10, 3, 6, 0, 1, 15);

line(1, 35, 640, 35);

WriteSt('Choose a kind of words to play',30, 50, 6, 0, 3, 14);

c := 1;

repeat

WriteSt('Fruit', 100, 150, 6, 0, 3, 12);

WriteSt('Animal', 100, 200, 6, 0, 3, 12);

WriteSt('Sport', 100, 250, 6, 0, 3, 12);

WriteSt('Transport', 100, 300, 6, 0, 3, 12);

WriteSt('Exit', 100, 350, 10, 0, 1, 7);

case c of

1 : light('Fruit', 100, 150, 100, 150, 6, 0, 3, 14, 12, 0);

Page 39: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 38

2 : light('Animal', 100, 200, 100, 200, 6, 0, 3, 14, 12, 0);

3 : light('Sport', 100, 250, 200, 250, 6, 0, 3, 14, 12, 0);

4 : light('Transport', 100, 300, 100, 300, 6, 0, 3, 14, 12, 0);

5 : light('Exit', 100, 350, 100, 350, 10, 0, 1, 14, 7, 0);

end;

key := readkey;

choose(1,5);

until key = #13;

case c of

1 : filename := 'fruit.txt';

2 : filename := 'animal.txt';

3 : filename := 'sport.txt';

4 : filename := 'transp.txt';

end;

if c <> 5 then

SetSpeed;

clr(1,1,650,480,0);

if c <> 5 then

Game;

end;

procedure cover;

begin

clr(0,0,630,480,0);

c := 1;

WriteSt('Spelling', 30, 30, 7, 0, 7, 2);

WriteSt('Snake', 80, 80, 10, 0, 9, 8);

repeat

clr(225, 350, 450, 450, 0);

WriteSt('Start Game', 250, 350, 8, 0, 3, 4);

WriteSt('Exit', 295, 385, 8, 0, 3, 3);

case c of

1 : light('Start Game', 225, 345, 400, 380, 8, 0, 4, 12, 4, 0);

2 : light('Exit', 285, 380, 350, 415, 8, 0, 4, 11, 3, 0);

end;

Page 40: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 39

key := readkey;

choose(1,2);

until key = #13;

clr(1,1,630,480,0);

case c of

2 : exit := true;

end;

end;

{main program}

begin

randomize;

GDriver := Detect;

InitGraph(GDriver,GMode,'tp7');

exit := false;

repeat

cover;

if not exit then

menu;

until exit;

end.

{ -End of program- }

Page 41: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 40

User interface design

The interface is used graph mode to draw.

Advantages:

It is more attractive and confinable.

Disadvantages:

Graph mode is hard to implement and consumes more

computer recourses.

Page 42: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 41

Page 43: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 42

Game interfaces introduction

1) Cover page

Show the game name and choices of ‘start’ and ‘exit’.

2) Game menu

(1) (2)

(3) (4)

Page 44: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 43

List the vocabulary type for choosing to play.

3) Speed setting

List three speeds for player to choose.

4) Game environment

Area for playing the game.

Game environment

1) Moving Area

It is the area for snake to move and place foods. The snake cannot go

out this area, else game over.

2) Head

3) Snake body 2) Head

5) Information

6) Time watch

7) Game statement

1) Moving area

4) Food

Page 45: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 44

It is the part for changing direction and eating the food.

3) Snake Body

It holds the eaten characters and will increase a unit while eats a

food.

4) Food

It is an eating target which is a square contents a character from a

word.

5) Information

The game score, moved distance and life are displayed there.

6) Time watch

It counts the number from 3 to 1 for preparing to the next new

words.

7) Game statement

It shows the word to spell by eating the feed in the certain sequence.

Page 46: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 45

Operating system 1) Choices selection

The choices are choosing by using keyboard to press ‘up’

and ‘down’ for moving to the nest choice. Then press enter to

entry the choice. (No respond for other keys)

Every choice has two different colors. When the choice is

pointing by the user, it will change to other color to show to

user.

Page 47: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 46

2) Game operation

The snake will move along continuously.

Press up, down, left or right in the keyboard to control

the moving direction of Snake. (Press the backwards

direction will not be respond.)

Page 48: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 47

Procedure for control the snake

procedure control;

begin

case key of

#75 : if not(dire = #77) then dire := key;

#77 : if not(dire = #75) then dire := key;

#72 : if not(dire = #80) then dire := key;

#80 : if not(dire = #72) then dire := key;

end;

case dire of

#75 : if x[bh] = 1 then lose := true;

#77 : if x[bh] = row then lose := true;

#72 : if y[bh] = 1 then lose := true;

#80 : if y[bh] = col then lose := true;

end;

if not lose then

begin

case dire of

#75 : x[bh mod area + 1] := x[bh] - 1;

#77 : x[bh mod area + 1] := x[bh] + 1;

#72 : y[bh mod area + 1] := y[bh] - 1;

#80 : y[bh mod area + 1] := y[bh] + 1;

end;

case dire of

#75,#77 : y[bh mod area + 1] := y[bh];

#72,#80 : x[bh mod area + 1] := x[bh];

end;

bh := bh mod area + 1;

end;

end;

Get the direction if

the key is not the

backwards.

Game over if the

wall is in front of

the head.

Add the location in

front of the head

into snake body.

Page 49: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 48

Choices control and display

Procedure for lighting the pointed choice

As long as no key pressed, the word is shining continuously.

procedure light(str : string; lx, ty, rx, by, s1, s2, s3, cr1, cr2, cr3 :

integer);

var cr, il : integer;

begin

inittime;

nexttime(10);

il := 2;

clr(lx, ty, rx, by, cr3);

WriteSt(str, lx, ty, s1, s2, s3, cr1);

while not keypressed do

begin

delay(50);

if meettime then

begin

il := il mod 2 + 1;

clr(lx, ty, rx, by, cr3);

case il of

1 : cr := cr1;

2 : cr := cr2;

end;

WriteSt(str, lx, ty, s1, s2, s3, cr);

nexttime(50);

end;

end;

end;

1) Output

2) Location of

cleaning area

3) Style of words

4) Color

5) Clean screen

6) Write string

(7)

(8)

(9)

Page 50: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 49

Page 51: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 50

1) Output(str)

Storage the string or word for display

2) Location of cleaning area(lx, ty, rx, by)

Storage the location of a rectangle’s left, top, right and bottom for

cleaning the word

3) Style of word(s1, s2, s3)

Font style, direction (0/1), size

4) Color(c1, c2, c3)

First word color, second word color, clean screen color

5) Clean screen(clr)

Procedure for clean the located area of screen

6) Write string(WriteSt)

Procedure for display the string

procedure clr(left, top, right, bottom, color : integer);

begin

setfillstyle(1, color);

bar(left,top,right,bottom);

end;

procedure WriteSt(str : string; wx, wy, s1, s2, s3, cr : integer);

begin

setcolor(cr);

settextstyle(s1,s2,s3);

moveto(wx, wy);

outtext(str);

end;

Page 52: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 51

7) Inittime

Procedure for get the time in this moment

8) Nexttime

Procedure for produce the next moving time

9) Meettime

Function for check whether it is the time for moving

procedure inittime;

begin

time;

ntms := ms;

ntss := ss;

end;

procedure nexttime( nt : integer);

begin

ntms := ntms + nt;

if ntms >= 100 then

begin

ntms := ntms mod 100;

ntss := (ntss+1) mod 60;

end;

end;

function meettime : boolean;

begin

meettime := false;

time;

if ((ss=ntss)and(ms>=ntms))

or ((ss=0)and(ntss=59)and(ms<ntms))

or ((ss>ntss) and (ms<ntms))then

meettime := true;

end;

end;

Delay time

Check whether the

time now is equal or

greater then the nest

moving time

Page 53: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 52

Game engine

procedure play;

begin

initial;

repeat

while not(keypressed or lose or win)do

begin

stop;

delay(10);

time;

if meettime then

begin

dis := dis + 1;

control;

detest;

if not lose then

begin

Incell;

Excell;

EmpSpace;

end;

window;

drbody;

drfood;

inform;

nexttime(dt);

end;

end;

key := readkey;

until win or lose;

repeat

key := readkey;

until key = #13;

end;

Initial all variables

Get the time of

this moment

Control direction

Detest whether the snake

head reach anytime

Update variables for

checking and produce food

Display the game

Produce next

moving time

Get user Input

Page 54: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 53

Food production

It needs to display all character from a word as foods.

If the foods are put too cross, the snake cannot eat the

target food.

To solve this problem, we need to ensure the foods do

not too cross so as to enable the snake to eat any food

first.

Target

Page 55: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 54

Solution food ensure the food not too cross

Cut every four space to be a cell. Each cell can only hold

a food so as to give the snake move to eat any cell

directly

space

cell

Head

Area for

moing

movement

food

Page 56: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 55

Area table for the location

1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

11

12

Cell No.

Space location: (1, 12)

X

Y

Page 57: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 56

Arrays for storage location of snake body

Type: parallel circular arrays

Location of (x, y) of body on the area

x, y : array[1..area] of integer

1

2

3

X Y

area Area -1

Area -2

1

2

3

area Area -1

Area -2

X

Y

1 2 3 4 5 6 7 8 9 10

Head Tail

Body

Page 58: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 57

Pointer of head and tail

They used to point the variable of head and tail of snake body.

When moving towards, add the new location in front of the head.

If does not eat a food, move the pointer of head and tail a unit to the

right. (The locations in the body do not change. Just move head and tail)

If ate a food, the length of snake body increase a unit. Then just move

the head and the tail remains the same.

Equation for pointer to move

bh, bt : integer {body head, body tail}

bh bt

New

bh := bh mod area + 1;

bt := bt mod area + 1;

Page 59: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 58

Arrays for produce foods location

1 2 3 4 5 6

1

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

2

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

3

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

4

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

5

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

6

1 2 1 2 1 2 1 2 1 2 1 2

3 4 3 4 3 4 3 4 3 4 3 4

clx, cly : array[1..CellArea] of integer; {list of useable cell}

cx, cy : array[1..cellx, 1..celly, 1..4] of integer; {location of cell space}

X

Y

cell location: (1, 6) Space no. in a cell

Page 60: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 59

List of useable cells’ location

Type: parallel arrays

X location of the cells

1 1 1 1 1 1 2 2 2 …

Y location of the cells

1 2 3 4 5 6 1 2 3 …

Pointer for useable cells

clx, cly : array[1..CellArea] of integer;

cn : integer

cn

Useable cell

Page 61: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 60

Production of foods location

As each cell can only content one food so it will randomly choose a

useable cell first.

A B C D E F G H I J

A B C D E F G H I J

If of the cell D is chose to get location, it will swatch with the end of the

useable cells and the pointer will move a unit to the left.

A B C H E F G D I J

After swatch the random area is decreased. The used cell is moved to

used cell area.

A B C H E F G J I D

If the food in cell J is eaten, it will swatch with cell just after the pointer.

Then the pointer will move a unit to the right. The cell J will become

useable for randomly choosing.

Random area

random(cn)+1

Page 62: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 61

Index for searching the target variable

Some of the data cannot directly find out independently, so

they need indexes to hold the location for each data. It can save

time for searching the target linearly.

Array

1 2 3 4 5 6 7 8 9 10

I C G H A D F B J E

Index

A B C D E F G H I J

5 8 2 6 10 7 3 4 1 9

(When the data changed to other place, the index needs

to update the location at the same time)

indexs : array[1..row,1..col] of integer; {index for cx, cy}

indexc : array[1..cellx, 1..celly] of integer; {index for clx, cly}

indexfd : array[1..row,1..col] of integer; {index food ch}

Searching data

Location of data in the array

Page 63: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 62

Constants:

Constant Value Description

sqs 30 Length of a side of square

Row, col 12 No. of rows & columns

Rt, rl 10

area row * col

Total no. of square

cellx row div 2 +

row mod 2 No. of rows of cell

celly col div 2 + col

mod 2 No. of columns of cell

cellArea cellx * celly

Total no. of cell

cell

space

Page 64: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 63

System variables:

Variables Type Description

GDriver,

GMode integer For initial graph file

hh, mm, ss, ms word Time(hr, min, s, ms)

ntmm, ntss,

ntms integer Next moving time

dt integer Delay time for every movement

i, j, k, k1 integer General counter

ix, iy, jx, jy integer General locater (x,y)

c integer Choice storage

key char Record input key

dire char Direction of snake

score, dis, life integer Information of game: score,

distance, life

win, lose boolean To identify win or lose for the

game

exit boolean To identify player wants to leave

the game

eaten boolean To identify has eaten a new food

next boolean To identify isn’t the time for

next movement

Page 65: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 64

Game variables:

Variables Type Description

x, y array of integer

[1..area] Locations of snake(squares)

bh, bt integer Pointer of head & tail for x,y

long integer Length of snake

clx, cly array of integer

[1..CellArea] List of useable cells

cx, cy array of integer

[1..cellx, 1..celly, 1..4] List of useable cells’ spaces

chx, chy array of integer

[1..CellArea] Location of food

csn array of integer

[1..cellx, 1..celly] No. of useable space in cell

indexs array of integer

[1..row,1..col] Index of space for cx, cy

indexc array of integer

[1..cellx, 1..celly] Index of cell for clx, cly

indexfd array of integer

[1..row,1..col] Index of food for fd

empty array of Boolean

[1..row,1..col] Record the spaces are empty or

not

fdc array of Boolean

[1..cellx,1..celly]

Record the cells content food

or not

eatch array of Boolean

[1..20]

To record the characters be

eaten or not

Page 66: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 65

Words access variables:

Variables Type Description

filename string Storage name of file for open

openfile text Open file

words array of string

[1..30] Words read from file

ch array of char

[1..CellArea] Character of foods

v Array of char

[1..area] Hold characters in snake body

vb string Hold the word is using

eword string Hold the eaten part of word

wt integer Total no. of words

wi integer No. of the word

vlong integer Word length

vi integer Character eaten in a word

Page 67: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 66

Procedure function

Cha Display character for each food in the square

Check Check player win the game or not

Choose Move the pointer to the upper or lower choice

Clr Clean the located area of screen

clrG Clean window and information

Control Control the moving direction of snake

Cover Display cover page and it’s choices

Detest Touching detest for food, snake body and

Drbody Display the snake body

Drfood Display the food

Eat Get the eaten character as part of the snake body

EmpSpace Emptify the exit space, blank the enter space

ExCell Change the cell or space to be useable

Page 68: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 67

Procedure function

Game To load the vocabulary game

InCell Change the cell or space to be not useable

Inform Display information during the game

Initbody Initialize the snake body

Initcell Initialize the cell

Initeat Initialize words and character for eating

Initfd Initialize food

Initial Call all procedures for initializing

Initspace Initialize space

Inittime Initialize time

Light To light up the choice which pointed

Menu List out the menu of vocabularies

Nexttime Set up the time for next movement

Pdfood Produce food locations

Page 69: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 68

Procedure function

Play Game engine for implement the game

Readwords Read the words from a file

rect Draw out a rectangle

SetSpeed Let player to choose and set the moving speed

square To draw out the square of food

stop Stop the game for 3 seconds

Subixy To assign variables ix & iy

subjxy To assign variables jx & jy

Swatch Swatch two integer

SwCell Swatch the locations and indexes of two cells

SwSpace Swatch the locations and indexes of two spaces

Time Get the instant time

window Draw out the window of the game

WriteSt Write out the strings

Page 70: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 69

Function description

Meettime Check is it the time for moving

66

Page 71: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 70

1) Spelling_Snake.PAS

Program file of the game

2) Spelling_Snake.EXE

Executing file of the game

3) GRAPH.TPU

File for support graph mode

4) TP7

Content Dos File for support the game

5) animal.TXT, fruit.TXT, sport.TXT, transp.TXT

Page 72: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 71

Text files content a set of vocabulary for game to read data

Page 73: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 72

Content of text files

animal.TXT

Fruit.TXT

Page 74: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 73

sport.TXT

transp. TXT (transport)

Page 75: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 74

Game information

Game name: Spelling Snake

Game type: vocabulary game, intelligent game, squares game

Introduction: It is a vocabulary game modified from the game

‘Snake’. Player will control the snake to eat the letter to spell

the given word to complete the words as many as you can!

Operating language: English

File size: 28.2MB (7.39MB for game body, 20.8MB for project

file)

Operation mode: Press left, right, up, down(← →↑↓) &

Enter for choosing choices and control the direction of snake to

eat the food to spell the words.

Page 76: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 75

System requirements:

1) Computer operating system :

Window 98/2000/Me/XP/7

2) Central Processing Unit (CPU) :

total clock rate 2.53GHz or above

3) RAM : 256MB or above

4) Revolution :

800*600 or above

5) Computer hardware :

Monitor, keyboard, mouse, CD-ROW drive or

DVD-Rom dive

6) Users skill :

Basic vision, basic English, basic computer operating

skills

Page 77: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 76

Game installation

1) Put the CD-ROW into the CD-ROW or DVD-ROM

drive.

2) Read the data in the CD-ROW. You will see a file

‘Vocabulary Game’. Then open this file.

Chick it

Page 78: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 77

3) Copy the file ‘Spelling Snake’ into your computer such

as C diver. (If you want to see the project report, copy

the file ‘Project file’ into your computer.)

Copy it

Page 79: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 78

Start Game

4) After copied the file of ‘Spelling Snake’ into your

computer, open the file in your computer.

5) For playing the game, open the application file

‘spelling_Snake.EXE’.

Chick it to start game

Page 80: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 79

Read project report

1) Open the copied file of ‘Project file’.

2) For reading the report, open the file ‘Project report’.

‘Version 1’ is the earlier version of the game.

‘Final version’ is the version that added a function ‘set

speed’ and fixed some bug.

Page 81: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 80

Page 82: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 81

Game operation

1) After open the game, you will see a cover

page:

2) Press up or down (↑↓) to move to another choice

and then press Enter to choose the choice by the

keyboard.

3) For playing the game, choose ‘Start’, else choose ‘Exit’

to leave.

(For marking the less negative effect for the game, do

not turn on the ’Caps Lock’.)

start game

leave

Page 83: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 82

After start the game, you will see a vocabulary menu

4) There are four types of vocabulary for choose to play

or choose ‘Exit’ to go back to cover page. (press Enter

to choose the choice)

Page 84: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 83

5) After chose a type of words, you will see three speed

choices

6) If you are firstly playing this game, suggest you to

choose Normal or Slow.

7) Then the game will be started.

Page 85: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 84

After start the game, you can see the game interface:

The letters from a word is placed randomly.

1) You have 3 seconds to see the word that you need to

spell for every new word. Then the snake will move.

2) Press ←↑→↓ in the keyboard to control the

direction of the snake to eat the letter in certain order.

Snake body

Score

Time for preparing

Moving area Food

Distance moved

Life

Head of snake Word for spelling

Page 86: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 85

3) Should not go out the wall or eat the snake body, else

you will game over!

4) When you have eaten all the letters of a word truly,

you can get score of the letter numbers of the

word.

5) Then the snake will stop 3 seconds for you to prepare

for other new word.

6) If you spelled the word wrongly, you will lose a life.

When your life becomes ZERO, you lose.

7) There are about 8 words in each type of vocabulary.

The words will be longer and longer. Spell them all to

win the game.

Page 87: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 86

Page 88: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 87

Program testing is arm to find out whether the

program contains bugs. It also checks whether the

program is meet the purpose of the project.

For test the game, I have design a data testing and a

path testing.

Data testing is to test whether the program work

correctly by input different data.

Path testing is to examine the logical structure of a

program in order to reveal all execution paths.

Page 89: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 88

Data testing

Test interface:

1) Cover page

2) Vocabulary type menu

3) Speed choosing

4) Snake control

Test area:

1) Typical data

2) Illegal data

(There is no continuous valid data input so extreme data

test is not suitable.)

Page 90: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 89

1) Cover page data testing

Expectations:

Situation Valid input Expected result

Pointing to choice of

‘Start’ Down (↓)

Pointing to ‘Exit’

Enter Go to Vocabulary type

menu

Pointing to choice of

‘Exit’ Up (↑)

Pointing to ‘Start’

Enter End the program

choices

Page 91: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 90

Test results:

Situation Input Expected result Expected?

Pointing to

choice of

‘Start’

Down(↓) Pointing to ‘Exit’ True

Enter Go to Vocabulary type

menu

True

0-9 No change True

a-z No change True

A-O,Q-Z No change True

P Pointing to ‘Exit’ False

Pointing to

choice of

‘Exit’

Up (↑) Pointing to ‘Start’ True

Enter End the program True

0-9 No change True

a-z No change True

A-G, I-Z No change True

H Pointing to ‘Start’ False

There are two conditions out of expectation. (P & H)

Page 92: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 91

Problem analysis:

The inputs of ‘P’ and ‘H’ will make the results same to

UP and DOWN. It is because the keys of ‘H’, ‘P’, ‘K’ & ‘M’

content the code same to UP, DOWN, LEFT & RIGHT

correspondingly in Pascal. They can act as another such

as press ‘H’ can act as UP and press UP can output ‘P’

also. (H=UP, P=down, K=left, R=right)

It is the setting of Pascal. It is very hard to solve.

However, it is not a big problem for this game. It will not

cause any error. Just do not turn on the ‘Caps Lock’ to

change to capital letter mode. Then it does not matter

for playing the game.

Page 93: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 92

2) Vocabulary type menu data test

Expectations:

Situation Valid input Expected result

Pointing to choice of

‘Fruit’ Down (↓)

Pointing to lower

choice

Enter Go to choose speed

Pointing to choice

of ’Animal’, ‘Sport’ &

‘Transport

Up (↑) Pointing to upper

choice

Down (↓) Pointing to lower

choice

Enter Go to choose speed

Pointing to choice of

‘Exit’ Up (↑)

Pointing to upper

choice

Enter Back to cover page

Page 94: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 93

Test results:

Situation Input Expected result Expected?

Pointing to

choice of

‘Start’

Down(↓),

P

Pointing to lower choice True

Enter Go to Vocabulary type

menu

True

0-9, a-z, A-O,

Q-Z

No change True

Pointing to

choice

of ’Animal’,

‘Sport’ &

‘Transport

Up (↑)

H

Pointing to upper choice True

Down(↓),

P

Pointing to lower choice True

Enter End the program True

0-9, a-z, A-O,

Q-Z

No change True

Pointing to

choice of

‘Exit’

Up (↑)

H

Pointing to upper choice True

Enter Back to cover page True

0-9, a-z, A-G,

I-Z

No change True

Page 95: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 94

3) Vocabulary type menu data test

Expectations:

Situation Valid input Expected result

Pointing to choice of

‘Slow’ Down (↓)

Pointing to choice of

‘Normal’

Enter Start the game with

slow moving speed

Pointing to choice of

‘Normal’ Up (↑)

Pointing to choice of

‘Slow’

Down (↓) Pointing to choice of

‘Fast’

Enter Start the game with

normal moving speed

Pointing to choice of

‘Fast’ Up (↑)

Pointing to choice of

‘Normal’

Enter Start the game with

fast moving speed

Page 96: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 95

Test results:

Situation Input Expected result Expected?

Pointing to

choice of

‘Slow’

Down(↓),

P

Pointing to choice of

‘Normal’

True

Enter Go to Vocabulary type

menu

True

0-9, a-z, A-O,

Q-Z

No change True

Pointing to

choice of

‘Normal’

Up (↑)

H

Pointing to choice of ‘Slow’ True

Down(↓),

P

Pointing to choice of ‘Fast’ True

Enter Start the game with normal

moving speed

True

0-9, a-z, A-O,

Q-Z

No change True

Pointing to

choice of

‘Fast’

Up (↑)

H

Pointing to choice of

‘Normal’

True

Enter Start the game with fast

moving speed

True

0-9, a-z, A-G,

I-Z

No change True

Page 97: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 96

5) Snake control data test

Expectations:←↑→↓

Situation Valid input Expected result

Moving upwards,

Moving downwards Left (←)

Turn to the left

Right (→) Turn to the right

Moving to the left,

Moving to the right Up (↑)

Turn to the upwards

Down (↓) Turn to the downwards

Page 98: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 97

Test results:

Situation Input Expected result Expected?

Moving

upwards

Left (←),

K

Turn to the left True

Right (→),

M

Turn to the right True

Up (↑), H

Down(↓), P

Keep moving upwards True

0-9, a-z, A-J,

L, N-Z

Keep moving upwards True

Moving

downwards

Left (←),

K

Turn to the left True

Right (→),

M

Turn to the right True

Up (↑), H

Down(↓), P

Keep moving downwards True

0-9, a-z, A-J,

L, N-Z

Keep moving downwards True

Moving to

the left

Up (↑)

H

Turn to the upwards True

Down(↓),

P

Turn to the downwards True

Left (←), K

Right (→), M

Keep moving to the left True

0-9, a-z, A-G,

I-O,Q-Z

Keep moving to the left True

Moving to

the right

Up (↑)

H

Turn to the upwards True

Down(↓),

P

Turn to the downwards True

Left (←), K

Right (→), M

Keep moving to the right True

Page 99: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 98

0-9, a-z, A-G,

I-O,Q-Z

Keep moving to the right True

Path testing

Cover page

Exit Exit Start

Fruit Animal Sport Transport

Slow Norma

l

Fast

Meet

the wall

Eat snake

baby

Eat a

food

Meet

nothing

Eat up

the food

Not eat up

the food

Not correct

spelling

Correct

spelling

Life - 1 + Score

Lose Life = 0 Life < 0

Finish all

words

Not

finish

Win

End of

program

Page 100: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 99

Evaluation

After the test, there is no visible bug for general

situations. Player press any key during the game will not

cause any data errors. But there may be still some logical

errors as have not tested all situations.

Weakness of the game

For ensure the game running smoothly, there is no

sound in the game. It makes the game less exciting. The

moving area for snake is a bit small and the foods are

quit many. It makes the snake hard to move. It decreases

the playability of the game. Also there is less different

elements for funny.

Limitations

1) Not enough skills to write such an action game

Page 101: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 100

2) Not enough time to develop the game to be more

interesting.

3) It is not powerful enough to using Turbo Pascal 7 to

develop an action game such as the output of

compass graphs and music are not support.

Improvements

1) Can be added some sound in the game to make it

more attractive.

2) Enlarge the area and decrease the size of each square

to make snake move more easily.

3) For making the score more meaningful, add tools for

player to bug and make the abilities of snake can be

upgrade by using score or money.

4) Make more different to make the game more

interesting.

5) Add the vocabulary meanings and sample graphs to

make player know the words meanings more easily.

Page 102: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 101

Page 103: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 102

The game ‘Spelling Snake’ is created successfully. It

can be play smoothly with no much serious bugs. It can

work as the game ‘Snake’ with more powerful settings.

Also it meets the target that improves the English

vocabulary of children by playing the game. Children n

learn more English vocabularies by spelling them in the

game. And the game is fun and exciting. It can trace

children’s respond speeds and intelligent for control the

snake and design the way to eat the foods.

However this game is the basic game body with out

other additional elements. There is many places need to

be improve and develop.

Page 104: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 103

96

Page 105: English Vocabulary Game Spelling Snake ICT... · 2019. 9. 16. · He is my leading teacher and had taught me many programming knowledge and skills. He made me to have this game idea

P a g e 104

Thank you for your time

Your reading is my hard

It is the end of the report

But is just the beginning of my programming