Post Reply 
(DM42) Lottery number generator programming
02-12-2019, 05:56 AM (This post was last modified: 02-14-2019 07:43 AM by psw.)
Post: #4
RE: (DM42) Lottery number generator programming
Thank you very much, Dieter and Thomas, how grateful your help are.

To Dieter, your explanation is very clear and handy, digesting a lot of complicated images into the beginner's brains. This 41/42 programming is a little similar to BASIC and C for the loop control. I am very happy to know the counter functions are bundled and do not need to use registers. And it also tells me that I need to study all the functions do what in this machine.
Quote:01>LBL "RANDOM"
02 X>Y?
03 X<>Y
First, I am sort of impressed like a lightning into my eyes. This small idea is unexpectedly useful for someone who doesn't know which number to put X register. It makes user friendly and some non-tech savvy people can get the right numbers without errors. This tells me to use my brain more flexible. I will try to do.
The concept that RAN x Y results 0 to Y-1, came up my mind, short after trying RAN function without programming. That's my bad.
Quote:04 1E3
05 รท
06 1
07 +
08 STO 00
Second, I wondered why you made a change of X register into 1.004, puzzled a lot and finally figured out this is for the Loop control DSE and ISG indirectly (so the registers don't mess up by loop counter), also I was amazed that the way of LOOP work to reduce memory into just ONE stack value for a loop. Therefore this HP 41 base series was used by NASA in 80's. SetFlag and FlagChech?Clear is as C language
if (i==0) do {next program} else {skip next program}; i=0
something like this. Very important to put a separator between two number in the alpha memory. I need to study a lot about loop control, I guess. And the sorting these numbers are very pleasant to read the result. But I didn't come up with the single idea. Please do teach me, this was related with the flowchart flaws of X=Y? doesn't really help to verify all the numbers are unique.

FYI, input of
Quote: 0.12345 [SEED] 18 [ENTER] 4 [EXQ] "RANDOM"
to my DM42 returns
5 14 4 6
12 3 14 14
1 12 10 3
Perhaps, random generator is different from Free42.

To Thomas, yes they are my flowchart flaws. The first one; "the numbers may not be unique each other" issue, I noticed this early but couldn't really find the way to do the comparison. Now, what BIT? does is still not clear in my brain but the hint "this may detect up to 35 horses", thus this machine operate 36 bits in BASE mode, my friend has an idea about binary numbers but unfortunately I don't have much, now I understand this program can't be used for a lottery which the numbers are usu more than 35.
The second concern the AVIEW could be very long, well, for lottery buyers need 6 or 7 numbers, for horse ticket buyers wouldn't be crazy and it used to be many horses at one race, these days 18 is maximum gate number in Japan and 20 or so in France.

So, the name of the program should be "horseracing ticket picker" and the number limit MAX = 35 and 6 drawings due to the printable capacity of AVIEW at glance.
Will you add this collection to the DM42/Free42 program library? It can be used as a dice roller, if they don't watch horse races. I'd like to think and hear what would Dieter and Thomas develop the program together.

Best regards,
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: (DM42) Lottery number generator programming - psw - 02-12-2019 05:56 AM

User(s) browsing this thread: 1 Guest(s)