Code covered by the BSD License
-
BJCreateBoard(AllVisible)
Creates the Blackjack Playing Board
-
BJInitValues
Creates a GUI that allows the player to determine the initial values to be
-
BJActionSelect(Action)
This function is called when the Hit, Stand and Double boxes are pressed
-
BJBetSuggest(handles)
This function uses the True Count and number of decks in use to determine
-
BJDealCard(recipient,facedown...
This function will deal a card to the dealer
-
BJDealerHits(handles)
Deal Card
-
BJDetermineWinner
Determines the winner of the blackjack hand
-
BJPlayerHits(handles)
Performs the required actions when a player decides to hit, on the hand
-
BJSetTrueCntColor(handles)
Sets the color of the True Count string that is output to the screen based
-
BJSuggest(UseCount, varargin)
This function uses the Player, Dealer, BJOdds and Cards structures to determine
-
BJUpdateHiLoCount(handles,Car...
Updates the Hi-Lo count, where CardSpot is the location of the card in the
-
HandsLeft(handles)
function for updating the value of Bankroll.HandsLeft when the
-
QuitGame
-
ShuffleCards(NumDecks)
This function takes the number of decks needed as an input, and outputs a
-
[oarg,varargout]=cardplot(var...
CARDPLOT Plot playing cards for card games.
-
Blackjack.m
-
View all files
from
Blackjack
by Michael Iori
Fully functional blackjack simulator
|
| BJDetermineWinner
|
function BJDetermineWinner
%Determines the winner of the blackjack hand
global BJPLAYER
global BJDEALER
global BANKROLL
for n=1:length(BJPLAYER.Total)
if BJPLAYER.Blackjack(n) && ~BJDEALER.Blackjack %Player has Blackjack
BJPLAYER.Winner(n) = 1;
if ~BJPLAYER.Splits %Only pay out 1.5x if it wasn't a split
BANKROLL.Bet(n) = BANKROLL.Bet(n)*1.5;
end
elseif ~BJPLAYER.Blackjack(n) && BJDEALER.Blackjack %Dealer has Blackjack
BJPLAYER.Winner(n) = 2;
elseif BJPLAYER.Blackjack(n) && BJDEALER.Blackjack %Both have Blackjack
BJPLAYER.Winner(n) = 0;
elseif BJPLAYER.Bust(n) %Player Busts
BJPLAYER.Winner(n) = 2;
elseif BJDEALER.Bust %Dealer Busts
BJPLAYER.Winner(n) = 1;
elseif (BJPLAYER.Total(n) > BJDEALER.Total) %Player beats Dealer
BJPLAYER.Winner(n) = 1;
elseif (BJDEALER.Total > BJPLAYER.Total(n)) %Dealer beats Player
BJPLAYER.Winner(n) = 2;
elseif (BJPLAYER.Total(n) == BJDEALER.Total) %Push
BJPLAYER.Winner(n) = 0;
end
end
|
|
Contact us at files@mathworks.com