Transcript Barcelona

The game of Barcelona
databases, evolution, and reverse tessellation
through the eyes of a gambler
Keith Clay GRCC
First a word from…
Excessive Gambling
is not cool!
And now a word from…
Excessive study of
gambling is a time
honored tradition.
Laplace
Poisson
Cauchy
The game of
Barcelona
The game of Barcelona
According to legend…
It was invented on a Mediterranean island
when two brilliant
mathematicians
were shipwrecked.
( island )
The game of Barcelona
Their names are lost to history.
We know them
only as Mr. Red
and Mr. Blue.
The game of Barcelona
They played a game using only blue and
red seashells…
… drawn blindly,
one at a time.
The game of Barcelona
Shells are drawn one at a time.
Whichever color has more shells showing
after a given draw wins that round.
What was the score for this game?
Let’s do it again.
The game of Barcelona
The
Shells
firstare
second
third
fourth
fifth
sixth
This
shell
shell
shell
drawn
shell
shell
could
is
is
isis
red.
blue.
is
red.
blue.
one
red.
blue.
also
at be
a time…
called
There are
is one
more
2
3
•red
red
a score
shells
red
shell
shells
ofand
and
-1 we
for
than
32two
one
blue
red
blue
blue
shells.
shell.
shells.
…
so
draw
one.
Red
Round
N
>N
=
two
round
•
.is or
a tie.
aone.
score
Blue
The
The
Blue
score
of
score
scores
scores
+1 is
for
isone
unchanged.
unchanged.
one
blue
point.
point.
bluewins
red
This
The score
gameis:
can be RED
played solitaire.
BLUE
0
1
2
Or against a 1casino.
The game of Barcelona
If you
In
a casino:
are betting in a casino…
• Do
Theyou
game
want
cantobebeplayed
red orwith
black?
cards.
• Does
Only the
it matter?
color matters.
(If not why not?)
The game of Barcelona
This game would not be very interesting...
…if it were not for a seagull.
Now would you want
to be blue or red?
The game of Barcelona
With
To even
n blue
the shells
odds,
and
it was
n + agreed
1 red shells,
that
blue
Mr.would
Red had
score
anon
turnsadvantage.
when drawing
a shell produced a tie.
The game of Barcelona
This new
Under
game
the is
new
called
rules,
Barcelona.
Would
whoyou
has rather
the advantage?
be blue or red?
The score is:
RED
BLUE
1
2
3
0
1
2
The game of Barcelona
You get $1 for each round you win.
Casinos can play Barcelona with
You lose $1 for each round you lose.
decks of 51 cards (26 red, 25 black)
Do you want red? Black?
What are your odds?
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which scores are most likely?
• What will be the average score?
• Who cares? Is this any more than a game?
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which scores are most likely?
• What will be the average score?
• Who cares? Is this any more than a game?
Red or Black?
POSSIBLE SCORES:
With 26 red cards and 25 black…
• You can win 51 rounds ( +$51 ahead)
• You can win 50 and lose 1 ( + $49 )
• You can win 49 and lose 2 ( + $47 )
•…
• You can lose 51 rounds ( - $51 )
Can BOTH COLORS win $51? Lose $51?
Red or Black?
Observation:
Given (n+1) red cards and (n) black cards,
• Red can win 2n+1 rounds.
• Black cannot.
Redcan
wins
loses dollars
$4. Score
- $3only
for red.
Red
win$1,
(2n+1)
but=can
lose
(2n-1) dollars. Both appear equally likely.
Red winsNow
$5, loses
$0. the
Score
= +$5 for red.
reverse
order.
Red or Black?
The score was:
RED
BLUE
2
3
Remember these shells?
Thereversing
score is: the order
RED again.
BLUE
Try
4
1
Red or Black?
Conjecture (not a proof):
• Reversing the order of a set of cards turns a
“good” hand into a “bad” hand.
• The midpoint of “good” and “bad” is:
[ (2n+1) + (-(2n-1)) ] / 2 = 1 net win for red.
• “Forward” and “Reverse” orders of a set of
cards are equally likely.
• So on average, red gains 1 win per hand.
Does Barcelona favor Red?
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which scores are most likely?
• What will be the average score?
• Who cares? Is this any more than a game?
Running the Table
• To win $51, red has to win every round.
• That means there will always be more red
cards showing than black. How likely is that?
• One way to find an answer:
• Count the number of arrangements where there are
always more red the black ( reading right to left)
• Divide by the number of possible arrangements.
Running the Table
• How many ways are there to arrange 51 cards?
• 51 choices for the first card, 50 choices for the
second card, 49 choices for the third…
• 51 50  49 …  3 2  1 = 51!  1066
• But wait!
Not all of those 1066 arrangements are different!
We might not need to check 1066 arrangements.
Running the Table
•
the number
distinct
arrangements
of
• So
Rearranging
theofcards
(or seashells)
of one
these
five shells
is:
color does
not change
the score.
5!

 10
3! 2!
All 3! arrangements of these
shells produce possible
the same score.
N
All 2! arrangements of these
shells produce the same score.
Running the Table
• The number of distinct arrangements of 26 red
cards and 25 black cards is:
N possible
51!

 250, 000, 000, 000, 000
26! 25!
• Calculating the Barcelona score of each
arrangement would take a very long time.
Running the Table
CRUCIAL QUESTION:
• How many ways are there to run the table
in a Barcelona game with (2n+1) cards?
This is a question with many applications.
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which scores are most likely?
• What will be the average score?
• Who cares? Is this any more than a game?
Barcelona-like problems:
The parentheses problem:
• Given n left and n right parentheses,
how many arrangements are possible
that leave all parentheses closed?
(())()
Good
())()(
Bad
Barcelona-like problems:
The parentheses problem:
• In
information
The
problem is science:
crucial to allocation of
How many
possible relationships
are
memory
in databases
and networks.
there for n categories & subcategories?
(a(b))(c)
One relationship
(a(b(c)))
Another
Barcelona-like problems:
The parentheses problem:
• Color coding shows this is the same as
“running the table” in Barcelona
Barcelona-like problems:
Evolution and Genetics:
• How are creatures (or people) related?
• What is the family tree of this group?
• Who branched off when?
Dinosaur
Amphibian
Reptile
Bird
Barcelona-like problems:
Dinosaur
Amphibian
Reptile
Bird
A possible family tree
Amphibian Reptile
Dinosaur
Bird
Another possibility
How many possible trees are there?
Barcelona-like problems:
“Planted binomial trees”
•
Start
at theof
bottom
The
number
family
• trees
Whenfor
you
come
to a
(n+1)
critters
node,
turn left
is
the same
as the
of of
ways
to run
• number
At the end
a branch,
the
with (2n+1)
turntable
around
(or seashells).
• cards
Left branches
are red,
right branches are blue
Barcelona-like problems:
Reverse tessellation:
Euler
solved
problem
by to
• How
manythe
ways
are there
induction
in a process
dissect a polygon
intohe
called
“quite
laborious.”
triangles
using
only nonEugene
Catalandiagonals?
returned to the
intersecting
problem a century later. The
answers to this day are called
the “Catalan numbers.”
Leonhard Euler
Eugene Catalan
Barcelona-like problems:
Reverse tessellation:
• The connection to Barcelona,
databases, and trees?
Solving Barcelona
• Given (n+1) red shells, and (n) blue,
“cut the deck”
A
B
One of the new groups
must have more red than
blue. Call it group A.
The other group cannot
have more red than blue.
Call it group B.
Solving Barcelona
• If A precedes B, the score (for red)
must be higher…
A
B
… than it would be if B preceded A.
A
Solving Barcelona
For any arrangement of cards or shells,
• a “cut of the deck” will change the score.
• Math lingo:
“cutting the deck” = “cyclic permutation”
• No arrangements connected by a cyclic
permutation will have the same score.
Solving Barcelona
The “Pigeonhole Principle”
• Snow White lived with
little people.
• Name them: Happy,
Dopey, Sleepy, Gumpy,
Sneezy, Bashful, and Doc.
• Is that all of them?
Solving Barcelona
Solving Barcelona
The “Pigeonhole Principle”
• If you need N answers, all different…
• And you find N answers, all different…
• You’re done.
Solving Barcelona
Given (n+1) red cards and (n) black cards:
• There are (2n+1) possible scores for red:
• +(2n+1), +(2n-1), +(2n-3), … -(2n-3), -(2n-1)
• Every cyclic permutation (cut of the cards)
produces a different score.
• There are (2n+1) cyclic permutations.
• Every possible score appears once.
• Each cyclic permutation is equally likely.
Solving Barcelona
Every possible score is
equally likely!
Every score has a
probability of 1/(2n+1).
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which
scores
arepossible
most likely?
There
are 51
scores.
• What
will
be the average
score?
The
probability
is 1/51.
• Who cares? Is this any more than a game?
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which
scores
arepossible
most likely?
There
are 51
scores.
• What
will
be the average
score?
The
probability
is 1/51.
• Who cares? Is this any more than a game?
The game of Barcelona
With 26 red cards and 25 black…
• Do you want to be red or black?
• What is the probability of winning $51?
• What is the probability of winning $11?
• Which scores are most likely?
• What will be the average score?
None.
• WhoAll
cares?
Is this
any more
than a game?
scores
are equally
likely.
The game of Barcelona
Each score is equally likely.
With 26 red cards and 25 black…
Add the scores and divide by (2n+1).
• Do you want to be red or black?
The
add up toof
(2n+1).
• What
isscores
the probability
winning $51?
• What
the probability
winning $11?
On is
average,
red wins of
a dollar.
• Which scores are most likely?
• What will be the average score?
• Who cares? Is this any more than a game?
The game of Barcelona
How many databases, family trees,
With 26 red cards and 25 black…
reverse tessellations, and all that?
• Do you want to be red or black?
• What is the probability of winning $51?
  2n  1 !   1    2n  ! 
• What
of
winning
$11?

 is the probability
 


 

n

1
!
n
!
2
n

1
n

1
!
n
!




 most likely?



• Which
scores are
• What will be the average score?
• Who cares? Is this any more than a game?
Acknowledgements:
I’d like to thank the following branches of
mathematics for appearing in this talk:
•
•
•
•
Probability
Combinatorics
Graph theory
Group theory
•
•
•
•
Information theory
Formal logic
Set theory
Fun
Acknowledgements:
Most of all I’d like to thank …
Martin Gardner
Possibly the world’s best
mathematical author.
Read his books.
Questions?