Post Reply 
(DM42) Lottery number generator programming
02-12-2019, 12:57 AM
Post: #3
RE: (DM42) Lottery number generator programming
(02-11-2019 07:35 PM)Dieter Wrote:  Now, what about adding a sorted output ?-)

The following program uses the bits of an integer to simulate a set.
Using the BIT? function allows to detect a duplicate value.
It then goes back to label 00 and tries again.

Code:
00 { 54-Byte Prgm }
01▸LBL "RANDOM"
02 STO 00
03 0
04 X<>Y
05▸LBL 00
06 R↓
07▸LBL 01
08 RAN
09 RCL× ST Z
10 IP
11 BIT?
12 GTO 00
13 2
14 X<>Y
15 Y↑X
16 +
17 DSE 00
18 GTO 01
19 X<>Y
20 1
21 -
22 1ᴇ3
23 ÷
24▸LBL 02
25 BIT?
26 VIEW ST X
27 ISG ST X
28 GTO 02
29 END

The limitation however is that this works only up to 35 horses.

Example:

18
ENTER
4
XEQ "RANDOM"

ST X=6.017
R/S
ST X=10.017
R/S
ST X=15.017
R/S
ST X=16.017
R/S
18.017

Make sure to have the printer off (POFF) and flag 21 (Printer Enable) set, i.e. SF 21.
Otherwise the VIEW command in line 23 will not stop.

Have fun with your DM42.
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (DM42) Lottery number generator programming - Thomas Klemm - 02-12-2019 12:57 AM



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