Prev: 38383 Up: Map Next: 38508
38412: Girl Artificial Intelligence
Used by the routine at PlayGame.
A reminder of the hand types and values:
Byte Outcome
1 High Card
2 Pair
3 Two Pairs
4 Three-Of-A-Kind
5 Straight
6 Flush
7 Full House
8 Four-Of-A-Kind
9 Straight Flush
Prepare how many times to call the random number generator.
GirlArtificialIntelligence 38412 LD A,(38592) Fetch the girls hand type from *Table_GirlEvaluation and store it in C as the "try" counter.
38415 LD C,A
38416 CP 2 Jump to GirlAI_SetHoldTries if the hand "type" is lower than, or equal to 2 ("Pair" or "High Card").
38418 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".
38420 RL C Multiply C by two.
38422 CP 4 Jump to GirlAI_SetRaiseTries if the hand "type" is lower than, or equal to 4 ("Two Pairs" or "Three-Of-A-Kind").
38424 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".
38426 RL C Multiply C by two.
Set a number of "tries" to pick a random number under 14.
GirlAI_SetRaiseTries 38428 LD B,C Set a counter in B which is just the value copied from C.
GirlAI_SetRaiseTries_Loop 38429 CALL GetRandomNumber Call GetRandomNumber.
38432 CP 14 Jump to GirlAI_Raise if A is lower than 14.
38434 JR C,GirlAI_Raise
38436 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 30.
GirlAI_SetHoldTries 38438 LD B,C Set a counter in B which is just the value copied from C.
GirlAI_SetHoldTries_Loop 38439 CALL GetRandomNumber Call GetRandomNumber.
38442 CP 30 Jump to GirlAction_Hold if A is lower than 30.
38444 JR C,GirlAction_Hold
38446 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
1 message-01-00 2 message-01-01
3 message-01-02 4 message-01-03
5 message-01-04
38448 LD A,1 Call Messaging_Girl using message block 1.
38450 CALL Messaging_Girl
38453 XOR A Return with A=0 ("drop").
38454 RET
Handle the girl choosing to raise.
GirlAI_Raise 38455 LD A,(36441) Jump to GirlAction_Hold if *InteractionCounter is equal to 7.
38458 CP 7
38460 JR Z,GirlAction_Hold
38462 LD A,(38583) A=*CurrentRaiseValue.
38465 CALL GirlAddToPot Call GirlAddToPot.
GirlAI_Raise_Loop 38468 CALL GetRandomNumber Call GetRandomNumber.
38471 SRA A Divide the random number by 2 and subtract 6.
38473 SUB 6
38475 JR C,GirlAI_Raise_Loop Jump to GirlAI_Raise_Loop and try again if the result is negative.
The raise value is 0 or higher.
38477 LD B,A Store the raise value in B.
38478 LD A,(38582) Jump to GirlAction_Raise if *GirlCash is higher than B.
38481 CP B
38482 JR NC,GirlAction_Raise
Handle if the raise value is higher than the girls current cash balance.
38484 OR A Does the girl have any cash left?
38485 LD B,A Store the girls current cash balance in B.
38486 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
1 message-03-00 2 message-03-01
3 message-03-02
GirlAI_Hold 38488 LD A,3 Call Messaging_Girl using message block 3.
38490 CALL Messaging_Girl
38493 LD A,(38583) D=*CurrentRaiseValue.
38496 LD D,A
38497 XOR A Write 0 to *CurrentRaiseValue.
38498 LD (38583),A
38501 LD A,D Return with A=2 ("hold") if D is not zero.
38502 OR A
38503 LD A,2
38505 RET NZ
38506 INC A Return with A=3 ("showdown").
38507 RET
Prev: 38383 Up: Map Next: 38508