Prev: 95EF Up: Map Next: 966C
960C: Girl Artificial Intelligence
Used by the routine at PlayGame.
A reminder of the hand types and values:
Byte Outcome
01 High Card
02 Pair
03 Two Pairs
04 Three-Of-A-Kind
05 Straight
06 Flush
07 Full House
08 Four-Of-A-Kind
09 Straight Flush
Prepare how many times to call the random number generator.
GirlArtificialIntelligence 960C LD A,($96C0) Fetch the girls hand type from *Table_GirlEvaluation and store it in C as the "try" counter.
960F LD C,A
9610 CP $02 Jump to GirlAI_SetHoldTries if the hand "type" is lower than, or equal to 02 ("Pair" or "High Card").
9612 JR C,GirlAI_SetHoldTries
Double the value in the "try" counter for outcomes: "Two Pairs", "Three-Of-A-Kind", "Straight", "Flush", "Full House", "Four-Of-A-Kind" and "Straight Flush".
9614 RL C Multiply C by two.
9616 CP $04 Jump to GirlAI_SetRaiseTries if the hand "type" is lower than, or equal to 04 ("Two Pairs" or "Three-Of-A-Kind").
9618 JR C,GirlAI_SetRaiseTries
Double the value again in the "try" counter for outcomes: "Straight", "Flush", "Full House", "Four-Of-A-Kind" and "Straight Flush".
961A RL C Multiply C by two.
Set a number of "tries" to pick a random number under 0E.
GirlAI_SetRaiseTries 961C LD B,C Set a counter in B which is just the value copied from C.
GirlAI_SetRaiseTries_Loop 961D CALL GetRandomNumber Call GetRandomNumber.
9620 CP $0E Jump to GirlAI_Raise if A is lower than 0E.
9622 JR C,GirlAI_Raise
9624 DJNZ GirlAI_SetRaiseTries_Loop Decrease counter by one and loop back to GirlAI_SetRaiseTries_Loop until counter is zero.
Set a number of "tries" to pick a random number under 1E.
GirlAI_SetHoldTries 9626 LD B,C Set a counter in B which is just the value copied from C.
GirlAI_SetHoldTries_Loop 9627 CALL GetRandomNumber Call GetRandomNumber.
962A CP $1E Jump to GirlAction_Hold if A is lower than 1E.
962C JR C,GirlAction_Hold
962E DJNZ GirlAI_SetHoldTries_Loop Decrease counter by one and loop back to GirlAI_SetHoldTries_Loop until counter is zero.
If we made it this far then the girl will just drop, if you're playing along here then YES, albeit fairly unlikely - there is still a slim chance that the girl will DROP even if she has a Royal Straight Flush!
Messaging options:
ID Message ID Message
01 message-01-00 02 message-01-01
03 message-01-02 04 message-01-03
05 message-01-04
9630 LD A,$01 Call Messaging_Girl using message block 01.
9632 CALL Messaging_Girl
9635 XOR A Return with A=00 ("drop").
9636 RET
Handle the girl choosing to raise.
GirlAI_Raise 9637 LD A,($8E59) Jump to GirlAction_Hold if *InteractionCounter is equal to 07.
963A CP $07
963C JR Z,GirlAction_Hold
963E LD A,($96B7) A=*CurrentRaiseValue.
9641 CALL GirlAddToPot Call GirlAddToPot.
GirlAI_Raise_Loop 9644 CALL GetRandomNumber Call GetRandomNumber.
9647 SRA A Divide the random number by 02 and subtract 06.
9649 SUB $06
964B JR C,GirlAI_Raise_Loop Jump to GirlAI_Raise_Loop and try again if the result is negative.
The raise value is 00 or higher.
964D LD B,A Store the raise value in B.
964E LD A,($96B6) Jump to GirlAction_Raise if *GirlCash is higher than B.
9651 CP B
9652 JR NC,GirlAction_Raise
Handle if the raise value is higher than the girls current cash balance.
9654 OR A Does the girl have any cash left?
9655 LD B,A Store the girls current cash balance in B.
9656 JR NZ,GirlAction_Raise Jump to GirlAction_Raise if the raise value is not zero.
Handle the girl choosing to hold.
Messaging options:
ID Message ID Message
01 message-03-00 02 message-03-01
03 message-03-02
GirlAI_Hold 9658 LD A,$03 Call Messaging_Girl using message block 03.
965A CALL Messaging_Girl
965D LD A,($96B7) D=*CurrentRaiseValue.
9660 LD D,A
9661 XOR A Write 00 to *CurrentRaiseValue.
9662 LD ($96B7),A
9665 LD A,D Return with A=02 ("hold") if D is not zero.
9666 OR A
9667 LD A,$02
9669 RET NZ
966A INC A Return with A=03 ("showdown").
966B RET
Prev: 95EF Up: Map Next: 966C