hp41programs

Template

Texas Hold'em Poker for the HP-41


Overview
 

1°)  A Long Program     
2°)  A Short Program
3°)  Texas Hold'em + One Arm Bandit
4°)  Even Shorter Programs

   a) Texas Hold'em
   b) Texas Hold'em + 1 Arm Bandit


Latest Update:    paragraph 4°)


-There are already 2 programs listed in "Poker for the HP41" to play Texas Hold'em Poker with your HP41.
-The routine that doesn't use M-Code is unfortunately very slow:

-To compute the values of the hands, the HP41 computes all the possible 5-card hands and keep the largest value.
-In the program below, the calculator directly checks the 7-card hands.
-It becomes much faster.

-Like in "Poker for the HP41", we use a deck of an infinite number of one-suit cards.
-In other words, the probability of each card is 1/13,
  and therefore, the order of the combinations is modified like this:
 
 

     combinations       probability   ranking
       high card           41%      0
         1 pair           46%      1
         2 pairs            7%      2
     3 of a kind           4.6%      3
       full house           0.4%      4
         straight*           0.3%      5
      4 of a kind           0.2%      6
      5 of a kind         0.004%      7
 
   
*Here, a straight is always a straight-flush !
  The lowest one is 2345A and the highest one is TJQKA
 

1°) A Long Program



Data Registers:           •  R00 = r = random number                  ( Registers R00 & R41 are to be initialized before  executing "TXEM" )

                                      •  R41 =  Your Cash                              R01 to R49: temp                                       
Flag:   F10
Subroutines: /


-Lines  118-133-184-224-444-447-450-745  are three-byte GTOs


01 LBL "TXEM"
02 37
03 STO 49              
04 13
05 STO 14
06 27
07 STO 15
08 26
09 "A"
10 ASTO 39
11 34
12 "K"
13 ASTO 38
14 17.001005
15 STO 45
16 SIGN
17 "Q"
18 ASTO 37
19 9
20 "J"
21 ASTO 36
22 "T"
23 ASTO 35
24 "/"
25 LBL 00
26 STO IND Z
27 R^
28 XTOA
29 ASTO IND X
30 RDN
31 DSE T
32 DSE Z
33 DSE X
34 X>Y?
35 GTO 00
36 LBL 10
37 FIX 00
38 CF 29
39 2
40 STO 13
41 26
42 STO 03
43 48
44 STO 04
45  E3
46 STO 16
47 " "
48 ASTO 22
49 LBL 07
50 CLA
51 ARCL 22
52 XEQ 04
53 STO IND 04
54 ARCL IND X
55 ASTO 22
56 XEQ 04
57 STO IND 13
58 ARCL IND 03
59 AVIEW
60 DSE 03
61 DSE 04
62 DSE 13
63 GTO 07
64 SF 10
65 3
66 STO 24
67 RCL 01
68 STO 43
69 RCL 02
70 STO 44
71 17.021
72 STO 01
73 LBL 08
74 XEQ 04
75 STO IND 01
76 ISG 01
77 GTO 08
78 "/"
79 ARCL IND 17
80 ARCL IND 18
81 ARCL IND 19
82 ASTO 23
83 " FLOP..."
84 AVIEW
85 RCL 45
86 REGMOVE
87 RCL 43
88 STO 04
89 RCL 44
90 STO 05
91 CLX
92 STO 07
93 SIGN
94 STO 06
95 XEQ 01
96 STO 40
97 CLA
98 ARCL 22
99 ARCL 23
100 ARCL 25
101 RCL 00
102 R-D
103 FRC
104 STO 00
105 X^2
106 SIGN
107 LASTX
108 -
109 SQRT
110 1/X
111 STO 42
112 CLX
113 LBL 09
114 AVIEW
115 GETKEY
116 44
117 X=Y?
118 GTO 11
119 X<> Z
120 ST+ 16
121 X<>Y
122 41
123 X=Y?
124 GTO 12
125 LN
126 *
127 X^2
128 RCL 16
129 +
130 RCL 40
131 X<>Y
132 X>Y?
133 GTO 05
134 STO 16             
135 X<>Y
136 3
137 /
138 X<Y?
139 GTO 12
140 *
141 SQRT
142 RCL 00
143 R-D
144 FRC
145 STO 00
146 *
147 "  +"
148 ARCL X
149 GTO 09
150 LBL 12
151 DSE 24
152 X=0?
153 GTO 06
154 " RIVER..."
155 FS? 10
156 " TURN..."
157 AVIEW
158 RCL 45
159 REGMOVE
160 RCL 43
161 STO 06
162 RCL 44
163 STO 07
164 CLX
165 FS? 10
166 STO 05
167 XEQ 01
168 STO 46
169 RCL 42
170 *
171 STO 40
172 CLA
173 ARCL 23
174 FS? 10
175 ARCL IND 20
176 FC?C 10
177 ARCL IND 21
178 ASTO 23
179 CLA
180 ARCL 22
181 ARCL 23
182 ARCL 25
183 CLX
184 GTO 09
185 LBL 06
186 "/"
187 ARCL IND 43
188 ARCL IND 44
189 ASTO 24
190 CLA
191 ARCL 22
192 ARCL 23
193 ARCL 24
194 ATOX
195 AVIEW
196 RCL 45
197 REGMOVE
198 RCL 47
199 STO 06
200 RCL 48
201 STO 07
202 XEQ 01
203 RCL 46
204 X<>Y
205 -
206 LBL 11
207 CHS
208 LBL 05
209 X#0?
210 SIGN
211 RCL 16
212 *
213 ST+ 41
214 RCL 41
215 " C= "
216 X>0?
217 >"+"
218 ARCL 41
219 >" $"
220 FIX 04
221 SF 29
222 AVIEW
223 STOP
224 GTO 10
225 LBL 04
226 RCL 00
227 R-D
228 RCL 14
229 MOD
230 STO 00
231 INT
232 RCL 15
233 +
234 RTN
235 LBL 01
236 RCL 01
237 RCL 02
238 X>Y?
239 X<>Y
240 RCL 03
241 X>Y?
242 X<>Y
243 RCL 04
244 X<Y?
245 X<>Y
246 X<> 05
247 X<Y?
248 X<>Y
249 X<> 06
250 X<Y?
251 X<>Y
252 X<> 07
253 X>Y?
254 X<>Y
255 X<> 07
256 X>Y?
257 X<>Y
258 R^
259 X>Y?
260 X<>Y
261 R^
262 X<Y?
263 X<>Y
264 X<> 05
265 X<Y?
266 X<>Y
267 X<> 06
268 X>Y?
269 X<>Y
270 X<> 06
271 X>Y?
272 X<>Y
273 R^
274 X>Y?
275 X<>Y
276 R^
277 X<Y?
278 X<>Y
279 X<> 05
280 X>Y?
281 X<>Y
282 X<> 05
283 X>Y?
284 X<>Y
285 R^
286 X>Y?
287 X<>Y
288 RDN
289 X>Y?
290 X<>Y
291 RDN
292 X<Y?
293 X<>Y
294 STO 01             
295 RDN
296 X>Y?
297 X<>Y
298 STO 04
299 RDN
300 X>Y?
301 X<>Y
302 STO 03
303 X<>Y
304 STO 02
305 4
306 STO 08
307 CLX
308 STO 10
309 STO 11
310 STO 12
311 STO 13
312 XEQ 01
313 STO 09
314 CLA
315 SIGN
316 RCL 01
317 RCL 02
318 -
319 X=Y?
320 ST+ M
321 X<> L
322 RCL 03
323 -
324 X=Y?
325 ST+ M
326 X>Y?
327 CLA
328 X<> L
329 RCL 04
330 -
331 X=Y?
332 ST+ M
333 X>Y?
334 CLA
335 X<> L
336 RCL 05
337 -
338 X=Y?
339 ST+ M
340 X>Y?
341 CLA
342 RCL M
343 4
344 X=Y?
345 GTO 03
346 DSE X
347 X#Y?
348 GTO 02
349 RCL 05
350 RCL 15
351 X=Y?
352 GTO 06
353 LBL 02
354 SIGN
355 RCL 05
356 RCL 06
357 -
358 X=Y?
359 ST+ M
360 X>Y?
361 CLA
362 RCL M
363 4
364 X=Y?
365 GTO 04
366 DSE X
367 X#Y?
368 GTO 02
369 RCL 06
370 RCL 15
371 X=Y?
372 GTO 06
373 LBL 02
374 SIGN
375 RCL 06
376 RCL 07
377 -
378 X=Y?
379 ST+ M
380 X>Y?
381 CLA
382 RCL M
383 4
384 X=Y?
385 GTO 05
386 DSE X
387 X#Y?
388 GTO 12
389 RCL 07
390 RCL 15
391 X=Y?
392 GTO 06
393 GTO 12
394 LBL 03
395 RCL 05
396 GTO 02
397 LBL 04
398 RCL 06
399 GTO 02
400 LBL 05
401 RCL 07
402 GTO 02
403 LBL 06
404 RCL 01
405 39
406 X#Y?
407 GTO 12
408 26
409 LBL 02
410 STO 09
411 STO 10
412 STO 11
413 STO 12
414 STO 13
415 5
416 STO 08
417 LBL 12
418 RCL 09
419 RCL 08
420 RCL 49
421 STO T
422 *
423 +
424 *
425 RCL 10             
426 +
427 *
428 RCL 11
429 +
430 *
431 RCL 12
432 +
433 *
434 RCL 13
435 +
436  E6
437 /
438 X^2
439 RTN
440 LBL 01
441 RCL 01
442 RCL 02
443 X=Y?
444 GTO 06
445 RCL 03
446 X=Y?
447 GTO 05
448 RCL 04
449 X=Y?
450 GTO 04
451 RCL 05
452 X=Y?
453 GTO 03
454 RCL 06
455 X=Y?
456 GTO 02
457 RCL 07
458 X=Y?
459 GTO 01
460 CLX
461 STO 08
462 RCL 02
463 STO 10
464 RCL 03
465 STO 11
466 RCL 04
467 STO 12
468 RCL 05
469 STO 13
470 RCL 01
471 RTN
472 LBL 01
473 SIGN
474 STO 08
475 RCL 01
476 STO 10
477 RCL 02
478 STO 11
479 RCL 03
480 STO 12
481 LASTX
482 RTN
483 LBL 02
484 RCL 07
485 X=Y?
486 GTO 01
487 SIGN
488 STO 08
489 RCL 01
490 STO 10
491 RCL 02
492 STO 11
493 RCL 03
494 STO 12
495 RCL 05
496 RTN
497 LBL 01
498 DSE 08
499 RCL 01
500 STO 10
501 RCL 02
502 STO 11
503 RCL 06
504 RTN
505 LBL 03
506 RCL 06
507 X=Y?
508 GTO 02
509 RCL 07
510 X=Y?
511 GTO 01
512 SIGN
513 STO 08
514 RCL 01
515 STO 10
516 RCL 02
517 STO 11
518 RCL 03
519 STO 12
520 RCL 04
521 RTN
522 LBL 01
523 STO 10
524 RCL 01
525 STO 11
526 2
527 STO 08
528 RCL 04
529 RTN
530 LBL 02
531 RCL 07
532 X=Y?
533 GTO 01
534 DSE 08
535 RCL 01
536 STO 10
537 RCL 02
538 STO 11
539 RCL 04
540 RTN
541 LBL 01
542 6
543 STO 08
544 RCL 01
545 STO 10
546 RCL 04
547 RTN
548 LBL 04
549 RCL 05
550 X=Y?
551 GTO 03
552 RCL 06
553 X=Y?
554 GTO 02
555 RCL 07             
556 X=Y?
557 GTO 01
558 SIGN
559 STO 08
560 RCL 01
561 STO 10
562 RCL 02
563 STO 11
564 RCL 05
565 STO 12
566 RCL 03
567 RTN
568 LBL 01
569 STO 10
570 RCL 01
571 STO 11
572 2
573 STO 08
574 RCL 03
575 RTN
576 LBL 02
577 RCL 07
578 X=Y?
579 GTO 01
580 2
581 STO 08
582 RCL 05
583 STO 10
584 RCL 01
585 STO 11
586 RCL 03
587 RTN
588 LBL 01
589 RCL 03
590 STO 10
591 X<>Y
592 RTN
593 LBL 03
594 RCL 06
595 X=Y?
596 GTO 02
597 RCL 07
598 X=Y?
599 GTO 01
600 DSE 08
601 RCL 01
602 STO 10
603 RCL 02
604 STO 11
605 RCL 03
606 RTN
607 LBL 01
608 STO 10
609 RCL 03
610 RTN
611 LBL 02
612 RCL 07
613 X=Y?
614 GTO 01
615 6
616 STO 08
617 RCL 01
618 STO 10
619 RCL 03
620 RTN
621 LBL 01
622 7
623 STO 08
624 X<>Y
625 RTN
626 LBL 05
627 RCL 04
628 X=Y?
629 GTO 04
630 RCL 05
631 X=Y?
632 GTO 03
633 RCL 06
634 X=Y?
635 GTO 02
636 RCL 07
637 X=Y?
638 GTO 01
639 SIGN
640 STO 08
641 RCL 01
642 STO 10
643 RCL 04
644 STO 11
645 RCL 05
646 STO 12
647 RCL 02
648 RTN
649 LBL 01
650 STO 10
651 2
652 STO 08
653 RCL 01
654 STO 11
655 RCL 02
656 RTN
657 LBL 02
658 RCL 07
659 X=Y?
660 GTO 01
661 X<>Y
662 STO 10
663 RCL 01
664 STO 11
665 2
666 STO 08
667 RCL 02
668 RTN
669 LBL 01
670 RCL 02
671 STO 10
672 X<>Y
673 RTN
674 LBL 03
675 RCL 06
676 X=Y?
677 GTO 01
678 2
679 STO 08
680 RCL 04
681 STO 10
682 RCL 01
683 STO 11
684 RCL 02
685 RTN
686 LBL 01
687 RCL 07             
688 X=Y?
689 GTO 01
690 RCL 02
691 STO 10
692 RCL 04
693 RTN
694 LBL 01
695 6
696 STO 08
697 RCL 01
698 STO 10
699 RCL 04
700 RTN
701 LBL 04
702 RCL 05
703 X=Y?
704 GTO 03
705 RCL 06
706 X=Y?
707 GTO 02
708 RCL 07
709 X=Y?
710 GTO 01
711 DSE 08
712 RCL 01
713 STO 10
714 RCL 05
715 STO 11
716 RCL 02
717 RTN
718 LBL 01
719 STO 10
720 RCL 02
721 RTN
722 LBL 02
723 RCL 05
724 STO 10
725 RCL 02
726 RTN
727 LBL 03
728 RCL 06
729 X=Y?
730 GTO 01
731 6
732 STO 08
733 RCL 01
734 STO 10
735 RCL 02
736 RTN
737 LBL 01
738 7
739 STO 08
740 X<>Y
741 RTN
742 LBL 06
743 RCL 03
744 X=Y?
745 GTO 05
746 RCL 04
747 X=Y?
748 GTO 04
749 RCL 05
750 X=Y?
751 GTO 03
752 RCL 06
753 X=Y?
754 GTO 02
755 RCL 07
756 X=Y?
757 GTO 01
758 SIGN
759 STO 08
760 RCL 03
761 STO 10
762 RCL 04
763 STO 11
764 RCL 05
765 STO 12
766 RCL 01
767 RTN
768 LBL 01
769 STO 10
770 RCL 03
771 STO 11
772 2
773 STO 08
774 RCL 01
775 RTN
776 LBL 02
777 RCL 07
778 X=Y?
779 GTO 01
780 2
781 STO 08
782 RCL 03
783 STO 11
784 RCL 05
785 STO 10
786 RCL 01
787 RTN
788 LBL 01
789 RCL 01
790 STO 10
791 X<>Y
792 RTN
793 LBL 03
794 RCL 06
795 X=Y?
796 GTO 01
797 2
798 STO 08
799 RCL 03
800 STO 11
801 RCL 04
802 STO 10
803 RCL 01
804 RTN
805 LBL 01
806 RCL 07
807 X=Y?
808 GTO 01
809 RCL 01
810 STO 10
811 RCL 04
812 RTN
813 LBL 01
814 6
815 STO 08
816 RCL 01
817 STO 10
818 RCL 04             
819 RTN
820 LBL 04
821 RCL 05
822 X=Y?
823 GTO 03
824 RCL 06
825 X#Y?
826 GTO 01
827 RCL 07
828 X=Y?
829 GTO 02
830 LBL 01
831 2
832 STO 08
833 RCL 03
834 STO 10
835 RCL 05
836 STO 11
837 RCL 01
838 RTN
839 LBL 02
840 RCL 03
841 STO 10
842 X<>Y
843 RTN
844 LBL 03
845 RCL 06
846 X=Y?
847 GTO 01
848 RCL 01
849 STO 10
850 RCL 03
851 RTN
852 LBL 01
853 RCL 07
854 X=Y?
855 GTO 01
856 6
857 STO 08
858 RCL 01
859 STO 10
860 RCL 03
861 RTN
862 LBL 01
863 7
864 STO 08
865 X<>Y
866 RTN
867 LBL 05
868 RCL 04
869 X=Y?
870 GTO 04
871 RCL 05
872 X=Y?
873 GTO 03
874 RCL 06
875 X=Y?
876 GTO 01
877 RCL 07
878 X=Y?
879 GTO 01
880 DSE 08
881 RCL 04
882 STO 10
883 RCL 05
884 STO 11
885 RCL 01
886 RTN
887 LBL 01
888 STO 10
889 RCL 01
890 RTN
891 LBL 03
892 RCL 06
893 X#Y?
894 GTO 01
895 RCL 07
896 X=Y?
897 GTO 02
898 LBL 01
899 RCL 04
900 STO 10
901 RCL 01
902 RTN
903 LBL 02
904 6
905 STO 08
906 RCL 01
907 STO 10
908 RCL 04
909 RTN
910 LBL 04
911 RCL 05
912 X=Y?
913 GTO 01
914 6
915 STO 08
916 RCL 05
917 STO 10
918 RCL 01
919 RTN
920 LBL 01
921 7
922 STO 08
923 X<>Y
924 END

 
           ( 1219 bytes / SIZE 050 )


           STACK            INPUT          OUTPUT
               X                /            Cash


Example:
 

- Initialize the random seed, say  3  STO 00  and your cash  40000 $  STO 41

   1000 $  are automatically placed in the pot ( lines 45-46 )

  •   XEQ "TXEM"   the HP-41 successively displays:

        " 4/¤"
        " 49/¤¤"
        " FLOP. . ."
        " 49/45Q/¤¤"          and stops: the 1st round of betting may start. If you press  [B]  ( about 1986 $ ):

  •   [B]   the HP-41 makes a higher bid and displays   +374   If you are in, simply press   ENTER

   ( Press the backarrow key to fold, or another key to make another higher bid )

        " TURN. . ."          and 6 seconds later
        " 49/45Q4/¤¤"      If you press  [C]  ( about 2330 $ ):

  •  [C]   the HP-41 displays   +8079      if you match the HP-41's bet,  press  ENTER

        " RIVER. . ."          and 6 seconds later
        " 49/45Q4T/¤¤"     if you press  [C]  again

  •  [C]  the HP-41  displays    49/45Q4T/JJ  

     The calculator computes the maximum value of your possible hands and finally displays your cash

      C=+56100 $       ( after 6 seconds )

  •  Simply press R/S to continue the game.

Notes:

-There is no round of bettings before the "flop"
-If you want to add this option, add for example:

    FS?C 09   GTO 14  ( 3-byte GTO )                                                                       after line 150
    LBL 12                                                                                                                   after line 114
    RCL 00  FRC  3E3  ST* Y  ST+ X  +  STO 40  SF 09  CLX  GTO 12  LBL 14   after line 70
    SIGN  STO 42                                                                                                       after line 46

-At this step, the HP41 bets are calculated at random.
-If you want to take the HP41 cards into account, they are in registers R01 & R02.


-In this version, you have to wait during about 6 seconds instead of 34 seconds !
-Even the program using M-code routines listed in "Poker for the HP41" is slightly slower.

-On the other hand, it uses much more bytes...


2°) A Short Program


-The version below calculates the values of the HP41 hands, avoiding the straights !
-And it does not compute the player hands.

>>> So you have to decide who wins !

 

Data Registers:           •  R00 = r = random number                 ( Registers R00 & R10 are to be initialized before executing "TXEM" )

                                      •  R10 =  Your Cash                             R01 to R39: temp                                   
Flag:   F10
Subroutines: /
 
 
-Lines 109-124-176-216  are three-byte  GTOs

 

01 LBL "TXEM"
02 13
03 STO 11           
04 27
05 STO 12
06 26
07 "A"
08 ASTO 39
09 34
10 "K"
11 ASTO 38
12 17.001005
13 STO 09
14 SIGN
15 "Q"
16 ASTO 37
17 9
18 "J"
19 ASTO 36
20 "T"
21 ASTO 35
22 "/"
23 LBL 00
24 STO IND Z
25 R^
26 XTOA
27 ASTO IND X
28 RDN
29 DSE T
30 DSE Z
31 DSE X
32 X>Y?
33 GTO 00
34 LBL 10
35 FIX 0
36 CF 29
37 2
38 STO 13
39 26
40 STO 03
41  E3
42 STO 08           
43 " "
44 ASTO 22
45 LBL 01
46 CLA
47 ARCL 22
48 XEQ 04
49 ARCL IND X
50 ASTO 22
51 XEQ 04
52 STO IND 13
53 ARCL IND 03
54 AVIEW
55 DSE 03
56 DSE 13
57 GTO 01
58 SF 10
59 3
60 STO 24
61 RCL 01
62 STO 13
63 RCL 02
64 STO 14
65 17.021
66 STO 01
67 LBL 02
68 XEQ 04
69 STO IND 01
70 ISG 01
71 GTO 02
72 "/"
73 ARCL IND 17
74 ARCL IND 18
75 ARCL IND 19
76 ASTO 23
77 " FLOP..."
78 AVIEW
79 RCL 09
80 REGMOVE
81 RCL 13
82 STO 04
83 RCL 14           
84 STO 05
85 5
86 XEQ 14
87 STO 16
88 CLA
89 ARCL 22
90 ARCL 23
91 ARCL 25
92 RCL 00
93 R-D
94 FRC
95 STO 00
96 X^2
97 SIGN
98 LASTX
99 -
100 SQRT
101 1/X
102 STO 15
103 CLX
104 LBL 03
105 AVIEW
106 GETKEY
107 44
108 X=Y?
109 GTO 07
110 X<> Z
111 ST+ 08
112 X<>Y
113 41
114 X=Y?
115 GTO 09
116 LN
117 *
118 X^2
119 RCL 08          
120 +
121 RCL 16
122 X<>Y
123 X>Y?
124 GTO 06
125 STO 08
126 X<>Y
127 3
128 /
129 X<Y?
130 GTO 09
131 *
132 SQRT
133 RCL 00
134 R-D
135 FRC
136 STO 00
137 *
138 " +"
139 ARCL X
140 GTO 03
141 LBL 09
142 DSE 24
143 X=0?
144 GTO 08
145 " RIVER..."
146 FS? 10
147 " TURN..."
148 AVIEW
149 RCL 09
150 REGMOVE
151 RCL 13
152 STO 06
153 RCL 14           
154 STO 07
155 FS? 10
156 STO 05
157 7
158 FS? 10
159 6
160 XEQ 14
161 RCL 15
162 *
163 STO 16
164 CLA
165 ARCL 23
166 FS? 10
167 ARCL IND 20
168 FC?C 10
169 ARCL IND 21
170 ASTO 23
171 CLA
172 ARCL 22
173 ARCL 23
174 ARCL 25
175 CLX
176 GTO 03
177 LBL 08
178 "/"
179 ARCL IND 13
180 ARCL IND 14
181 ASTO 24
182 CLA
183 ARCL 22
184 ARCL 23
185 ARCL 24
186 ATOX
187 AVIEW
188 41
189 GETKEYX
190 CLX
191 61
192 X=Y?
193 GTO 06
194 CLX
195 51
196 X#Y?
197 CLX
198 LBL 07
199 CHS
200 LBL 06
201 X#0?
202 SIGN
203 RCL 08           
204 *
205 ST+ 10
206 RCL 10
207 " C="
208 X>0?
209 >"+"
210 ARCL 10
211 >" $"
212 FIX 4
213 SF 29
214 AVIEW
215 STOP
216 GTO 10
217 LBL 04
218 RCL 00
219 R-D
220 RCL 11
221 MOD
222 STO 00
223 INT
224 RCL 12           
225 +
226 RTN
227 LBL 14           
228  E-3
229 +
230 SIGN
231 CLX
232 LBL 12
233 LASTX
234 INT
235 RCL IND L
236 DSE Y
237 LBL 13
238 X=NN?
239 ISG Z
240 TEXT0
241 DSE Y
242 GTO 13
243 X<> Z
244 DSE L
245 GTO 12
246 4
247 +
248 RCL 12
249 *
250 X^2
251 RTN
252 END

 
         ( 432 bytes / SIZE 040 )

  

           STACK            INPUT          OUTPUT
               X                /            Cash


Notes:

-At the showdown,  compare the values of the possible hands ( you have 41 seconds to do that - line 188 )
-Press  +   if you win  ( line 191 )  or  -   if the HP41 wins  ( line 195 )

-Press any other key if none wins.


-You have to wait about  4 , 5  &  7  seconds after the FLOP  ,  TURN  &  RIVER  respectively.


3°)  Texas Hold'em + One Arm Bandit


Data Registers:           •  R00 = r = random number                  ( Registers R00 & R41 are to be initialized before  executing "TXEM" )

                                      •  R41 =  Your Cash                              R01 to R49: temp                                       

Flag:   F10-F07     CF 07 = Texas Hold'em
                                SF 07 = 1 Arm Bandit

Subroutines:   "V"  if CF 07
                         "W" if SF 07


-Lines  39-120-201-216-267-306  are three-byte GTOs

 01 LBL "TXEM"
 02 4 E-6
 03 STO 49
 04 13
 05 STO 14          
 06 27
 07 STO 15
 08 26
 09 "A"
 10 ASTO 39
 11 34
 12 "K"
 13 ASTO 38
 14 17.001005
 15 STO 45
 16 SIGN
 17 "Q"
 18 ASTO 37
 19 9
 20 "J"
 21 ASTO 36
 22 "T"
 23 ASTO 35
 24 "/"
 25 LBL 16
 26 STO IND Z
 27 R^
 28 XTOA
 29 ASTO IND X
 30 RDN
 31 DSE T
 32 DSE Z
 33 DSE X
 34 X>Y?
 35 GTO 16
 36 LBL 10
 37 FIX 0
 38 FC? 07
 39 GTO 10
 40 " "
 41 ASTO 08
 42 5
 43 LBL 00
 44 CLA
 45 ARCL 08
 46 XEQ 04
 47 STO IND Y
 48 ARCL IND X
 49 ASTO 08
 50 X<>Y
 51 AVIEW
 52 DSE X
 53 GTO 00
 54 LBL 13
 55 54
 56 GETKEYX
 57 X=0?
 58 GTO 06
 59 LASTX
 60 -
 61 CLRGX
 62 GTO 13
 63 LBL 06
 64 " "
 65 5
 66 LBL 14
 67 RCL IND X
 68 X#0?
 69 ARCL IND X
 70 X<>Y
 71 DSE X
 72 GTO 14
 73 AVIEW
 74 5
 75 LBL 17
 76 RCL IND X
 77 X#0?
 78 GTO 06
 79 X<>Y
 80 XEQ 04
 81 LBL 06
 82 STO IND Y
 83 X<>Y
 84 DSE X
 85 GTO 17
 86 XEQ "W"
 87 " "
 88 5
 89 LBL 11
 90 RCL IND X
 91 ARCL IND X
 92 AVIEW
 93 COS
 94 X<>Y
 95 DSE X
 96 GTO 11
 97 RCL 07          
 98 X#0?
 99 GTO 06
100 35
101 RCL 08
102 X>Y?
103 ISG 07
104 INT
105 32
106 X>Y?
107 DSE 07
108 LBL 06
109 RCL 00
110 FRC
111 4
112 /
113 9
114 +
115 E^X
116 RCL 07
117 *
118 STO 16
119 ABS
120 GTO 05
121 LBL 10
122 2
123 STO 13
124 26
125 STO 03
126 48
127 STO 04
128  E3
129 STO 16
130 " "
131 ASTO 22
132 LBL 07
133 CLA
134 ARCL 22
135 XEQ 04
136 STO IND 04
137 ARCL IND X
138 ASTO 22
139 XEQ 04
140 STO IND 13
141 ARCL IND 03
142 AVIEW
143 DSE 03
144 DSE 04
145 DSE 13
146 GTO 07
147 SF 10
148 3
149 STO 24
150 RCL 01
151 STO 43
152 RCL 02
153 STO 44          
154 17.021
155 STO 01
156 LBL 08
157 XEQ 04
158 STO IND 01
159 ISG 01
160 GTO 08
161 "/"
162 ARCL IND 17
163 ARCL IND 18
164 ARCL IND 19
165 ASTO 23
166 " FLOP..."
167 AVIEW
168 RCL 45
169 REGMOVE
170 RCL 43
171 STO 04
172 RCL 44
173 STO 05
174 CLX
175 STO 07
176 SIGN
177 STO 06
178 XEQ 01
179 STO 40
180 CLA
181 ARCL 22
182 ARCL 23
183 ARCL 25
184 RCL 00
185 R-D
186 FRC
187 STO 00
188 X^2
189 SIGN
190 LASTX
191 -
192 SQRT
193 1/X
194 STO 42
195 CLX
196 LBL 09
197 AVIEW
198 GETKEY
199 44
200 X=Y?
201 GTO 02
202 X<> Z
203 ST+ 16
204 X<>Y
205 41
206 X=Y?
207 GTO 12
208 LN
209 *
210 X^2
211 RCL 16
212 +
213 RCL 40
214 X<>Y
215 X>Y?
216 GTO 05
217 STO 16
218 X<>Y
219 3
220 /
221 X<Y?
222 GTO 12
223 *
224 SQRT
225 RCL 00
226 R-D
227 FRC
228 STO 00          
229 *
230 "  +"
231 ARCL X
232 GTO 09
233 LBL 12
234 DSE 24
235 X=0?
236 GTO 06
237 " RIVER..."
238 FS? 10
239 " TURN..."
240 AVIEW
241 RCL 45
242 REGMOVE
243 RCL 43
244 STO 06
245 RCL 44
246 STO 07
247 CLX
248 FS? 10
249 STO 05
250 XEQ 01
251 STO 46
252 RCL 42
253 *
254 STO 40
255 CLA
256 ARCL 23
257 FS? 10
258 ARCL IND 20
259 FC?C 10
260 ARCL IND 21
261 ASTO 23
262 CLA
263 ARCL 22
264 ARCL 23
265 ARCL 25
266 CLX
267 GTO 09
268 LBL 06
269 "/"
270 ARCL IND 43
271 ARCL IND 44
272 ASTO 24
273 CLA
274 ARCL 22
275 ARCL 23
276 ARCL 24
277 ATOX
278 AVIEW
279 RCL 45
280 REGMOVE
281 RCL 47
282 STO 06
283 RCL 48
284 STO 07
285 XEQ 01
286 RCL 46
287 X<>Y
288 -
289 LBL 02
290 CHS
291 LBL 05
292 X#0?
293 SIGN
294 RCL 16
295 *
296 ST+ 41
297 RCL 41
298 "  "
299 X>0?
300 >"+"
301 ARCL 41
302 >" $"
303 FIX 4
304 AVIEW
305 STOP
306 GTO 10
307 LBL 04
308 RCL 00          
309 R-D
310 RCL 14
311 MOD
312 STO 00
313 INT
314 RCL 15
315 +
316 RTN
317 LBL 01
318 RCL 01
319 RCL 02
320 X>Y?
321 X<>Y
322 RCL 03
323 X>Y?
324 X<>Y
325 RCL 04
326 X<Y?
327 X<>Y
328 X<> 05
329 X<Y?
330 X<>Y
331 X<> 06
332 X<Y?
333 X<>Y
334 X<> 07
335 X>Y?
336 X<>Y
337 X<> 07
338 X>Y?
339 X<>Y
340 R^
341 X>Y?
342 X<>Y
343 R^
344 X<Y?
345 X<>Y
346 X<> 05
347 X<Y?
348 X<>Y
349 X<> 06
350 X>Y?
351 X<>Y
352 X<> 06
353 X>Y?
354 X<>Y
355 R^
356 X>Y?
357 X<>Y
358 R^
359 X<Y?
360 X<>Y
361 X<> 05
362 X>Y?
363 X<>Y
364 X<> 05
365 X>Y?
366 X<>Y
367 R^
368 X>Y?
369 X<>Y
370 RDN
371 X>Y?
372 X<>Y
373 RDN
374 X<Y?
375 X<>Y
376 STO 01
377 RDN
378 X>Y?
379 X<>Y
380 STO 04
381 RDN
382 X>Y?
383 X<>Y
384 STO 03          
385 X<>Y
386 STO 02
387 4
388 STO 08
389 CLX
390 STO 10
391 STO 11
392 STO 12
393 STO 13
394 XEQ "V"
395 STO 09
396 CLA
397 SIGN
398 RCL 01
399 RCL 02
400 -
401 X=Y?
402 ST+ M
403 X<> L
404 RCL 03
405 -
406 X=Y?
407 ST+ M
408 X>Y?
409 CLA
410 X<> L
411 RCL 04
412 -
413 X=Y?
414 ST+ M
415 X>Y?
416 CLA
417 X<> L
418 RCL 05
419 -
420 X=Y?
421 ST+ M
422 X>Y?
423 CLA
424 RCL M
425 4
426 X=Y?
427 GTO 03
428 DSE X
429 X#Y?
430 GTO 02
431 RCL 05
432 RCL 15
433 X=Y?
434 GTO 06
435 LBL 02
436 SIGN
437 RCL 05
438 RCL 06
439 -
440 X=Y?
441 ST+ M
442 X>Y?
443 CLA
444 RCL M
445 4
446 X=Y?
447 GTO 04
448 DSE X
449 X#Y?
450 GTO 02
451 RCL 06
452 RCL 15
453 X=Y?
454 GTO 06
455 LBL 02
456 SIGN
457 RCL 06          
458 RCL 07
459 -
460 X=Y?
461 ST+ M
462 X>Y?
463 CLA
464 RCL M
465 4
466 X=Y?
467 GTO 05
468 DSE X
469 X#Y?
470 GTO 12
471 RCL 07
472 RCL 15
473 X=Y?
474 GTO 06
475 GTO 12
476 LBL 03
477 RCL 05
478 GTO 02
479 LBL 04
480 RCL 06
481 GTO 02
482 LBL 05
483 RCL 07
484 GTO 02
485 LBL 06
486 RCL 01
487 39
488 X#Y?
489 GTO 12
490 26
491 LBL 02
492 STO 09
493 STO 10
494 STO 11
495 STO 12
496 STO 13
497 5
498 STO 08
499 LBL 12
500 RCL 15
501 RCL 09
502 RCL 08
503 RCL 15
504 *
505 +
506 *
507 RCL 10
508 +
509 *
510 RCL 11
511 +
512 *
513 RCL 12
514 +
515 *
516 RCL 13
517 +
518 RCL 49
519 *
520 X^2
521 RTN
522 END

 
         ( 806 bytes / SIZE 050 )

  
-Lines  05-08-11  are three-byte GTOs


 01 LBL "V"
 02 RCL 01          
 03 RCL 02
 04 X=Y?
 05 GTO 06
 06 RCL 03
 07 X=Y?
 08 GTO 05
 09 RCL 04
 10 X=Y?
 11 GTO 04
 12 RCL 05
 13 X=Y?
 14 GTO 03
 15 RCL 06
 16 X=Y?
 17 GTO 02
 18 RCL 07
 19 X=Y?
 20 GTO 01
 21 CLX
 22 STO 08
 23 RCL 02
 24 STO 10
 25 RCL 03
 26 STO 11
 27 RCL 04
 28 STO 12
 29 RCL 05
 30 STO 13
 31 RCL 01
 32 RTN
 33 LBL 01
 34 SIGN
 35 STO 08
 36 RCL 01
 37 STO 10
 38 RCL 02
 39 STO 11
 40 RCL 03
 41 STO 12
 42 LASTX
 43 RTN
 44 LBL 02
 45 RCL 07
 46 X=Y?
 47 GTO 01
 48 SIGN
 49 STO 08
 50 RCL 01
 51 STO 10
 52 RCL 02
 53 STO 11
 54 RCL 03
 55 STO 12
 56 RCL 05
 57 RTN
 58 LBL 01
 59 DSE 08
 60 RCL 01
 61 STO 10
 62 RCL 02
 63 STO 11
 64 RCL 06
 65 RTN
 66 LBL 03
 67 RCL 06
 68 X=Y?
 69 GTO 02
 70 RCL 07
 71 X=Y?
 72 GTO 01
 73 SIGN
 74 STO 08
 75 RCL 01          
 76 STO 10
 77 RCL 02
 78 STO 11
 79 RCL 03
 80 STO 12
 81 RCL 04
 82 RTN
 83 LBL 01
 84 STO 10
 85 RCL 01
 86 STO 11
 87 2
 88 STO 08
 89 RCL 04
 90 RTN
 91 LBL 02
 92 RCL 07
 93 X=Y?
 94 GTO 01
 95 DSE 08
 96 RCL 01
 97 STO 10
 98 RCL 02
 99 STO 11
100 RCL 04
101 RTN
102 LBL 01
103 6
104 STO 08
105 RCL 01
106 STO 10
107 RCL 04
108 RTN
109 LBL 04
110 RCL 05
111 X=Y?
112 GTO 03
113 RCL 06
114 X=Y?
115 GTO 02
116 RCL 07
117 X=Y?
118 GTO 01
119 SIGN
120 STO 08
121 RCL 01
122 STO 10
123 RCL 02
124 STO 11
125 RCL 05
126 STO 12
127 RCL 03
128 RTN
129 LBL 01
130 STO 10
131 RCL 01
132 STO 11
133 2
134 STO 08
135 RCL 03
136 RTN
137 LBL 02
138 RCL 07
139 X=Y?
140 GTO 01
141 2
142 STO 08
143 RCL 05
144 STO 10          
145 RCL 01
146 STO 11
147 RCL 03
148 RTN
149 LBL 01
150 RCL 03
151 STO 10
152 X<>Y
153 RTN
154 LBL 03
155 RCL 06
156 X=Y?
157 GTO 02
158 RCL 07
159 X=Y?
160 GTO 01
161 DSE 08
162 RCL 01
163 STO 10
164 RCL 02
165 STO 11
166 RCL 03
167 RTN
168 LBL 01
169 STO 10
170 RCL 03
171 RTN
172 LBL 02
173 RCL 07
174 X=Y?
175 GTO 01
176 6
177 STO 08
178 RCL 01
179 STO 10
180 RCL 03
181 RTN
182 LBL 01
183 7
184 STO 08
185 X<>Y
186 RTN
187 LBL 05
188 RCL 04
189 X=Y?
190 GTO 04
191 RCL 05
192 X=Y?
193 GTO 03
194 RCL 06
195 X=Y?
196 GTO 02
197 RCL 07
198 X=Y?
199 GTO 01
200 SIGN
201 STO 08
202 RCL 01
203 STO 10
204 RCL 04
205 STO 11
206 RCL 05
207 STO 12
208 RCL 02
209 RTN
210 LBL 01
211 STO 10
212 2
213 STO 08          
214 RCL 01
215 STO 11
216 RCL 02
217 RTN
218 LBL 02
219 RCL 07
220 X=Y?
221 GTO 01
222 X<>Y
223 STO 10
224 RCL 01
225 STO 11
226 2
227 STO 08
228 RCL 02
229 RTN
230 LBL 01
231 RCL 02
232 STO 10
233 X<>Y
234 RTN
235 LBL 03
236 RCL 06
237 X=Y?
238 GTO 01
239 2
240 STO 08
241 RCL 04
242 STO 10
243 RCL 01
244 STO 11
245 RCL 02
246 RTN
247 LBL 01
248 RCL 07
249 X=Y?
250 GTO 01
251 RCL 02
252 STO 10
253 RCL 04
254 RTN
255 LBL 01
256 6
257 STO 08
258 RCL 01
259 STO 10
260 RCL 04
261 RTN
262 LBL 04
263 RCL 05
264 X=Y?
265 GTO 03
266 RCL 06
267 X=Y?
268 GTO 02
269 RCL 07
270 X=Y?
271 GTO 01
272 DSE 08
273 RCL 01
274 STO 10
275 RCL 05
276 STO 11
277 RCL 02
278 RTN
279 LBL 01
280 STO 10
281 RCL 02          
282 RTN
283 LBL 02
284 RCL 05
285 STO 10
286 RCL 02
287 RTN
288 LBL 03
289 RCL 06
290 X=Y?
291 GTO 01
292 6
293 STO 08
294 RCL 01
295 STO 10
296 RCL 02
297 RTN
298 LBL 01
299 7
300 STO 08
301 X<>Y
302 RTN
303 LBL 06
304 RCL 03
305 X=Y?
306 GTO 05
307 RCL 04
308 X=Y?
309 GTO 04
310 RCL 05
311 X=Y?
312 GTO 03
313 RCL 06
314 X=Y?
315 GTO 02
316 RCL 07
317 X=Y?
318 GTO 01
319 SIGN
320 STO 08
321 RCL 03
322 STO 10
323 RCL 04
324 STO 11
325 RCL 05
326 STO 12
327 RCL 01
328 RTN
329 LBL 01
330 STO 10
331 RCL 03
332 STO 11
333 2
334 STO 08
335 RCL 01
336 RTN
337 LBL 02
338 RCL 07
339 X=Y?
340 GTO 01
341 2
342 STO 08
343 RCL 03
344 STO 11
345 RCL 05
346 STO 10
347 RCL 01
348 RTN
349 LBL 01
350 RCL 01          
351 STO 10
352 X<>Y
353 RTN
354 LBL 03
355 RCL 06
356 X=Y?
357 GTO 01
358 2
359 STO 08
360 RCL 03
361 STO 11
362 RCL 04
363 STO 10
364 RCL 01
365 RTN
366 LBL 01
367 RCL 07
368 X=Y?
369 GTO 01
370 RCL 01
371 STO 10
372 RCL 04
373 RTN
374 LBL 01
375 6
376 STO 08
377 RCL 01
378 STO 10
379 RCL 04
380 RTN
381 LBL 04
382 RCL 05
383 X=Y?
384 GTO 03
385 RCL 06
386 X#Y?
387 GTO 01
388 RCL 07
389 X=Y?
390 GTO 02
391 LBL 01
392 2
393 STO 08
394 RCL 03
395 STO 10
396 RCL 05
397 STO 11
398 RCL 01
399 RTN
400 LBL 02
401 RCL 03
402 STO 10
403 X<>Y
404 RTN
405 LBL 03
406 RCL 06
407 X=Y?
408 GTO 01
409 RCL 01
410 STO 10
411 RCL 03
412 RTN
413 LBL 01
414 RCL 07
415 X=Y?
416 GTO 01
417 6
418 STO 08
419 RCL 01          
420 STO 10
421 RCL 03
422 RTN
423 LBL 01
424 7
425 STO 08
426 X<>Y
427 RTN
428 LBL 05
429 RCL 04
430 X=Y?
431 GTO 04
432 RCL 05
433 X=Y?
434 GTO 03
435 RCL 06
436 X=Y?
437 GTO 01
438 RCL 07
439 X=Y?
440 GTO 01
441 DSE 08
442 RCL 04
443 STO 10
444 RCL 05
445 STO 11
446 RCL 01
447 RTN
448 LBL 01
449 STO 10
450 RCL 01
451 RTN
452 LBL 03
453 RCL 06
454 X#Y?
455 GTO 01
456 RCL 07
457 X=Y?
458 GTO 02
459 LBL 01
460 RCL 04
461 STO 10
462 RCL 01
463 RTN
464 LBL 02
465 6
466 STO 08
467 RCL 01
468 STO 10
469 RCL 04
470 RTN
471 LBL 04
472 RCL 05
473 X=Y?
474 GTO 01
475 6
476 STO 08
477 RCL 05
478 STO 10
479 RCL 01
480 RTN
481 LBL 01
482 7
483 STO 08
484 X<>Y
485 END

 
         ( 548 bytes )  


 01 LBL "W"
 02 RCL 01          
 03 RCL 02
 04 X>Y?
 05 X<>Y
 06 RCL 03
 07 X>Y?
 08 X<>Y
 09 RCL 04
 10 X<Y?
 11 X<>Y
 12 X<> 05
 13 X>Y?
 14 X<>Y
 15 X<> 05
 16 X>Y?
 17 X<>Y
 18 R^
 19 X>Y?
 20 X<>Y
 21 RDN
 22 X>Y?
 23 X<>Y
 24 RDN
 25 X<Y?
 26 X<>Y
 27 STO 01          
 28 STO 08
 29 RDN
 30 X>Y?
 31 X<>Y
 32 STO 04
 33 RDN
 34 X>Y?
 35 X<>Y
 36 STO 03
 37 X<>Y
 38 STO 02
 39 5
 40 STO 07
 41 RCL 05
 42 RCL 04
 43 X=Y?
 44 GTO 08
 45 RCL 03
 46 X=Y?
 47 GTO 06
 48 RCL 02          
 49 X=Y?
 50 GTO 07
 51 RCL 01
 52 X=Y?
 53 GTO 11
 54 RCL 05
 55 -
 56 8
 57 STO 07
 58 CLX
 59 5
 60 X>Y?
 61 RTN
 62 RCL 02
 63 LASTX
 64 -
 65 PI
 66 X<Y?
 67 GTO 10
 68 R^
 69 12
 70 X=Y?
 71 RTN
 72 LBL 10
 73 5
 74 CHS
 75 STO 07          
 76 RTN
 77 LBL 11
 78 STO 08
 79 CLX
 80 STO 07
 81 RTN
 82 LBL 06
 83 RCL 02
 84 X=Y?
 85 GTO 10
 86 RCL 01
 87 X=Y?
 88 GTO 11
 89 GTO 09
 90 LBL 07
 91 RCL 01          
 92 X=Y?
 93 GTO 07
 94 GTO 09
 95 LBL 08
 96 RCL 03
 97 X=Y?
 98 GTO 06
 99 RCL 02
100 X=Y?
101 GTO 08
102 RCL 01
103 X=Y?
104 GTO 11
105 RDN
106 LBL 09
107 X<> Z
108 STO 08
109 CLX
110 STO 07          
111 RTN
112 LBL 10
113 RCL 01
114 X=Y?
115 GTO 09
116 GTO 07
117 LBL 06
118 RCL 02
119 X=Y?
120 GTO 10
121 RCL 01
122 X=Y?
123 RTN
124 LBL 07
125 3
126 STO 07
127 RTN
128 LBL 08
129 RCL 01          
130 X=Y?
131 RTN
132 LBL 11
133 2
134 STO 07
135 RTN
136 LBL 10
137 21
138 STO 07
139 CLX
140 RCL 01
141 X=Y?
142 RTN
143 LBL 09
144 13
145 STO 07
146 END

 
         ( 174 bytes )  

           STACK            INPUT          OUTPUT
               X                /            Cash


  CF 07 = Texas Hold'em
  SF 07 = One Arm Bandit

Note:

-"TXEM" may be stored in an X-function module ( 806 bytes < 124 registers ) and "V" & "W" in main memory


4°) Even Shorter Programs  


 
    a) Texas Hold'em



-In this version, the HP41 doesn't calculate any hand value !

>>> So you have to decide who wins !

-1000$ is always played ( lines 29-30 )

-Press the backarrow key if you want to fold
-Press ENTER^ to place 0
-Press another key if you want to make a higher bid.

-The HP41 never folds.
-Lines 80 to 87 compute a number between  -10000$ and +10000$

  -If this number is < 0 , the HP41 matches the player's bet.
  -Otherwise, the HP41 makes a higher bid ( which is displayed as "  + .... $" )

-Press the backarrow key if you want to fold
-Press ENTER^ to match the HP41's bet
-Press another key if you want to make a higher bid...

-Finally, when the 7 cards are displayed,

    press + if you win
    press - if the HP41 wins
    press another key if none wins  ( it's up to you to judge )


Data Registers:           •  R00 = r = random number                 ( Registers R00 & R10 are to be initialized before executing "TXM" )

                                      •  R10 =  Your Cash                             R01 to R28: temp                                   
Flag:   F10
Subroutines: /

-Linbe 148 is a three-byte GTO 10
    

 01 LBL "TXM"
 02 "/"
 03 23
 04 XTOA
 05 XTOA
 06 ASTO 11
 07 "A"
 08 ASTO 28
 09 "K"
 10 ASTO 27
 11 "Q"
 12 ASTO 26
 13 "J"
 14 ASTO 25
 15 "T"
 16 ASTO 24
 17 9
 18 LBL 01
 19 STO IND Y
 20 DSE Y
 21 DSE X
 22 GTO 01          
 23 LBL 10
 24 FIX 00
 25 2
 26 STO 13
 27 9
 28 STO 14
 29  E3
 30 STO 15
 31 " "
 32 LBL 03
 33 XEQ 04
 34 STO IND 13
 35 ARCL IND X
 36 XEQ 04
 37 STO IND 14
 38 DSE 14
 39 DSE 13
 40 GTO 03
 41 ASTO 12
 42 SF 10
 43 3.007
 44 STO 13          
 45 INT
 46 STO 14
 47 ARCL 11
 48 AVIEW
 49 LBL 00
 50 XEQ 04
 51 STO IND 13
 52 ISG 13
 53 GTO 00          
 54 "/"
 55 ARCL IND 03
 56 ARCL IND 04
 57 ARCL IND 05
 58 ASTO 13
 59 CLA
 60 ARCL 12
 61 ARCL 13
 62 ARCL 11
 63 CLX
 64 LBL 07
 65 AVIEW
 66 GETKEY
 67 44
 68 X=Y?
 69 GTO 02
 70 X<> Z
 71 ST+ 15
 72 X<>Y
 73 41
 74 X=Y?
 75 GTO 12
 76 LN
 77 *
 78 X^2
 79 ST+ 15
 80 2 E4
 81 RCL 00          
 82 R-D
 83 FRC
 84 STO 00
 85 *
 86  E4
 87 -
 88 X<0?
 89 GTO 12
 90 "  +"
 91 ARCL X
 92 GTO 07
 93 LBL 12
 94 DSE 14
 95 X=0?
 96 GTO 06
 97 CLA
 98 ARCL 13
 99 FS? 10
100 ARCL IND 06
101 FC?C 10
102 ARCL IND 07
103 ASTO 13
104 CLA
105 ARCL 12
106 ARCL 13
107 ARCL 11
108 CLX
109 GTO 07          
110 LBL 06
111 "/"
112 ARCL IND 08
113 ARCL IND 09
114 ASTO 14
115 CLA
116 ARCL 12
117 ARCL 13
118 ARCL 14
119 ATOX
120 AVIEW
121 41
122 GETKEYX
123 CLX
124 61
125 X=Y?
126 GTO 05          
127 CLX
128 51
129 X#Y?
130 CLX
131 LBL 02
132 CHS
133 LBL 05
134 X#0?
135 SIGN
136 RCL 15
137 *
138 ST+ 10
139 RCL 10
140 " C="
141 X>0?
142 >"+"
143 ARCL 10
144 >" $"
145 AVIEW
146 FIX 04
147 STOP
148 GTO 10          
149 LBL 04
150 RCL 00
151 R-D
152 13
153 MOD
154 STO 00
155 INT
156 16
157 +
158 RTN
159 END

 
         ( 276 bytes / SIZE 029 )  


           STACK            INPUT          OUTPUT
               X                /            Cash


Notes:

-CF 29
-At the showdown,  compare the values of the possible hands ( you have 41 seconds to do that - line 121 )
-Press  +   if you win  ( line 124 )  or  -   if the HP41 wins  ( line 128 )

-Press any other key if none wins  



 
    b) Texas Hold'em + 1 Arm Bandit



-Same program for Texas Hold'em + One Arm bandit.


Data Registers:           •  R00 = r = random number                 ( Registers R00 & R10 are to be initialized before executing "TXM" )

                                      •  R10 =  Your Cash                             R01 to R28: temp         
                          
Flags:   F10 & F07    CF 07 = Texas Hold'em
                                     SF 07 = 1 Arm Bandit
Subroutines: /


-Lines 26-107 are three-byte GTOs
    

 01 LBL "TXM"
 02 "/"
 03 23
 04 XTOA
 05 XTOA
 06 ASTO 11
 07 "A"
 08 ASTO 28
 09 "K"
 10 ASTO 27
 11 "Q"
 12 ASTO 26
 13 "J"
 14 ASTO 25
 15 "T"
 16 ASTO 24
 17 9
 18 LBL 16
 19 STO IND Y
 20 DSE Y
 21 DSE X
 22 GTO 16
 23 LBL 41
 24 FIX 0
 25 FC? 07
 26 GTO 10
 27 " "
 28 ASTO 08
 29 5
 30 LBL 28
 31 CLA
 32 ARCL 08
 33 XEQ 04
 34 STO IND Y
 35 ARCL IND X
 36 ASTO 08
 37 X<>Y
 38 AVIEW
 39 DSE X
 40 GTO 28
 41 LBL 13          
 42 54
 43 GETKEYX
 44 X=0?
 45 GTO 06
 46 LASTX
 47 -
 48 CLRGX
 49 GTO 13
 50 LBL 06
 51 " "
 52 5
 53 LBL 14
 54 RCL IND X
 55 X#0?
 56 ARCL IND X
 57 X<>Y
 58 DSE X
 59 GTO 14
 60 AVIEW
 61 5
 62 LBL 01
 63 RCL IND X
 64 X#0?
 65 GTO 06
 66 X<>Y
 67 XEQ 04
 68 LBL 06
 69 STO IND Y
 70 X<>Y
 71 DSE X
 72 GTO 01
 73 XEQ 18
 74 " "
 75 5
 76 LBL 31
 77 RCL IND X
 78 ARCL IND X
 79 AVIEW
 80 COS
 81 X<>Y
 82 DSE X
 83 GTO 31
 84 RCL 07
 85 X#0?
 86 GTO 06
 87 24
 88 RCL 08
 89 X>Y?
 90 ISG 07
 91 INT
 92 21
 93 X>Y?
 94 DSE 07
 95 LBL 06          
 96 RCL 00
 97 FRC
 98 4
 99 /
100 9
101 +
102 E^X
103 RCL 07
104 *
105 STO 15
106 ABS
107 GTO 05
108 LBL 10
109 2
110 STO 13
111 9
112 STO 14
113  E3
114 STO 15
115 " "
116 LBL 03
117 XEQ 04
118 STO IND 13
119 ARCL IND X
120 XEQ 04
121 STO IND 14
122 DSE 14
123 DSE 13
124 GTO 03
125 ASTO 12
126 SF 10
127 3.007
128 STO 13
129 INT
130 STO 14
131 ARCL 11
132 AVIEW
133 LBL 00
134 XEQ 04
135 STO IND 13
136 ISG 13
137 GTO 00
138 "/"
139 ARCL IND 03
140 ARCL IND 04
141 ARCL IND 05
142 ASTO 13
143 CLA
144 ARCL 12
145 ARCL 13
146 ARCL 11
147 CLX
148 LBL 29
149 AVIEW
150 GETKEY
151 44
152 X=Y?
153 GTO 02
154 X<> Z
155 ST+ 15
156 X<>Y
157 41
158 X=Y?
159 GTO 12
160 LN
161 *
162 X^2
163 ST+ 15
164 2 E4
165 RCL 00          
166 R-D
167 FRC
168 STO 00
169 *
170  E4
171 -
172 X<0?
173 GTO 12
174 "  +"
175 ARCL X
176 GTO 29
177 LBL 12
178 DSE 14
179 X=0?
180 GTO 06
181 CLA
182 ARCL 13
183 FS? 10
184 ARCL IND 06
185 FC?C 10
186 ARCL IND 07
187 ASTO 13
188 CLA
189 ARCL 12
190 ARCL 13
191 ARCL 11
192 CLX
193 GTO 29
194 LBL 06
195 "/"
196 ARCL IND 08
197 ARCL IND 09
198 ASTO 14
199 CLA
200 ARCL 12
201 ARCL 13
202 ARCL 14
203 ATOX
204 AVIEW
205 41
206 GETKEYX
207 CLX
208 61
209 X=Y?
210 GTO 05
211 CLX
212 51
213 X#Y?
214 CLX
215 LBL 02
216 CHS
217 LBL 05
218 X#0?
219 SIGN
220 RCL 15          
221 *
222 ST+ 10
223 RCL 10
224 "  "
225 X>0?
226 >"+"
227 ARCL 10
228 >" $"
229 AVIEW
230 FIX 9
231 STOP
232 GTO 41
233 LBL 04
234 RCL 00
235 R-D
236 13
237 MOD
238 STO 00
239 INT
240 16
241 +
242 RTN
243 LBL 18
244 RCL 01
245 RCL 02
246 X>Y?
247 X<>Y
248 RCL 03
249 X>Y?
250 X<>Y
251 RCL 04
252 X<Y?
253 X<>Y
254 X<> 05
255 X>Y?
256 X<>Y
257 X<> 05
258 X>Y?
259 X<>Y
260 R^
261 X>Y?
262 X<>Y
263 RDN
264 X>Y?
265 X<>Y
266 RDN
267 X<Y?
268 X<>Y
269 STO 01
270 STO 08          
271 RDN
272 X>Y?
273 X<>Y
274 STO 04
275 RDN
276 X>Y?
277 X<>Y
278 STO 03
279 X<>Y
280 STO 02
281 5
282 STO 07
283 RCL 05
284 RCL 04
285 X=Y?
286 GTO 08
287 RCL 03
288 X=Y?
289 GTO 06
290 RCL 02
291 X=Y?
292 GTO 07
293 RCL 01
294 X=Y?
295 GTO 11
296 RCL 05
297 -
298 8
299 STO 07
300 CLX
301 5
302 X>Y?
303 RTN
304 RCL 02
305 LASTX
306 -
307 PI
308 X<Y?
309 GTO 10
310 R^
311 12
312 X=Y?
313 RTN
314 LBL 10
315 5
316 CHS
317 STO 07
318 RTN
319 LBL 11
320 STO 08
321 CLX
322 STO 07
323 RTN
324 LBL 06
325 RCL 02          
326 X=Y?
327 GTO 10
328 RCL 01
329 X=Y?
330 GTO 11
331 GTO 09
332 LBL 07
333 RCL 01
334 X=Y?
335 GTO 07
336 GTO 09
337 LBL 08
338 RCL 03
339 X=Y?
340 GTO 06
341 RCL 02
342 X=Y?
343 GTO 08
344 RCL 01
345 X=Y?
346 GTO 11
347 RDN
348 LBL 09
349 X<> Z
350 STO 08
351 CLX
352 STO 07
353 RTN
354 LBL 10
355 RCL 01
356 X=Y?
357 GTO 09
358 GTO 07
359 LBL 06
360 RCL 02
361 X=Y?
362 GTO 10
363 RCL 01
364 X=Y?
365 RTN
366 LBL 07
367 3
368 STO 07
369 RTN
370 LBL 08
371 RCL 01
372 X=Y?
373 RTN
374 LBL 11
375 2
376 STO 07
377 RTN
378 LBL 10
379 21
380 STO 07
381 CLX
382 RCL 01          
383 X=Y?
384 RTN
385 LBL 09
386 13
387 STO 07
388 END

 
         ( 581 bytes / SIZE 029 )  


           STACK            INPUT          OUTPUT
               X                /            Cash


Note:

-Press  CF 29  before XEQ "TXM"