Jump to content
IGNORED

Short BASIC programs for kids


matthew180

Recommended Posts

This might be slightly off topic of just pertaining to the 99/4A, but I know all of you have other systems, and everyone here is awesome, so... :)

 

Last year I helped run a local retro-computer group exhibit at the Orland Maker Faire.  We had a lot of home computers and many kids had a huge interest in the machines, and they wanted to do more than just play cartridge games.  I wrote a few simple programs that people could type in (just like I did standing in the computer stores as a kid in the 80's), and many kids really took to it.  They would sit there, in some cases for hours, messing around with variations of the programs, seeing what it would do, being a little naughty (words like "poop" came up a few times).  I was really awesome to witness!

 

So, next weekend is the Maker Faire again, and I find myself as the main P.O.C. for the retro-computer exhibit.  I would like to have some simple type-in programs again, and for more than just the 99/4A.  One of the main problems with the programs I wrote were the subtle differences in the BASIC keywords between the systems.  It was actually really hard to write programs that would work across many of the systems, so I made variations specific to some of the systems we had.

 

Anyway, if anyone would be willing to take up the challenge and post some short programs I can use this year, I would be really grateful.

 

Guidelines:

* Try to avoid programs that needed a "break" (i.e. avoid infinite loops with goto), since that key combination is not always obvious.  Not a hard, fast rule, but helpful.

 

* Keep them short.  I found that even 3 lines could take someone 5 or more minutes to type, especially since making a mistake means retyping the line.  Editing programs is so different on all the systems.

 

* Have them be interactive or personalized, i.e. print "Hello <type your name>" was a big hit.  And kids learned that they could type more than just their name. ;)

 

Some possible systems we will have this year:

99/4A, CoCo3, TRS-80 P4, Atari 800XL, Atari 1020, MSX1, PC-portable, Osborne, Apple2e, Amiga, NeXT.

 

These are the programs I wrote last year.  I tried to make they increase in complexity, and no one finished the guessing game.

 

The first program had two parts, 1st part:

30 FOR I=1 TO 10
40 PRINT "I AM COOL!"
50 NEXT I

 

2nd part, they would add this:

10 PRINT "TYPE YOUR NAME";
20 INPUT ": ":N$
40 PRINT N$;" IS AWESOME!"

 

This was the second most complex program, which caused problems across systems due to things like INPUT, SIN, TAB, etc.

10 PRINT "TYPE YOUR NAME";
20 INPUT ": ":N$
30 FOR I=0 TO 6.28 STEP .2
40 X=7+(SIN(I)*6)
50 PRINT TAB(X);"HI ";N$
60 NEXT I

 

This is the guessing game, no one finished this, and is probably too long anyway... maybe.

10 RANDOMIZE
20 N=INT(RND*100)+1
30 T=0
40 PRINT "I AM THINKING OF A NUMBER"
50 PRINT "FROM 1 TO 100."
60 PRINT "TRY TO GUESS!"
70 PRINT "YOUR GUESS";
80 INPUT G
90 T=T+1
100 IF G=N THEN 160
110 IF G<N THEN 140
120 PRINT "TOO HIGH"
130 GOTO 70
140 PRINT "TOO LOW"
150 GOTO 70
160 PRINT "YOU GUESSED IT!"
170 PRINT "YOUR SCORE: ";
180 PRINT T
190 PRINT
200 PRINT "PLAY AGAIN, TYPE: RUN"

 

  • Like 3
Link to comment
Share on other sites

Here's a game for TI-BASIC.  Use ESDX to steer.  I suppose it's too long though:

10 RANDOMIZE
20 CALL CLEAR
30 CALL HCHAR(1,1,35,32)
40 CALL HCHAR(24,1,35,32)
50 CALL VCHAR(1,1,35,24)
60 CALL VCHAR(1,32,35,24)
70 N=-1
80 X=5
90 Y=12
100 U=1
110 V=0
120 CALL HCHAR(1.5+RND*22,1.5+RND*30,64,1)
130 N=N+1
140 CALL KEY(0,K,S)
150 IF (K<>69)*(K<>88)*(K<>83)*(K<>68) THEN 180
160 U=(K=83)-(K=68)
170 V=(K=69)-(K=88)
180 X=X+U
190 Y=Y+V
200 CALL GCHAR(Y,X,C)
210 CALL HCHAR(Y,X,48)
220 IF C=32 THEN 140
230 IF C=64 THEN 120
240 PRINT " YOU GOT";N

RUN

 

Edited by PeteE
  • Like 4
Link to comment
Share on other sites

Try this one

 

Quote

10 CALL CLEAR
20 PRINT "PRESS KEYS TO MAKE SOUND"::::::::
30 PRINT "PRESS ENTER TO EXIT"::
40 CALL KEY(3,KEY,STATUS)
50 IF STATUS=0 THEN 40
60 LET SOUND=(KEY-31)*10+100
70 CALL SOUND(-1000,SOUND,5)
80 GOTO 40

 

Edited by TI_Ken
  • Like 1
Link to comment
Share on other sites

Quote

10 CALL CLEAR

20 A=5+INT(RND*15)

30 CALL HCHAR(A,30,64)

40 FOR B=2 TO 23

50 CALL HCHAR(B-1,1,32)

60 CALL HCHAR(B,1,62)

70 CALL KEY(0,K,C)

80 IF C>0 THEN 140

90 NEXT B

100 D=D+1

110 IF D<10 THEN 10

120 PRINT "FINAL SCORE: ";E

130 END

140 CALL HCHAR(B,2,45,28)

150 IF A=B THEN 160 ELSE 100

160 E=E+1

170 GOTO 100

Here's a simple game.

Let me know if it doesn't work, as I reformatted it in this post and might have possibly made a mistake renumbering and changing values.

Press any key to shoot at the @ for points.

Edited by Hakogame 箱亀
  • Like 3
Link to comment
Share on other sites

Here is a succinct TI BASIC animated demo that I've put together. 

 

I felt like doing a 10 liner. Though it ended up as a 9 liner, as it turns out.

 

User input defines color and seeds a pattern for an animation.  Generated animation patterns are reasonably varied if not numerous.  And any out of range values for the inputs are just treated as "0" in both cases.

 

10 CALL CLEAR
20 INPUT "PICK A COLOR (0-7)":C
30 INPUT "PICK A PATTERN (0-7)":S
40 CALL CLEAR
50 CALL COLOR(1,2+C*(C<8)*(C>=0)*2,13)
60 P=P*-(P<9)+S*(S<8)*(S>=0)+1
70 SP$=SP$&STR$(P)
80 CALL CHAR(32,SP$)
90 IF LEN(SP$)<30 THEN 60

 

The conclusion of the animation is displayed on screen for a few seconds statically before exiting automatically. 

Edited by pixelpedant
  • Like 4
Link to comment
Share on other sites

10 RANDOMIZE 4
20 CALL SCREEN(5)
30 CALL COLOR(2,16,1)
40 CALL CHAR(40,"0080C0E0F0F8FCFE")
50 CALL CHAR(41,"FFFFFFFFFFFFFFFF")
60 CALL CHAR(42,"0103070F1F3F7FFF")
70 CALL CLEAR
80 FOR I=1 TO 32
90 UD=SGN(RND-.5)
100 H=H+(UD=1)
110 CALL VCHAR(H+12,I,41+UD)
120 CALL VCHAR(H+13,I,41,12-H)
130 H=H-(UD=-1)
140 NEXT I
150 H=0
160 GOTO 20

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

New, shorter variation on my contribution. 

 

This one, rather than asking for user input for colour and pattern, just randomly selects a (background-contrasting) colour, and randomly seeds the generated animation pattern.  Patterns are also a little more diverse. 

 

Bringing the sum total down to 7 somewhat shorter lines, instead of 9:

 

10 RANDOMIZE
20 CALL CLEAR
30 CALL COLOR(1,2+INT(RND*7)*2,13)
40 P=P*-(P<9)+RND*6+1
50 SP$=SP$&STR$(INT(P))
60 CALL CHAR(32,SP$)
70 IF LEN(SP$)<30 THEN 40

 

Edited by pixelpedant
  • Like 2
Link to comment
Share on other sites

While driving in my car, out of nowhere, it suddenly hit me: "The flag" can of course be done so much simpler. Draw the cross instead of the squares. 😁

10 CALL SCREEN(2)
20 CALL CLEAR
30 CALL HCHAR(11,1,40,128)
40 CALL VCHAR(1,11,40,96)
50 CALL COLOR(1,7,7)
60 CALL COLOR(2,16,16)
70 GOTO 70

 

Edited by sometimes99er
  • Like 1
Link to comment
Share on other sites

Fractals.

100 CALL CLEAR
101 CALL SCREEN(2)
102 FOR I=1 TO 10
103 READ CO
110 CALL COLOR(I,CO,2)
111 CALL CHAR(25+I*8,"78FCFCFCFC78")
112 NEXT I
120 DATA 14,6,5,13,4,12,7,10,15,16
130 A=20
131 FOR B=0 TO 31
132 FOR C=0 TO 23
133 D=B/15-1.5
134 E=C/11-1
135 F=D
136 G=E
137 H=0
140 I=F*F
141 J=G*G
142 IF (I+J>4)+(H>=A) THEN 150
143 G=2*F*G+E
144 F=I-J+D
145 H=H+1
146 GOTO 140
150 IF H>=10 THEN 160
151 CALL HCHAR(C+1,B+1,25+H*8)
160 NEXT C
161 NEXT B
170 GOTO 170

 

  • Like 3
Link to comment
Share on other sites

Day of week.

100 CALL CLEAR
110 N$(0)="SUN"
120 N$(1)="MON"
130 N$(2)="TUES"
140 N$(3)="WEDNES"
150 N$(4)="THURS"
160 N$(5)="FRI"
170 N$(6)="SATUR"
180 INPUT "DATE (D,M,Y): ":D,M,Y
190 Y=Y+INT((M-2)/12)
200 M=M-12*INT((M-2)/12)
210 N=D+(2*M)+INT((6*(M+1))/10)+Y+INT(Y/4)-INT(Y/100)+INT(Y/400)+1
220 N=N-INT(N/7)*7
230 PRINT "THE DATE IS A ";N$(N);"DAY"
240 GOTO 180

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...