Showing posts with label Card Sharks. Show all posts
Showing posts with label Card Sharks. Show all posts

Sunday, January 3, 2016

TI-84 Plus and HP Prime: Card Sharks Odds Program

TI-84 Plus and HP Prime:  Card Sharks Odds Program

HAPPY NEW YEAR! 

Cards and Calculations.   By the way, is the next card higher or lower than the 9?


The game show Card Sharks may have long been off-air except for reruns on GSN or BUZZR (or even finding videos on YouTube), the game show is still popular.  It is a simple game involving a standard deck of 52 cards.  The object is to predict whether the next card is higher in rank or lower in rank than the preceding card.  In Card Sharks, aces always count as high.  Along with aces, twos are very desirable, while eights are the worst cards in the deck.

Quick Synopsis*:  Each player works on his/her own deck of cards.  The first two games have 5-card hands while the third, if needed has only 3.  A player got control if they won (usually) a survey-type toss up question.  A game is won when a hand is completed or wins the sudden-death question. Winning 2 games won the match for the champion.  The champion got to play Money Cards, where a seven card hand was dealt in two rows of 3 and one final card.  The player then placed bets on whether the card was higher or lower, at even odds.  The last bet had to at least half of the player’s bankroll.

* This was the general game play, for all of the details of the incarnations of game show, please click here:  http://gameshows.wikia.com/wiki/Card_Sharks  (Game Shows Wiki).

The program CSODDS tracks the odds of whether the next card is higher or lower.  CSODDS assumes a 52 card deck (no jokers).   All entries are numerical, hence:

Jacks = 11
Queens = 12
Kings = 13
Aces = 14

You are asked if you want to continue after each card.  The program accounts for the number of cards in each deck.  Have fun!

TI-84 Plus Program CSODDS




seq(4,X,1,14,1)→L₆
0→L₆(1)
While sum(L₆)>0
Disp "J=11 Q=12 K=13 A=14"
Input "CARD:",C
If L₆(C)≠0
Then
L₆(C)-1→L₆(C)
0→L
For(K,2,C-1)
L+L₆(K)→L
End
0→H
For(K,C+1,14)
H+L₆(K)→H
End
Disp "ODDS NEXT CARD IS"
Disp "HIGHER:",H/sum(L₆)
Disp "LOWER:",L/sum(L₆)
Disp "CARDS USED:",52-sum(L₆)
Pause
Else
Disp "NOT AVAILABLE"
End

Menu("CONTINUE?","YES",1,"NO",2)
Lbl 1
End
Lbl 2

HP Prime Program CSODDS



EXPORT CSODDS()
BEGIN
// Card Sharks Odds
// Jan 3 2016 EWS
// Standard deck of 52 cards

LOCAL L6,C,L,H,K,R;
L6:=MAKELIST(4,X,1,14,1);
L6(1):=0;


WHILE ΣLIST(L6)>0 DO
INPUT(C,"Next Card","Card:",
"J=11 Q=12 K=13 A=14");

IF L6(C)≠0 THEN
L6(C):=L6(C)-1;
//L:=ΣLIST(SUB(L6,1,C-1))/
//ΣLIST(L6);
//H:=ΣLIST(SUB(L6,C+1,14))/
//ΣLIST(L6);

L:=0;
FOR K FROM 2 TO C-1 DO
L:=L+L6(K);
END;

H:=0;
FOR K FROM C+1 TO 14 DO
H:=H+L6(K);
END;
L:=L/ΣLIST(L6);
H:=H/ΣLIST(L6);
R:=52-ΣLIST(L6);
PRINT();
PRINT("CARD: "+C);
PRINT("ODDS NEXT CARD IS");
PRINT("HIGHER: "+H);
PRINT("LOWER: "+L);
PRINT("CARDS USED: "+R);
WAIT(0);

ELSE
MSGBOX("CARD N/A");
END;

// Continue?
K:=1;
CHOOSE(K,"Continue?",
{"Yes","No"});
IF K==2 THEN
RETURN;
END;

END;

END;


Sample 10-Card Hand (results rounded to 3 decimal places):

Card
Odds next Card is Higher
Odds Next Card is Lower
Card 1:  K (13)
0.078
0.863
Card 2:  3
0.860
0.080
Card 3:  J (11)
0.224
0.714
Card 4:  9
0.375
0.563
Card 5:  7
0.532
0.404
Card 6:  A (14)
0.000
0.935
Card 7:  6
0.600
0.333
Card 8:  K (13)
0.068
0.886
Card 9:  8
0.442
0.488
Card 10: 4
0.762
0.167

In the near future, I am going to present some programs for the HP 15C.  I tend to emphasize graphing calculators due to (a) availability and (b) programs can be more complex due to the increased memory.  

Eddie



This blog is property of Edward Shore.  2016

Sunday, January 5, 2014

Playing Cards: Odds That The Next Card is Higher or Lower

In the classic game "Card Sharks", contestants had to guess and wager whether the proceeding card is higher or lower. The card game is popular to watch on TV and to play on yourself. All it takes a deck of cards to play.

This blog entry deals with the odds of whether the next card is higher or lower. Several assumptions: the odds are calculated with a standard 52 card deck without Jokers. The tables deal with the first cards drawn from the top of the deck.

Table 1: One card is drawn from the top of the deck.

Table 2: One card is drawn. A second drawn which is lower than the first card. Examples: Ace then King, Ten then Six.

The second card is the current card.

Table 3: One card is drawn. A second drawn which is higher than the first card. Examples: King then Ace, Six then Ten.

The second card is the current card.

Table 4: A pair of cards are drawn. Example: A pair of Eights.

General strategies of Card Sharks consisting of:
* Betting a lot on lower when you have an Ace or King
* Betting a lot on higher when you have a 2 or 3
* Betting minimum on a 7, 8, or 9 (middle ranks)


Analyzing a Hand

In general, the odds of whether cards are higher or lower as the number of cards decrease. Let's see how the odds change during a 8 card hand.

** Odds are rounded to 3 digits in this analysis.

Here is an Example Hand:

1st Card: King
Odds the next card is higher: 0.078
Odds the next card is another King: 0.059
Odds the next card is lower: 0.863

2nd Card: 10
Odds the next card is higher: 0.300
Odds the next card is another 10: 0.060
Odds the next card is lower: 0.640

3rd Card: 2
Odds the next card is higher: 0.939
Odds the next card is another 2: 0.061
Odds the next card is lower: 0.000

4th Card: 6
Odds the next card is higher: 0.624
Odds the next card is another 6: 0.063
Odds the next card is lower: 0.313

5th Card: 4
Odds the next card is higher: 0.787
Odds the next card is another 4: 0.064
Odds the next card is lower: 0.149

6th Card: 4
Odds the next card is higher: 0.805
Odds the next card is another 4: 0.043
Odds the next card is lower: 0.152

7th Card: King
Odds the next card is higher: 0.089
Odds the next card is another King: 0.044
Odds the next card is lower: 0.867

8th Card: 5
(The game ends).


Shuffle up and deal!

Eddie


This blog is property of Edward Shore. 2014

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...