PDA

View Full Version : console script "Häufigkeiten" help

Lionheart008
23-02-2009, 17:21
dear thinbasic friends,
hello rainy day, short question:

can anybody help for this little console script??? I will learn to make it better :)

'Demonstrationsprogram
'für Haeufigkeiten, später lottoprogramm by lionheart, try 1, 20.feb.2009

uses "console", "math"

dim r as integer
dim p as single
dim n, i, anzahl(6) as long
n = 5000
randomize timer
anzahl(1) = 1, 2, 3, 4, 5, 6

Console_SetScreenBufferSize(80, 25)

PRINTL ("--------hallo liebes haeufigkeiten programm-------")
PRINTL ("-------increase random example for n = 5000--------")
PrintL
'n Zufallszahlen generieren
for i = 1 to n
r = Int(RND*5)+1
anzahl(r) += 1
next i

PRINTL ("--------Prozente berechnen ! -------")

'Jetzt die Bilanz ausgeben:
PrintL ("Haeufigkeiten in Prozenten:")
for i = 1 to 6
'PrintL format\$(i,"##: ")
PrintL ( "#.00: > ###.00: (", i, anzahl(i))
'Berechnung des Anteils in Prozent:
anzahl(i) *= 100
p = anzahl(i) / n
PrintL ("##.### %", p) ',p
PrintL
Next i

Console_Write("Ok, now press any key to exit")

Console_WaitKey

would like to have a list with numbers for "###" and should have done something with format\$ but don't check it... was too tired last night...

the script works but not in the original way I wished...

best regards, more will come later,
lionheart

Michael Clease
23-02-2009, 17:42
Frank the format\$ keyword should be inside brackets.

PrintL (format\$(i,"##: "))

hope this helps.

Lionheart008
23-02-2009, 20:02
Hi michael:), hi all...

good to know to learn more with console scripts... I am doing step by step and I have some ideas to build another script with ui input... I will show it the next time...

bye, good evening, good to see how to get a very short reply,
best regards, Lionheart

fixed version I add... and it wasn't so easy to find the per cent input for me;)

ciao und servus, Lionheardo di headacho

Lionheart008
24-02-2009, 10:48
good morning:)

perhaps somebody has fun to work with me for a kind of "lottery" (in german you would say "lotto") console script program:) the first example belongs to this direction, the next one is closer to my idea...

I have started with this script basis, it works, but without printing 6 numbers as result... - I would like to have some output results (6 numbers)... 6 from 49 numbers, so you can win the next checkpot :D

the script I add isn't just perfect, but I am thinking very near to the topic theme of "6 from 49" lotto. Don't know if this game exists in usa or greatbritain too:) I am sure italian, spanish, french, chechoslowakei, australian, and european people know it :D

edit and sorry: delete this post as it's not ready ('6of 49' lotto script), publish it, when it's ready, sorry... I will make up my mind to check the script closer and do it with my own power... ;) I will visualize it also with tbgl/UI modules, show it at a new topic, will take some days,
bye, Lionheart, wednesday:)

best regards, Lionheart, full fitto, but now going to dentist, I have a lot of courage (autscho) :lol: