CA2036119A1 - Dice simulator - Google Patents

Dice simulator

Info

Publication number
CA2036119A1
CA2036119A1 CA002036119A CA2036119A CA2036119A1 CA 2036119 A1 CA2036119 A1 CA 2036119A1 CA 002036119 A CA002036119 A CA 002036119A CA 2036119 A CA2036119 A CA 2036119A CA 2036119 A1 CA2036119 A1 CA 2036119A1
Authority
CA
Canada
Prior art keywords
lda
sta
dice
cmp
roll
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
CA002036119A
Other languages
French (fr)
Inventor
Robert B. Vanstone
Stephen L. Elias
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CA002036119A priority Critical patent/CA2036119A1/en
Priority to US07/692,383 priority patent/US5238249A/en
Priority to GB9202548A priority patent/GB2252918A/en
Publication of CA2036119A1 publication Critical patent/CA2036119A1/en
Abandoned legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F9/00Games not otherwise provided for
    • A63F9/04Dice; Dice-boxes; Mechanical dice-throwing devices
    • A63F9/0468Electronic dice; electronic dice simulators

Abstract

ABSTRACT

A dice simulator for simulating dice rolling or the like utilizes operator selectable probability weighting to cause quasi-random rolling results to be biased in accordance with the selected probability weighing.

Description

DICE SIMU1.A'rOR

BACKGROUND OF THE INVENTION
_ _ Field of the Invention This inventlon pertains to randomlpseudo-random number ~enerators and particularly to electronic dice simulators to provide displavs of numbers in speclfie~
ranges.

Descr~ptlo11 of the Related_Art Prior art electronic dice simulators inc1ut1e those disc10sed in Ur1ite(l States l~at-!11t 4~81')~,~18 ~ranted April 11~ 1'-J8~ to Simkus et ,31. alld U.S. ~)atellt 4,432,189 gran~ed Fe1)ruarv 14. 1`~84 to Wiet1(~ek et al.
2~3~9 Simkus et al provides a micro-computer driven random data selection system wherein a processor is arranged to read a matrix of switches to determine a range of numbers and to establish a software controlled sequencing routine corresponding to that range. The interrupt terminal of the micro-computer is used to sense the activation of the system and cause the number selection. The software of the Simkus device presents the internal counters to the requisite range in response to the status of the switch matrix and displays that range in one of the two LED displays. Following sensing of the range, the computer starts the sequencing or counting and continuously sequences until deactivated.
When the "roll" switch is operated, the computer samples and displays the last number in the sequer.ce. Data for controlling the displays and loading the coullter is stored in memory locations and the address for this data is developed from an index ~enerated from the switch matrix inputs.

Wiencek et al provide a circuit :in a device for electronically determining a simulated roll of a six-sided die (or two-sided dice~. The circuit consists of a multi-position switch and related circuitry which 2~3~9 allows the device to also sirnulate a roll of a die other than six-sided. namelv four-sidecl, eight-sided. t~elve-sided~ twenty-sided or one hundred-sided.

The above mentioned prior art devices have the drawback of allowing only one or two dice to be thrown at one time. Moreover, prior art dice simulators have generally not provided one or more random or pseudo-random numbers from an unlisted range. Nor have they allowed ~or operators to weight the probability oC
"rolling" either a high number or a low n~lmber.

SU_M R _ OF' l'llE INVENTION

l'he present inventioll provides apparalus for simulatill~
dice rolling clr the like~ comprisitl~: tirst dat;l entry means for entering nurnerical selectioll d:lta;
microprocessor meall~s for processinr sai(J nllmeri(~at selection data antl cornputillp!, iu a predetermine(l, clllasi-r.ltldOm mallller, rl?SUIt:S cu)respt)lldill~ to the ~s-~lecl~d numerical data; an(l secolltl dat.l entry means for r!llterill~:
prohabili~v weightin~ criteri;l to bias said ~`OIIIpUlill[~
a precletermillecl quasi-lillldom manller all(l c;lllse lhc processing of tlle llulrlel-ic.ll sell~ctol d,l~a lo Vil`lrl simulation resul~:s ill accoltt wi~.h sai.(l prob;ll)i1it.y weighting criteria.

.

2~3~

In a narrower aspect of the invention further provides duplicated display means to permit simulation results to be viewed by other users, as well as the operator.

BRIEF DESCRIPTION OF THE DRAWINGS

The preferred embodiment of the invention will now be described with reference to the annexed drawings. in which:
Figure l i.s a perspective view of a dice simulator according to the present invention;
Fi.gure 2 is a block schem~tic diagram of the circuit of the dice simulator of Figure l;
Figures 3a and 3b are the flowchart of the software for operating the circuit shown in Figure 1: and Figures 4a, 4b and 4c are the flnwchart nf the subroutine "ANSWER" in the flowchart of F'igures 3a nnd 3b.

2~3~

DESCR:[P'I`I()N_OF 'l'HE PREFERRED_EMBOI?IMEN'I' Referring to Figure 1~ a dice simulator 10 comprises an on/off button 11, numerica1 key pad buttons 12a - 12j correspondin~ to the digits O to 9, an operator's display 13, a display 14 for other users. a probability weighting dial 15, non-numeric key pad buttons 16 and 17, and four pre-set "dice type" buttons 18a to 18d.

Referring now to Figure 2~ circuit of t.he dice simulator 10 comprises a microprocessor 19 (pre~eral)ly a Motorola MC~8HC705) which is connected via i.ts POR~ A ~o a probability weighting selector '0. The mlcroprocessnr 19 is more fully tlescribed in the 1~89 Mott)rola ~nc.
Semiconductor publ.ic~tinn BRr)94/1). whicll i.s incorpor~tt?~l herein bY reference. rhe selec~ r '~0 is a sev~r~
positioll switch. each of whicll is connec~ed to the first seven pi.ns while llle w.ipr~r Oli whicll is corlllecte(l lo ~he eighth pin of the P(Rr ~ arltl to c.ircuit groull(l. Ihe position of the switch ~() r.letermilling the prol)al)ili.lv weightillg inlplemenled nsillg ~lle di;ll Ir) (Fi~,~lre 1~. For each pos-itiorl a correspolldi.llg line :is eollrlecterl to a correspondiny~ pin in the l'()R'I` A. 'I`he ~.ermillals of Ille :~
,, , "' ' 2~3~h~9 switch 20 are each connected to a logic "high" through respective l kOhm resistors referred to generally by the number 21 in Figure 2. This configuration results in the seven first pins of PORT A being logically high, unless grounde~ by the wiper of the switch 20. The system software interrogates the pins of PORT A to determine which switch 20 position is selected and to apply the predetermined probability weighting, assigned to the selected position.

A key pad 22 is connected to the pins of PORT B of the microprocessor 19 by eight lines. Four of those lines are for input to the microprocessor 19 and four are for output from it. The four input ]ines are connected to ground through respective 10 kOhm resistol-s referred to generally by the number 23 in Figure 2. As a result of that configuration the output lines are kept high. Depressing a kcy on key pad 22 callses a corresponding input line to go "high". The input lines between the key pad 22 illld IlliCrOprOCeSSOI` 19 al(` illXO
connected to the [RQ pin of the microprocessor 19 _ 7 through a four input NAN3) ~ate 24. The IRQ pin provides two different choices o~ interruptin~ trig~ering sensitivity. As a result~ pressin~ a key on the key pad 22 causes the microprocessor 19 to search the input lines and identify the pressed key.

PORT C of the microprocessor 19 is connected to an L.C.D. driver 25 by eight lines designated generally by reference number 26 in the figure. Four of the 1ines 26 transmit the n1lml)er that is to be di.spl~yed. lhe other four lines indicate which digit of the L.C.D. recei.ves the incoming number and signals the L,.C.D. to displaY.
Either of the Intersil 7211 or 7211M devices maY be nsed in accordance with nn~rlufacturer'~s specificatio1ls.

The L,.~,.1). driver 25 dl`iVI's twn collvenl..iollal l,CD
displays in parallel, one 1133 for the operator~ ant1 the other (14) ~or vi.ewers Ol1 the oth(?r side.

Referrirlg to F`.i~urcs 3a all(l 3b once ttle on/l)l`l button ll (Figure l~ :i.s use(l to close the maill swi~.cll .31 to the butto11s 30 the software "s~.arts" bv initiAlizillg the dice simu:Lator 10 and displ.ays the word "dIC1~." on the di.spl.ays 13 and 14. Aft:er initialization~ l:he ~ a~

software proceeds according to the flowchart of Figures 3a and 3b. For example. tlle next step is "search keypad", where the lines from PORT B of the microprocessor 19 to the key pad 22 are searched until the operator pushes a key on the key pad 22.

The main system software shown in Figures 3a and 3b is written in Motorola Assembly Language. The program corresponding to Figures 3a and 3b is given below in segments preceded and annotated by the customary explanatory commentary in English.

_ 9 - ~ V~

ORG $lFFE The Re~et vector is located at ~lFFE and FCB #$01 $1FFF. This sets the Reset vector to $0100 FCB #$00 which is where the program starts.
PORTA EQU $00 All inputs - capture6 LUCR factor PORTB EQU $01 Keypad interface PORTC EQU $02 A11 outputs - to the LCD
DDRA EQU ~04 Data direction PORTA
DDRB EQU $05 Data direction PORTB
DDRC EQU $06 Data direction PORTC
FDATA EQU $60 Flag to proceed to ANSWER
DFLAG EQU $61 Flag when a D is pressed PNUMl ~QU $62 Storage words for PNUM2 EQU $63 what is printed PNUM3 EQU $64 to the LCD
PNUM4 EQU S65 4 in all NUMDl EQU $66 One's digit for number of dice rolled NUMD2 EQU $67 Ten's digit for number of dice rolled DSIDEl EQU $68 One's digit for the sides on the dice DSIDE2 EQU ~69 Ten's digit for the sides on the dice DSIDE3 EQU $6A Hundred~s digit for the dice sides DIESID EQU $6B Binary equivalent of DSIDES 1,2,3 PRSREY EQU $6C Value received from the keypad LUCK EQU $6D Luck factor TOTALL EQU $6E Lower word of total rolled on dice TOTALH EQU $6F Higher word of total rolled on dice TIMEH EQU $70 Higher word of time read from clock TIMEL EQU $71 Lower word of time read from clock FOUND EQU $72 Flag that~s true when answer i8 found ROLL EQU $73 Roll of the individual die ROLLl EQU $74 Te~t variable in LUCK4 ROLL2 EQU $75 Test variable in LUCK4 NUMDIE EQU $76 Binary form of number of dice NUMDIC EQU $77 Storage form for NUMDIE
DICSID EQU $78 Storage form for DIESID
TSTEQ EQU $79 Test for an equal sign for repeating The main system program clears and initializes the necessary variables before starting the subroutine calls, Once a key is found and identified, a check is made to ensure that the needed data is available. It isn't the ke~pad is scanned again, until the needed info is obtained. With the info and mnre that is gotten in further subroutines, the answer is returned, converted to decimal and theu printed out. The flags are then set back to false and the keypad scanned for the next question.
3~ ~ ~

- 10 - .

ORG $100 Program starts at $0100 CLRA
STA DDRA Set up PORTA as all inputs (LUCK factor) LDA #$99 PORTB is set up as half inputs and half STA DDRB outputs LDA #$FF
STA PORTC PORTC i~ all outputs (LCD) and this STA DDRC turns them on.
JSR PDICE Print dice in the display JSR INITl Clear flags, initialize variables FALSE JSR SRCHKY Get a key from the keypad LDA TST Is this the first pass through?
CMP #$00 If no, skip the next part BNE USUAL If yes then test for an equal sign LDA PRSKEY If not, continue as usual CMP #$0F If yes, then prepare to repeat the BNE USUAL past roll of the dice LDA NUMDIC First put the number of dice rolled STA NUMDIE into NUMDIE
LDA DICSID Then put the sides of the dice into STA DIESID DIESID
BRA GTLK Now skip to the calculation part USUAL INC TST Inc TST to show we've been through JSR SRTKEY Identify key and act accordingly LDA #$01 Test to see if Found is true (if we CMP FDATA the needed data). If not go back and BNE FALSE get more. If yes, continue on JSR CONVRT Convert DSIDEs to DIESID
G~LK JSR GTLUCK Get luck factor for answer to use JSR AN5WER Get the an~wer JSR TODEC Convert the answer to decimsl form JSR PRNT4 Print the answer JSR INIT1 Clear the flags and reset to zero JSR TMFRDC This displays the answer for 10 seconds JSR PDICE then prints dice.
BRA FALSE Scan for the next question The following subroutine clears FDATA, DFLAG, NUMDI
and NUMD2.

2~3 t~

I I

INITl Cl,RA
STA -FDATA
STA DFLAG

STA TST
RTS

The following subroutine scans the keyboard until a key is depressed. It then identifies the key and sends it to the main program as PRSKEY.

SRCHKY LDA #$99 STA PORTB
STA DDRB Turn on all columns ANYKEY LDA PORTB
AND #$66 Mask away columns BEQ ANYKEY
LDA #$20 OUTLP CLRX
INRLP DECX
BNE INRLP
DECA
BNE OUTLP
CLRX
KEYLP LDA KYTBL,X
STA PORTB
CMP PORTB
BEQ KEYFND
INCX
TXA
CMP #$ 10 BEQ SRCHKY
BRA KEYLP
KEYFND TXA
STA PRSKEY
TILRLS LDA PORTB This part ensures against people L;~

AND #$66 who leave their finger on the BNE TILRLS button. It delays until released LDA #$99 STA PORTB
RTS
KYTBL FCB #$21 D8 FCB #$28 D10 FCB #$30 D20 FCB #$A0 D100 FCB #$05 FCB #$0C
FCB #$14 2 FCB #$84 3 FCB #$03 4 FCB #$OA 5 FCB #$12 6 FCB #$82 7 FCB #$41 8 FCB #$48 9 FCB #$50 D
FCB #$C0 The following subroutine tests the key pressed. If the key was in the row (D8, D10, D20 or D100), it calls TOPROW. If it was a D it calls YESD. Otherwi.se it tests if we already have a D. If so, :it calls D~SIDE.
Otherwise NUMDC. It then returns.

SRTKEY LDA PRSKEY
CMP #$04 If key pressed was in the toprow BHS PAD call TOPROW then go to end JSR TOPROW else go on to next test BRA ENDSRT
PAD CMP #$0E If it's a D call YESD then goto end BNE NOTD else go on to next test JSR YESD
BRA ENDSRT
NOTD LDA DFLAG If we already have a D, this must CMP #$01 be for the sides of the dice, so BEQ HAVED call DCSIDE. I f we don't, it must be JSR NUMDC for the number of dice, call NUMDC
BRA ENDSRT
HAVED JSR DCSIDE
ENDSRT RTS

The following subroutine is called when a D8, D10, D20 or D100 is pressed. It calls YESD (to print a D and ensure a NUMDI e~ists). It then puts the correct numbers in DSIDEs 1, 2, 3 and prints them. It flags FDATA as true and returns.

TOPROW JSR YESD Call YESD to print a D, etc.
LDA PRSKEY Was a D8 pressed?
CMP #$00 BNE NOTZER
LDA #$08 If not, put 8 into DSIDEl STA DSIDEl BRA WRITE Was a D100 pressed?
NOTZER CMP #$03 If ye~, put a 1 in DSIDE3 LDA #$01 BRA WRITE
NOT3 STA DSIDE2 Put a 1 Or 2 in DSIDE2 WRITE LDA DSIDEl STA PNUMl INC FDATA Set data flag true RTS

The following subroutine is called when a D is pressed on the keypad. It print~s a 1~ an(l set.s the die sides to 0. It then checks for a positive NUMDI and defaults to I if not found. Finally it sets the DFLAG
positive and returns.

YESD STA PNUM4 Put a D in PNUM4 CLRA

, ~'~3~

STA PNUN3 and clear the other PNUMs.
STA PNUM2 This causes dOOO to be printed.
STA PNUNl STA DSIDEl Initialiæe DSIDES to zero. This ensures STA DSIDE2 no unwanted numbers for DIESID.

LDA #$01 Make sure we have a NUMDIE
CMP NUMDl by seeing if NUMDl or NUMD2 has a BLS HNUMD number in it.

~LS HNUMD If no number is found for NUMDIE
STA NUMDl Put a 1 into NUMDl.
HNUMD STA DFLAG Set Dflag positive.
RTS

The following subroutine is called when the number of dice hasn't been determined yet. It checked for an equal sign and returns to SRTKEY if it finds one.
Otherwise it moves NUMDl to NUMD2 and puts PRSKEY into NUMDl. It then prints out the number.

NUMDC LDA PRSXEY If PRSKEY i8 e ~ gO to Qnd CMP #$0F
BEQ NUMEND
LDA NUMDl Put NUMDl into NUMD2 JSR MAKNUN Get the number LDA PNUMl Put PRSKEY into NUMDl STA NUMDl CLRA

JSR PRNT4 Print out new number NUNEND RTS

, . . .

' The following subroutine is called when the sides of the dice are being determined. It checks for an equal sign and if it finds one, it checks to make sure that DSIDES do exist. If not, it returns to the keypad, if yes it makes FDATA true and returns if it is not an equal sign. DSIDEl is moved to DSIDE2, and the new number is put into DSIDEl. Both are printed.

DCSIDE LDA PRSKEY
CMP #~OF If PRSKEY was an equal sign BEQ EQSGN go to EQSGN
JSR M~KNUM Get decimal equivalent of PRSKEY
LDA DSIDE1 Move DSIDEl to DSIDE2 STA PNUM2 Ready to be printed LDA PNUM1 Put new number into DSIDEl STA DSIDEl JSR PRNT2 Print out the number BRA ENDDCS
EQSGN CLRA
CMP DSIDEl Test to see if we have a BNE HAVDAT valid number of die sides CMP DSIDE2 If yes FDATA is true, otherwise BNE HAVDAT return to get more info BRA ENDDCS
HAVDAT INC FDATA
ENDDCS RTS

The following subroutine converts PRSKEY to the correct number and puts the result in PNUMI.

MAKNUM LDA PRSKEY
SUB #$04 STA PNUMl RTS

I`he following sub~outine converts the sides of the dice contained i.n DSIDEs 1, 2, 3 to a single binary equivalent in DIESID. It first checks DSIDE3 for a one.
If it finds one, the D100 was called for. If not, CONVRT then adds ten for each value in DSIDE2 to the number in DSIDEl and stores the result in DIESID. It then converts the numbers in NUMDl and NUMD2 to a single variable called NUMDIE. Finally, CONVRT stores NUMDIE
and DIESID in additional storage spaces called NUMDIC

and DICSID.

CONVRT CLRA
STA DIESID Test to see if we have a D100 CNP DSIDE3 If so branch to DIE100 DC10 CMP D5IDE2 Test to see if more then 9 sides BEQ SMDIE remain on the die.
LDA DIESID Add ten to DIESID
ADD #S0A
STA DIESID
DEC DSIDE2 Subtract one from DSIDE2 CLRA
BRA DC10 Check another time for sides SMDIE LDA DIESID
ADD DSIDEl Add DSIDEl to DIESID
STA DIESID
BRA ENDCON
DIE100 LDA #$64 Put 100 into DIESID
STA DIESID

LDA #$00 This part of the subroutine STA NUMDIE convert~ the numbers in the NUMDs NM2 CMP NUMD2 to a single number called NUMDIE
BEQ NMl First loop through NUMD2, adding LDA NUMDIE OA (10) to NUMDIE and subtracting ADD #$0A one from NUMD2 each time until STA NUMDIE NUMD2 is zero. Then add NUMD1 to LDA #$00 NMl LDA NUMDIE
ADD NVMDl STA NUMDIE
STA NUNDIC Store NUMDIE in NUMDIC
LDA DIESID Store DIESID in DICSID
STA DICSID
RTS

The following subroutine checks with PORTA (which is wired to the luck selector) until it finds a match.
When a match is found, the corresponding luck f actor is returned. From the hard wiring all the choices are wires high. The return is wired low and is bit O in PORTA. The selected luck factor will also be low but all others will be high. Thus the accumulataor is loaded with PORTA and comparisons are made until the zero is found. That will give us the luck factor.

GTLUC~ LDA #$01 Initialize LUCK to one STA LUCK
LDA PORTA Load the luck selector reading LSRA Get rid of the zero bit STRTLK LSRA Move the next bit into carry BCC ENDLCK See if the carry bit is clear INC LUCK If no, try the next bit in PORTA
BRA STRTLX If the carry was clear, the ENDLCK RTS selector was pointing there.

A major subroutine of the program is "GET ANSWFR"
which is invoked once the last block in Figure 3a is reached. The subroutine "GeT ANSWER" is shown in flowchart form in Figures 4a, 4b and 4c, The subroutine returns the answer that is the total of all the dice rolled, it gets the time, selects the correct luck program to call (receiving ROLL back) then adds ROLl, to its previous total until all the dice have been counted, The sum is returned as TOTAL.

ANSWER CLRA
STA TOTALL Set totals (high and low) STA TOTALH to zero STARTA JSR GTTINE Get the tLme CLR FOUND Set FOUND false 3~J

LDA LUCK
CMP #$04 BEQ L4 In this section the LUCK factor CMP #$01 is used to select the appropriate BEQ Ll subroutine to find the ROLL.
CMP #$07 CMP #$02 CMP #$03 CMP #$05 JRA LEUNCDKA6 After ROLL is returned, the Ll JSR LUCXl subroutine jumps to ENDA.
BRA ENDA

BRA ENDA

BRA ENDA

BRA ENDA

BRA ENDA

BRA ENDA
ENDA LDA TOTALL
ADD ROLL Add ROLL to the lower byte STA TOTALL of total LDA TOTALH Add carry bit to Totalh - this ADC #$00 allows number~ higher than 255 DEC NUMDIE After each die i8 rolled, the CLRA number of dice remaining is CNP NUMDIE checked. When that number is BEQ ENDANS zero, all the dice have been JMP STARTA
ENDANS R~S

The following subroutine collects the time from the internal clock and stores it in a high and low byte. It the masks part of the higher byte, depending on the die's number of sides. This is to ensure fast response time without sacrificing randomness.

C~ ,r ,~ ,,, GTTIME LDA ~lA
STA TIMEH Get the time and store it LDA ~lB
STA TIMEL
LDA DIESID Test the die sides CMP #$14 Is it more than 20?
BHI M3 If yes, branch to M3 CMP #$OA Is it more than 10?
BHI M2 If yes go to M2 LDA TIMEH
AND #$03 STA TIMEH For 10 or less sides TIMERH
BRA ENDTIM uses only its 2 right-most bits M2 LDA TIMEH For 11 - 20 sides, use four bits AND #$0F from TIMEH
STA TIMEH
BRA ENDTIM
M3 LDA TIMEH For more than 20 sides, use AND #$3F six bits of TIMEH
STA TIMEH
ENDTIM RTS

The following subroutine scans the list of numbers between 1 and DIESID, from the top down and bottom up simultaneously. When TESTIM returns FOllND as true, the number currently being searched i9 the ROLL and is returned to ANSWER.

START4 LDA DIESID Initialize top down search CLR ROLLl Initialize bottom up search BEGIN4 INC ROLL1 ROLL1 gets next number on list JSR TESTIM Is the time up?
CMP FOUND TESTIM always returns zero in BNE A4 the accumulator. If Found is true JSR TESTIM the ROLL is decided, else try CMP FOUND the next number.

DEC ROLL2 ROLL2 goes to next number on itx CMP ROLL2 list. Does it =0? (accumulator) BNE BEGIN4 If no, go to BEGIN4 BRA START4 Else branch to START4 ~ ~3 ~ ~J .~ . .J

RTS
The following subroutine i~ heavily favoured to ROLL low numbers. It creates a pattern 1 1 1 1 1 1 ...... .....and searches through it from top down. 2 2 2 2 2............ When TESTIM returns a positive FOUND 3 3 3 3.............. the number currently under examination 4 4 4............. is the ROLL which LUCK1 returns to 5 5 etc,. ANSWER.

LUCKl NOP
START1 CLR ROLL Initialize ROLL
CLR ROLLl ROLL1 is a dummy variable BEGINl INC ROLL
INC RO~Ll JSR TESTIM See if number is FOUND
CMP FOUND (accumulator = O from TESTIM) BNE ENDl When Found go to end LDA ROLLl This section creates the pattern CMP DIESID Row one has DIESID 1's in it BEQ NEXTl Row 2 has (DIESID-l) 2'8 in it DEC RO~L This puts the correct number of BRA BEGINl entries in each row NEXTl LDA ROL~ This part prepares to start STA ROLL1 the next row (which will have CMP DIESID one less entry than the previous BEQ STARTl one) BRA BEGINl Tlle following sul)ro~ltin~ is heavilv favoured to ROLL high nu~lbers. It creates a pattern 1 and searches from bottom up. When TESTIM 2 2 returns FOUND as true, the number being 3 3 3 examined is returned to ANSWER as the 4 4 4 4 etc,. ROLL.

START7 LDA DIESID Initialze bottom up s~arch STA ROLL
STA ROLL1 Dummy variable CMP ROLL1 This subroutine operates the same BEQ NEXT7 as LUCK1 except that it runs JSR TESTIM through the large numbers first CMP FOUND

LDA ROLL

CMP #$00 The following subroutine tests the value in the lower time byte. If the value is in the upper third, the value of ROLL returned to ANSWER will be from LlJCK4, otherwise from LUCKI.

CMP #$AA AA = 170 which is two thirds of The following is the same as LUCK2 except that two thirds of the time ROLL will be from LUCK4 and one third from LUCKl.

CMP #$AA

PRT3B JSR hUCKl The following subroutine is the same as LUCK2 except that two thirds of the time the ROLL will be from LUCK4 and one third LUCK7.

CMP #$AA

The following subroutine is the same as LUCK2 except that two thirds of the time the ROLL will be from LUCK7 and one third LUCKh.

CMP ~AA

The following subroutine's purpose is to test if time = O and to fla~ F'OUND as true when it is. If time doesn't equal zero, time is decreased by I and the subroutine returns to the calling program. Time is stored in TIMEL and TIMEH.

TESTIM CLRA TPst lower time byte CMP TIMEL If it's not zero, goto continue BNE CONTl CMP TIMEH If it is, test higher byte BN~ CONT2 If it~s not zero, go to cont2 INC FOUND If it is, set FOUND as true BRA ENDTT

CONTl DEC TIMEL
ENDTT LDA #$00 RTS

Now the "GET ANSWER" subrou~ine is finished and the program returns to the block "CONVERT ANSWER TO DECIMAL
FORM" at the top of Figure 3b. Thus, the following subroutine converts TOTALH and TOTALL to decimal form and readies it for printing. It does the lower byte by itself and calls BIGNUM if there is a value in TOl'ALH.

CLR PNUM3 Set all the outputs to zero CLR PNUMl LDA TOTALL Sort out the hundreds first DG100 CMP #$64 When TOTALL is less than 100 BLO DG10 move on to the tens column SUB #$64 INC PNUM3 PNUM3 has the 100's value DG10 CMP #$0A Is TOTALL now less than 10?
BLO DGl When it is, move on to the ones SUB #$OA
INC PNVM2 PNUM2 has the 10's value DGl STA PNUMl The remainder is the ones value LDA TOTALH Test to see if TOTALH exists CMP #$00 If it does then the total is BEQ ENDTOD above 255 and we call BIGNUM
JSR BIGNUM
ENDTOD

f;~

The following subroutine is called when the answer in total exceeds 255. It converts the number in TOTALH
to decimal form and adds it to the numbers obtained from TOTALL. The result is stored in PNUM and is ready to be printed.

BIGNUM NOP

ADD #$02 LDA PNUN2 This adds 256 to the PNUMs for ADD #$05 each value in TOTALH.

LDA PNUMl ADD #$06 STA PNUMl DEC TOTALH
CLRA
CMP TOTALH
BNE STRTBG
LDA PNUMl This section makes sure that BABNUM CNP #$09 PNUMl contains nine or les~
BLS TENSOR with the excess converted to SUB #~0A PNUM2 STA PNUMl BRA BABNUM
TENSOR LDA PNUM2 This section ensures that PNUM2 TENNUM CNP #$09 contains nine or less with the BLS HUNOR excess converted to PNUM3 SUB #$0A

BRA TENNUM
HUNOR LDA PNUM3 This section ensures that PNUM3 SENNUM CMP #$09 contains nine or less with the BLS DONER excese converted to PNVM4 SUB #$OA

BRA SENNUM
DONER RTS

The following subroutine is called to initialize the PNUMs so that the word diCE is printed on the display PDICE LDA #$0D
STA PNUM4 This subroutine simply LDA #$01 loads the PNUMs from the STA PNUM3 accumulator, one at a time LDA #$0C

LDA #$0E
STA PNUMl RTS

The following subroutine displays the answer for 10 seconds, then changes the display to dice. If a key is pressed before the ten seconds expires, the loop is ended and the regular prn~ram is resumed at SRCHKY.

TMFRDC LDA #$0F

LOOP3 LDA #$80 STA PNUM1 Thîs subroutine creates a loop.

LOOP2 L~A #$FF Every time through its inner loop, STA PNUM2 it checks to see if anything ha~

LOOP1 LDA PORTB been hit on the keypad~ If it has CMP #$99 the subroutine kicks out, BNE DICEND

CLRA

CMP PNUMl DICEND RTS

The following is the subroutine that prints out at the LCD. Calling a PRNT program also calls those beneath it.

PRNT4 ~DA PNUM4 Load the a~cumulator with PNUM4 and STA POR~C send to the output file LDA #~10 This i~ the switch that causes the STA PORTC output file to be printed JSR PRNT3 Now call PRNT3 RTS Return to calling program PRNT3 LDA PNUM3 This is the same as PRNT4 except ADD #$40 that PNUM3 is printed.
STA PORTC The #$40 must be added to PNUM3 80 LDA #S10 the LCD will know the digit that STA PORTC PNUN3 gets printed in.

RTS

ADD #$80 STA PORTC
LDA #$10 STA PORTC

RTS

ADD #$CO
STA PORTC
LDA #~10 STA PORTC
RTS

In operation~ the program begins by searching the keypad to detect the number of dice selected (from I to 99.~; the number of si.des on eacll die (from I to 100);
and the probability weighting factor.

f;~ 3 É~ ,Y, '9 ,~

For e~ample, by setting the dial 15 at "4" and pressing from among the "dice-type" buttons the button 18a (D8) the operator selects a single, eight sided, evenly weighted die having "sides" numbered "I" to "8".

S In general. to determine the number of dice the operator presses numerical buttons 12 a to 12j corresponding to the desired number of dice (I to 99):
the default is one die. For die other than those provided by pressing the buttons l~ for the pre-selected types (8sided, 1() sided, 20 sided an(l 100 sided~ the operator then presses the "D" button 16 and then presses numerical buttons 12a to 12j col-responding ~.o t.he desired number of sides (1 to 100); otherwi.se the operator does not press the "D" but:ton 16 and jusl:
presses the desired "dice-tvpe" button 18, ~ubse~uentlY
pressing the "=" buLtoll 17 would sta2t the simu]ation, Therefore, before pressing the "=" bl.ltt,Orl 17 the desired probability weightillg should be selected USillg the d:ial 15.

Press.i.ng the "~" button 17 indicatf?s l.o thl? device that the operator is ready to "roll", provided the devi.ce has recei.ved su~liciellt illforlllatioll. If i~ has ~ ~ 3 ~ L i ~

received enough information, pressing the "=" button ]7 causes the device to convert the numerical input from base 10 form to binary form, The position of the dial 15 of the probability weighting selector 20 then determines the weighting of the die or dice, and that weighting is recorded.

Due to the fact that the microprocessor 19 is running at high clock rate, say, 2 MHz, it is difficult for human operators to determine, without the aid of electronics, what clock value will be recorded by pressing the "=" button 17 on the key pad 22.
Therefore, it is in this sense that the dice simulator 10 is a random/ pseudo-random device.

The count on the interna1 clock of the microprocessor 19 is recorded by pushing the "=" key 17 of key pad 22. The microprocessor l9 clock has an 8 hit higher time register and an 8 bit lower time register.
It is preferred to mask some of the higher bits in the clock count, to decrease the response time of the device - 2'~ -10. The numher of hit~her bits masked is proportional to the number of sides on each die. lhus if a 20 sidetl die were rolled, there would be 1024 different numbers that would actually be used to determine the number rolled.

The number 1024 is obtained because the si~ ]eft-most bits of the higher time repister are masked away.
This leaves the entire lower time register which has eight bits and the two remainint~ its from the higher time re~ister, for a total of ten bits. Each bil m~ly be zero or one. Tt1e?iefl)re~ tllel~ art? 1()24 diff(?rellt combinations possible (2 to the expont?nt ~en).

If a 100 sided die wele to l)t? rnlled~ t,h-`ll therr are 4.096 possible rea(lirlp,s sillce onlv lhe f(llll left-rnost bits of the hi&her timt? registcr are Inaske(l nw;lv.

If the probnl)ilil:Y weit:htillp dial 15 is ~set l:o position 4~ .i.r?. tl'l(? Illid(lle pOS'it:i.OII~ the~e iS tor all ordin;lry uncli(le(l nperator an even challce of allv nullll)rr between I and the nulnl)t?l of sL(lt?s of tlle cf i e hr?illt~
"rolled". A nuTnbel is "rolle(1" in ~hal installtn-? hv ~:he device 10 iterativelv com~.lring tlle recnlded clock COUIIt to a lower value and to that npper valul?. First, if the t -~

-- '30 recorded clock count is "zero" then the value "I" bas been "rolled". If that clock count is not "zero" then the clock count is compared to the upper value (at this stage, the number of sides of the die). If the clock count is that upper value then that upper value is "rolled". If the clock count is not that upper value then the lower value is increased by one and the upper value is decreased by one. The new upper and lower values are once again compared to the recorded clock count. The comparisons and iterations continue until (i) the lower value and the recorded clock count equal or (ii) the "upper value" has been iterated down to zero. Once that "upper value" has been iterated to zero (i) it is reassigned the value of the number of sitles of the die and (ii) the lower vallle is reas~sigrled ~he value "l".

The possibility of repeated comparisons and resettings, ad infinitum~ is precludetl as follows.
After each comparison the recorded clock count is 20 compared to zero. I~ the clock courlt is zero tllen the device indicates the value is "rolled". If the recorded clock count is not zero that count is decreased by one and tlle next iteration and comparison begin.

~ 3 3 ~ .L ~ ~

The probabil-ity weighting dial 15 may alternatively be set to any one of positions 1. 2 or 3, position 1 being the most weighted towards producing low nurnber "rolls", position 3 being the least weighted towards producing low number "rolls" and position 2 being intermediately weighted between positions 1 and 3.

In position 1 the "upper value" is used as a counter rather than as a possible "roll". That is done by the "upper value" and "I.ower v.~lue" inil.ia~ly bein~
given the value "1". The recorded clock count is then compared to the upper and lower value. If the recorded clock count does not match that val~le then the upper value is increased by nlle. Such cornpar:isorl.s and increases contill-le unti.l the uppt?r value eq~ s ~.he selected number Or sides on tlle d:ie. Once ~.hat equality occurs the lower va:lue is increased hy one and Ihe upper value becomes the satlle as that new lower valllt!. The comparisons antl i.ncreases cnnt.irlue as in the init:ial r l~ ~l rl tl ~l tl tl~ t~.till~ il l ll r~ I tl w ~ l v ;l l ll (~
lS selected number of sides on tht? d.ie. nnct? that equalil.Y
o(:curs the upl-er arlrl lower vallles art? a,o~aill se~ a~ "I"
and the process continue~s urltil. the recolded clock count matches either the upper val.ue or the lower value.

:

C~ t3 ~ ~L

The "rolls" at settin~,s "2" and "3" are obtained by examining the lower time register of the internal clock of the microprocessor 19. The lower time register of the microprocessor 19 has 8 bits in it and so can have 256 (i.e. 2 to the exponent 8) different values, from 1 to 256. The number 170 is approximately 2/3 of 256.
If the value on the lower time register is greater than 170 then the si~ulated roll is arrived at by the procedure used at setting 4. Therefore if the device 10 is set to position 2 of the probability weighting dial 15 then two thirds of the generated numbers will be arrived at by the procedure used at setting I ("Luck 1"
in Figure 4a) and one third of the generated numhers will be arrived at by the procedure used at setting 4 ("Lùck 4" in Figùre 4a). Conversely if the device is set to position 3 then the respective ~splits are 1/3 and 2/3 rather than 213 and 1/3.

Settings 5 to 7 of the probahility weighting dial 15 weight the device towards prodtl(ing high "rnlls".
They do so in a manner analogous to the weighting provided by settings 1~ 2 and 3 i.e. by using the upper value as a counter. However. at setting 7 of the dial 15 the upper and lower values are not initially set at 1 ~3~

but rather at the value that is the number of sides of the die. The iterations result in the upper vfllue being decreased by one each time, until it equals zero; the lower value is then reduced by one and the lower value becomes the new upper value. Such iterations occur until the lower value equals zero. Upon that event the upper and lower values are reset to the value that is the number of sides on the die and the comparisnns and iterations start over.

The "rolls" at set tings "5" and "6" are obtained by examining the lower time register of the internal clock of the microprocessor 19. When the value in the lower titne register is less tllan or equal to 170 the roll will be simulated in accordfltlce with tlle procedure a~ ~sett ing "4". Whell the value in the lower time register is greater than 170 the roll will be simuluted in accordance with the procedllre at settin~ "7".
Therefore, if the device lO is set to position S of ~.he probability weighting tlial 15 thell two thilds of tht?
generated numbers wil I be ,Irrived at by the procedure used at setting 4 and one thi r~l of the gcnel ated numht?rs will be arrived at by ~he procedure used at setting 7.
Oonversely, if the device is Sl?t tt) po.sition 6 tht?n tlle .

~t~3~

respective splits are 1/3 and 2/3 rather than 2/3 and 1/3.

As the "rolls" for each die are produced they are summed. The device then converts the sum to the base 10 system and displays on screens 13 and 14 the final sum of the individual die rolls comprising that simulation.

After 10 seconds of display of the simulation result the device is re-initialized and enters a low power mode to conserve the power supply 30. It remains in that mode until a key on the key pad 22 is pressed.
If the key is the "=" button 17. the device generates and displays a simulation~ using the same variables (i.e. number of die, number of sides per die and probability weighting) as in the previous roll as many times as that button is pressed, until the device is turned off. If before pressing the "=" button 17 the position of the diat 15 is changed no other variables~
by that act alone, are chan~ed. If before pressin~ the "=" button 17 one or more of the numerical key pad buttons 12a-12~ are pressed the device generates and displays a simulation based on the previously set number '~

of sides per die and probabilitv weighting and on the newly set number of die.

.

Claims

THE EMBODIMENT OF THE INVENTION IN WHICH AN EXCLUSIVE
PROPERTY OR PRIVILEGE ARE CLAIMED ARE DEFINED AS
FOLLOWS:
1. Apparatus for simulating dice rolling or the like, comprising:
first data entry means for entering numerical selection data;
microprocessor means for processing said numerical selection data and computing, in a predetermined, quasi-random manner, results corresponding to the selected numerical data; and second data entry means for entering probability weighting criteria to bias said computing in a predetermined quasi-random manner and cause the processing of the numerical selector data to yield simulation results in accord with said probability weighting criteria.
CA002036119A 1991-02-11 1991-02-11 Dice simulator Abandoned CA2036119A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CA002036119A CA2036119A1 (en) 1991-02-11 1991-02-11 Dice simulator
US07/692,383 US5238249A (en) 1991-02-11 1991-04-29 Dice simulator
GB9202548A GB2252918A (en) 1991-02-11 1992-02-06 Dice simulator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CA002036119A CA2036119A1 (en) 1991-02-11 1991-02-11 Dice simulator

Publications (1)

Publication Number Publication Date
CA2036119A1 true CA2036119A1 (en) 1992-08-12

Family

ID=4146979

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002036119A Abandoned CA2036119A1 (en) 1991-02-11 1991-02-11 Dice simulator

Country Status (3)

Country Link
US (1) US5238249A (en)
CA (1) CA2036119A1 (en)
GB (1) GB2252918A (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2288547A (en) * 1994-04-16 1995-10-25 Martin Clive Andrew Dice simulator
US5662330A (en) * 1996-11-25 1997-09-02 Spears; Richard L. High low dice gambling system and method therefor
US6884166B2 (en) * 2001-07-13 2005-04-26 Gameaccount Limited System and method for establishing a wager for a gaming application
EP1406709A2 (en) * 2001-07-13 2004-04-14 Gameaccount Limited System and method for adding a skill aspect to games of chance
US20030176221A1 (en) * 2002-03-12 2003-09-18 Chung Andrew B. Generalized electronic game tool for board and parlor games
US7017905B2 (en) 2002-08-24 2006-03-28 Blinky Bones, Inc. Electronic die
US7334791B2 (en) * 2002-08-24 2008-02-26 Blinky Bones, Inc. Electronic die
JP4580742B2 (en) * 2004-11-30 2010-11-17 任天堂株式会社 GAME PROGRAM AND GAME DEVICE
US8342966B2 (en) 2008-10-24 2013-01-01 Cfph, Llc Wager market creation and management
US9005016B2 (en) 2008-10-24 2015-04-14 Lee Amaitis Wagering on event outcomes during the event
US8342946B2 (en) 2008-10-24 2013-01-01 Bgc Partners, Inc. Computer graphics processing and display of selectable items

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3856310A (en) * 1974-01-08 1974-12-24 K Sniderman Electrical circuit having an odds selector for a game of chance
AU8101782A (en) * 1981-03-18 1982-09-23 Yoel Gat Electronic game apparatus
US4431189A (en) * 1981-12-30 1984-02-14 Wiencek Donald C Multi-side selection of an electronically simulated die
US4858122A (en) * 1984-09-28 1989-08-15 William Kreisner Random lottery computer
CA1240058A (en) * 1985-03-12 1988-08-02 Alex P. Moosz Electronic apparatus for generating sets of numerical values for playing lottery games
US4819818A (en) * 1987-05-08 1989-04-11 John J. Simkus Random number generator
JPH01259888A (en) * 1987-10-05 1989-10-17 Fuji Denshi Kogyo Kk Automatic game machine using dice
GB8915260D0 (en) * 1989-07-03 1989-08-23 Havard Gwyn An electronic aid to game playing

Also Published As

Publication number Publication date
GB2252918A (en) 1992-08-26
US5238249A (en) 1993-08-24
GB9202548D0 (en) 1992-03-25

Similar Documents

Publication Publication Date Title
CA2036119A1 (en) Dice simulator
CA1215473A (en) Computer apparatus and remote keyboards therefor
GB1605262A (en) Representing the position of a reference pattern in a pattern field
DE69124170D1 (en) Automatic test equipment system using a stylus architecture
CA2192296A1 (en) Computer system for playing competing type game with specific characteristic movable data
Williams et al. Partition correlation matrices for heterogeneous quantitative data
GB1411770A (en) Variable frequency dividing circuit
SE7614128L (en) LEAF REGISTERS WITH SELECTOR DEVICE
US4460974A (en) Electronic computer with access to keyboard status information
Kachel et al. A new flow cytometric pulse height analyzer offering microprocessor controlled data acquisition and statistical analysis
Fletcher Possible interpretive problems in analyses using group means as the experimental unit.
US6557852B1 (en) Cubic sexenary (base 6) dice for generating radom numbers from a predetermined set
Wilcox How do examinees behave when taking multiple-choice tests?
Trinh et al. Temporal difference learning in Chinese Chess
US4470037A (en) Input device for electronic apparatus
Van der Spiegel et al. Large scale analog neural computer with programmable architecture and programmable time constants for temporal pattern analysis
Staugas A rapid method for scoring tests punched in IBM cards
Bendig Reliability of and intercorrelations between Cattell's IPAT anxiety and neuroticism scales
Kunte Statistical computing: 1. Understanding randomness and random numbers
JPS5671162A (en) Device test system
Erman Chess and backgammon
Dakshinamurthy et al. An Embedded Controller based Electronic Snakes and Ladders Board
Weisstein Game of life
JPH0639350Y2 (en) IC test equipment
SU830503A1 (en) Pupil examining device

Legal Events

Date Code Title Description
FZDE Dead