# Create your own typing tutor!

Here’s an idea to teach somebody the positions of the letters on the keyboard: letters fly in randomly from the right for 30 seconds. Hit the letter on the keyboard for points. Miss and lose points. As time goes on, the letters move faster and there are more of them. More points are earned for faster typists. Points are deducted for misses. Can anyone beat my high score of 3760?

#define MAXLETS 10

PUBLIC ox

ox=CREATEOBJECT("Letters")

ox.show()

DEFINE CLASS Letters as Form

left=200

width=600

height=300

backcolor=-1

nScore=0

nTicks=0

nHighScore=0

nInterval=100     && # of msecs per tick

DIMENSION aLets[MAXLETS]

allowoutput=.f.

nMaxSecs=30

ADD OBJECT MyTimer as timer

PROCEDURE init

FOR i = 1 TO MAXLETS

ENDFOR

DECLARE integer Beep IN WIN32API integer Freq, integer DurationMs

this.mytimer.interval=thisform.nInterval

IF FILE("letters.txt")

this.nHighScore=INT(VAL(FILETOSTR("letters.txt")))

ENDIF

PROCEDURE keypress(nKeyCode, nShiftAltCtrl)

IF nKeyCode=27    && Escape

thisform.Release

ELSE

oGotone = .null.

FOR i = 1 TO MAXLETS

WITH thisform.aLets[i] as Label

IF .Visible AND .Caption = UPPER(CHR(nKeyCode))

IF ISNULL(oGotone) OR  .Left < oGotone.left && get leftmost

oGotone = thisform.aLets[i]

ENDIF

ENDIF

ENDWITH

ENDFOR

IF ISNULL(oGotone)

ELSE

oGotone.visible = .f.

thisform.nScore=thisform.nScore+  INT(oGotone.left/10)      && higher score for rightmost

ENDIF

ENDIF

beep(2000,20)

PROCEDURE MyTimer.timer

thisform.nTicks=thisform.nTicks+1

nSecs=thisform.nTicks*this.interval/1000

IF nSecs > thisform.nMaxSecs  && out of time?

FOR i = 1 TO MAXLETS

thisform.aLets[i].Visible=.f. && hide all letters

ENDFOR

IF thisform.nHighScore < thisform.nScore

MESSAGEBOX("New High Score: "+TRANSFORM(thisform.nScore)+"! Old = "+TRANSFORM(thisform.nHighScore),48)

thisform.nHighScore=thisform.nScore

STRTOFILE(TRANSFORM(thisform.nScore),"letters.txt")   && record high score

ELSE

MESSAGEBOX("Your Score: "+TRANSFORM(thisform.nScore)+" High Score = "+TRANSFORM(thisform.nHighScore))

ENDIF

thisform.nScore=0 && Restart

thisform.nTicks=0

ELSE

thisform.Caption = TRANSFORM(thisform.nScore) + " "+TRANSFORM(INT((thisform.nMaxSecs- nSecs)))

FOR i = 1 TO MAXLETS

WITH thisform.aLets[i] as Label

IF .Visible

.Left = .Left - .dx

IF .Left <= 0

.Visible=.f.

ENDIF

ELSE

nFactor = nSecs /thisform.nMaxSecs  && 0-1

IF RAND() <   .5*nFactor      && gradually increase # of letters

.dx = 1+RAND() * 15 * nFactor  && gradually accelerate

.Left=thisform.Width - .dx

.ForeColor=0xffffff-MOD(thisform.nTicks*100,256^3)

.Top = .9 * (RAND() * thisform.Height)

.Caption = CHR(65+RAND()*26)

.Visible= 1

ENDIF

ENDIF

ENDWITH

ENDFOR

ENDIF

ENDDEFINE

DEFINE CLASS MyLabel as Label

Fontsize=20

FontBold=1

FontName="Verdana"

BackStyle=0 && transparent

dx=1

Height = 32

Width = 26

ENDDEFINE

1. Craig Boyd says:

That’s fun Calvin. I’ll send you a bill for the work I’ve missed playing your game. LOL

2. Jim Philippi says:

This is cool! My kids (9 and 12) will love it! Thanks.

3. Cathy Pountney says:

Ha … I beat your high score my second try. I got 3764.

4. Warning: this simple program produces mesmerizing spirographic images that seem hallucinatory in nature!…

5. When I took my 3 year old son for the first day of preschool, there was a table with several nametags…

6. Randy Jean says:

1st try: 5634

Wow, didn’t think I could type that well.  You wouldn’t know it if you watched me program

7. Sometimes friends or relatives might hear that you’re an expert with using computers, and might ask you

8. Lani says:

This program is a very Fast, Easy, Fun typing program ONLINE for free! You will be able to see your typoing skills IMPROVE within just a coupole of weeks! Remember the key to success is: NEVER GIVE UP! Have fun!

9. shauna says:

how do you want to play a typing game

10. Jerry says:

i want to help people learn by doing something fun by a very fun game

11. Jerry says:

i want to help people learn by doing something fun by a very fun game

12. I was using a program that was yet another TLA and I wanted to create a mnemonic to help me remember

13. In this post, Create your own typing tutor! is code to create a game for learning the letters of the

14. fergal says:

great piece of code thanks man.

15. Rafael says:

with software I need to buy or I need to download in order to make the typing tutor.

the program I want to make is for first grade.

Schoold proyect.

Thank you Rafael

16. Rafael says:

with software I need to buy or I need to download in order to make the typing tutor.

the program I want to make is for first grade.

Schoold proyect.

Thank you Rafael

17. Several years ago, my wife and I were walking through a local shopping mall. At the time, there was some

18. KKV says:

Yeah, I finally beat yo’ high score. I got a 3794. Pwnage!! LOL! THANKS!

19. Aaron Bell says:

I want to start my own Typing Program online and how can I do that?