mowgli
mowgli
  • Threads: 1
  • Posts: 1
Joined: Jan 29, 2012
January 30th, 2012 at 1:08:38 AM permalink
Hello Wizards,

I was bored one afternoon and thought to myself: Why don't I program my own system analyser?

So that's exactly what I did. But when I ran it I got a strange result. I got a winning result...

(note that I am aware that the program assumes that you have unlimited money available to you outside of the casino, but that shouldn't help you defeat the odds)

So the rules are as follows:
Starting bet is of 1 unit.
You have a bankroll of 512 units.
Win limit per trial is 10 units.
Loss limit is entire bankroll.
The version of Baccarat is commission free bank wins on 6 pays 1 to 2.
Upon loss you double your previous bet.
Upon win your next bet is 1 unit.
Upon a win on bank with 6 your next bet is half your previous bet.
The first bet (player or banker) is chosen at random.
Every bet there after is placed on the opposite side (eg: P, B, P, B, P, ...)
Each shoe is played until less than 15 cards remain.
The shoe has 8 decks.
Each trial begins with a full bankroll of 512 units, commences with a bet of 1 unit and ends upon a loss of entire bankroll or win of 10 units. After each trial the shoe is shuffled.

The program is set to run 1,000,000 trials. At the end it displays how many winning trials there were and how many losing. It displays the win/loss percentage and the actual dollar value of said win or loss.

The win or loss is calculated by:
wins*10 - losses*512

The strange thing was I kept getting results such as the following:

989054 wins to 10946 losses.
This estimates winning at 98.91% of the time.
This has an implied win/loss of 4286188 dollars.


How can I possibly be winning after a million trials?

I know better than to believe my results. Is there anyone out there who can think of where my mistake lies?

In case I got the dealing of the tableau wrong I am pasting the code here for the dealing of the cards:

%Deals a hand of baccarat.

%Initialise variables
hand = zeros(3,2);

%Draw first 4 cards
for i = 1:2
for j = 1:2
drawCard = randi([1, sum(c)]);
hand(i,j) = point(drawCard, c);
c((hand(i,j)+1)) = c((hand(i,j)+1)) - 1;
end
end


%Establish the score after the initial deal
score = sum(hand);
while score(1)>9
score(1) = score(1) - 10; %reduce the player total to below 10.
end
while score(2)>9
score(2) = score(2) - 10; %reduce the banker total to below 10.
end

%Check for natural winners
if (score(1) == 8 || score(1) == 9 || score(2) == 8 || score(2) == 9)
winner = compare(hand);
return;
end

%Check for 6/7 stand for player
if (score(1) == 6 || score(1) == 7)
if score(2) < 5
drawCard = randi([1, sum(c)]);
hand(3,2) = point(drawCard, c);
c((hand(3,2)+1)) = c((hand(3,2)+1)) - 1;
winner = compare(hand);
return;
else
winner = compare(hand);
return;
end
end

%Draw a card to the player
drawCard = randi([1, sum(c)]);
hand(3,1) = point(drawCard, c);
c((hand(3,1)+1)) = c((hand(3,1)+1)) - 1;

%Check for banker total 7
if (score(2) == 7)
winner = compare(hand);
return;
end

%Check for banker total of 0 - 2 or player draws 6 or 7
if ((score(2) < 3) || (hand(3,1) == 6) || (hand(3,1) == 7))
drawCard = randi([1, sum(c)]);
hand(3,2) = point(drawCard, c);
c((hand(3,2)+1)) = c((hand(3,2)+1)) - 1;
winner = compare(hand);
return;
end

%Check for player draws 8
if (hand(3,1) == 8)
winner = compare(hand);
return;
end

%Check for banker total of 0 - 2 or player draws 6 or 7
if ((score(2) < 3) || (hand(3,1) == 6) || (hand(3,1) == 7))
drawCard = randi([1, sum(c)]);
hand(3,2) = point(drawCard, c);
c((hand(3,2)+1)) = c((hand(3,2)+1)) - 1;
winner = compare(hand);
return;
end

%Check for banker has 3
if (hand(3,2) == 3)
%Draw on bank
drawCard = randi([1, sum(c)]);
hand(3,2) = point(drawCard, c);
c((hand(3,2)+1)) = c((hand(3,2)+1)) - 1;
winner = compare(hand);
return;
end

%Check for player draws 2 or 3
if ((hand(3,1) == 2) || (hand(3,1) == 3))
%Draw on bank on score of 4 or less
if score(2) < 5
drawCard = randi([1, sum(c)]);
hand(3,2) = point(drawCard, c);
c((hand(3,2)+1)) = c((hand(3,2)+1)) - 1;
winner = compare(hand);
return;
end
end
winner = compare(hand);

SOOPOO
SOOPOO
  • Threads: 123
  • Posts: 11521
Joined: Aug 8, 2010
January 30th, 2012 at 2:33:07 AM permalink
You got lucky. Variance was on your side.
gameterror
gameterror
  • Threads: 2
  • Posts: 57
Joined: Jan 30, 2012
January 30th, 2012 at 2:45:29 AM permalink
can you post your bankroll code ? and did you run single trials and check your bankroll in the end ?
my guess is that your actual bankroll in the end might be less than zero. meaning that you lost more than 512 units.
Things have never been so swell I have never failed to fail
  • Jump to: