News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Best 5-line Basic program to show a non-technical person how programming works?

Started by cwpab, 09:49, 27 March 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cwpab

As the title says. You guys have a lot of knowledge, I only know some basic Basic commands. Yeah, "basic" appears 2 consecutive times in that sentence with different meanings.

It would be great if the program shows the "INK" command to switch between different font and background colors, so that the non-technical persons can be more interested and have a more visual memory of how programming lines work.

I tried myself, but I was only able to produce an epiplepsy inducing program. I would probably need some way to make the text stay there a few tenths of seconds instead of just a millionth of second so that the quick color changes are not harmful, or something.

But it has to be simple, no complex instructions. Any ideas?

McArti0

Like this?

10 speed ink 1,1
20 border 4,9:print "<== Border Dark grey ****"
30 ink 0,13: print "*** Ground grey ****"
40 ink 1,22,17:pen 1:print "**** Bright grey ****"
50 ink 2,26:pen 2:print "**** White *****"
60 ink 3,0:pen 3:print "**** Black *****"
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

The Electric Monk

Quote from: cwpab on 09:49, 27 March 24As the title says. You guys have a lot of knowledge, I only know some basic Basic commands. Yeah, "basic" appears 2 consecutive times in that sentence with different meanings.

It would be great if the program shows the "INK" command to switch between different font and background colors, so that the non-technical persons can be more interested and have a more visual memory of how programming lines work.

I tried myself, but I was only able to produce an epiplepsy inducing program. I would probably need some way to make the text stay there a few tenths of seconds instead of just a millionth of second so that the quick color changes are not harmful, or something.

But it has to be simple, no complex instructions. Any ideas?

Your instructions are a bit unclear - not sure what you want to show people. But in general, if your text needs to stay on screen longer, add a for/next loop, like
FOR i=1 to 5000:NEXT before continuing. The example will wait until 5 seconds have passed.
If your problem is that the colors are flashing, change the parameters of SPEED INK. SPEED INK 1,1:BORDER 0,26 will make the border flash black and white like crazy. SPEED INK 100,100 will flash much slower. 1 unit is one 50th of a second here.

Prodatron

Quote from: McArti0 on 12:55, 27 March 24Like this?
Cool, so many greys on the CPC :)  Btw, the last line should by numbered with 60.

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

McArti0

1 DEF FNrgb(r,g,b)=b*1+r*3+g*9
2 BORDER FNrgb(0,1,1), FNrgb(1,1,0)
3 for t= 20 to 1 step -1:speed ink t,t
4    For d=1 to 20:frame:next
5 next
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

cwpab

Thanks all! Yeah, maybe I didn't explain myself too well.

What I mean is: what kind of "hello world" program for Locomotive Basic (consisting of 2, 3, 4, 5  or maybe 9-10 lines, but not 20; and having simple instructions like "print" or "ink" but nothing too complex on first sight) would you create to show a non-technical person how those "mysterious program" with lots of lines work?

For example, I played with the random instruction, but apparently it always shows the same 5-6 colors or something... And the line(s) to make the random a "modern random" are a bit too complex (at least on first sight).

I guess the result I want would be some kind of silly text that flashes and/or scrolls while changing colors (and maybe the background too unless that's too epilepsy inducing).

This way, I can open an online CPC emulator, dictate these few lines to someone I know, and make this person quickly understand how programming feels.

McArti0

CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

eto

before dealing with inks, I would first try to teach the basics of output, input, variables and program control. Maybe a little game.


eto

Quote from: eto on 15:32, 27 March 24before dealing with inks, I would first try to teach the basics of output, input, variables and program control. Maybe a little game.
something like this

The Electric Monk

Something very simple with two easily understood variables: The arrow keys change the colors of the pen and the border. The learner will get instant feedback, plus repetition of the code that looks for the arrow key presses in lines 40 to 70 will show the learner how each key affects each variable.

10 MODE 0:bo=13:in=13:INK 0,0:PAPER 0:PEN 1
20 PRINT"Press arrow keys to change colors"
30 LOCATE 1,10:BORDER bo:INK 1,in:PRINT"Border";bo;"Ink";in
40 IF INKEY(8)=0 THEN IF bo=0 THEN GOTO 40 ELSE bo=bo-1:GOTO 30:REM arrow left
50 IF INKEY(1)=0 THEN IF bo=26 THEN GOTO 40 ELSE bo=bo+1:GOTO 30:REM arrow right
60 IF INKEY(2)=0 THEN IF in=0 THEN GOTO 40 ELSE in=in-1:GOTO 30:REM arrow up
70 IF INKEY(0)=0 THEN IF in=26 THEN GOTO 40 ELSE in=in+1:GOTO 30:REM arrow down
80 GOTO 40

cwpab

I appreciate the answers, and they're certainly interesting to me...

But please note we're talking about an extremely non-technical person that doesn't have the time for complex instructions.  ;D

I would prefer some sort of "hello world" with colors that don't destroy your eyes. Someone suggested a "for i=0 to x" to delay the next "goto"... I may try that, maybe I get a 3 line program to show some text changing colors.

The Electric Monk

Final offer :D

10 MODE 0:BORDER 0:INK 0,0:PEN 1
20 i=1
30 PRINT "Hello world!"
40 INK 1,i
50 FOR t=1 TO 1000:NEXT t
60 i=i+1:IF i=27 THEN END ELSE GOTO 40

McArti0

StopDelayTime=time+600 : While time<StopDelayTime : Wend
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

McArti0

CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

Powered by SMFPacks Menu Editor Mod