UNO Analysis Redux
UNO Analysis Redux
Card Semantics
Predicates are a function p from some set X to the set {T, F} where, for x ∈ X and some set P,
p(x) = T if x ∈ P and p(x) = F if x ∉ P. In other words, for p: X → {T, F} and some set P:
|U| = 60
U can be thought of as the set of all possible card types given the sets of basic characteristics
Colors and Numbers. In contrast, a collection of cards Deck can be considered the collection of
instances of the elements of U. To formalize the deck with Deck, we can use the concept of a
multiset.
The Universe for the multiset Deck is U. Thus:
Deck = ⟨U, Q⟩
Where Q: U → ℕ is the multiplicity assignment function.
We can define new sets to help define Q. These sets will come up later:
WC = { M }
WN = { W, ˖4 }
Such that:
WC ⋃ WC = Colors
WN ⋃ WN = Numbers
Thus:
|Deck|= 108
Before play, the deck can conceptually be divided into certain categories, as shown above. These
categories can then be formalized as submultisets of Deck:
Yellow = [ {Y, 0}, {Y, 1}, {Y, 1}, {Y, 2}, {Y, 2}, {Y, 3}, {Y, 3}, {Y, 4}, {Y, 4}, {Y, 5}, {Y, 5}, {Y,
6}, {Y, 6}, {Y, 7}, {Y, 7}, {Y, 8}, {Y, 8}, {Y, 9}, {Y, 9}, {Y, }, {Y, }, {Y, }, {Y, }, {Y, ˖2}, {Y, ˖2}
]
Red = [ {R, 0}, {R, 1}, {R, 1}, {R, 2}, {R, 2}, {R, 3}, {R, 3}, {R, 4}, {R, 4}, {R, 5}, {R, 5}, {R, 6},
{R, 6}, {R, 7}, {R, 7}, {R, 8}, {R, 8}, {R, 9}, {R, 9}, {R, }, {R, }, {R, }, {R, }, {R, ˖2}, {R, ˖2} ]
Blue = [ {B, 0}, {B, 1}, {B, 1}, {B, 2}, {B, 2}, {B, 3}, {B, 3}, {B, 4}, {B, 4}, {B, 5}, {B, 5}, {B, 6},
{B, 6}, {B, 7}, {B, 7}, {B, 8}, {B, 8}, {B, 9}, {B, 9}, {B, }, {B, }, {B, }, {B, }, {B, ˖2}, {B, ˖2} ]
Green = [ {G, 0}, {G, 1}, {G, 1}, {G, 2}, {G, 2}, {G, 3}, {G, 3}, {G, 4}, {G, 4}, {G, 5}, {G, 5}, {G,
6}, {G, 6}, {G, 7}, {G, 7}, {G, 8}, {G, 8}, {G, 9}, {G, 9}, {G, }, {G, }, {G, }, {G, }, {G, ˖2}, {G, ˖2}
]
Wild = [ {M, W}, {M, W}, {M, W}, {M, W}, {M, ˖4}, {M, ˖4}, {M, ˖4}, {M, ˖4} ]
0 = [ {Y, 0}, {R, 0}, {B, 0}, {G, 0} ]
1 = [ {Y, 1}, {Y, 1}, {R, 1}, {R, 1}, {B, 1}, {B, 1}, {G, 1}, {G, 1} ]
2 = [ {Y, 2}, {Y, 2}, {R, 2}, {R, 2}, {B, 2}, {B, 2}, {G, 2}, {G, 2} ]
3 = [ {Y, 3}, {Y, 3}, {R, 3}, {R, 3}, {B, 3}, {B, 3}, {G, 3}, {G, 3} ]
4 = [ {Y, 4}, {Y, 4}, {R, 4}, {R, 4}, {B, 4}, {B, 4}, {G, 4}, {G, 4} ]
5 = [ {Y, 5}, {Y, 5}, {R, 5}, {R, 5}, {B, 5}, {B, 5}, {G, 5}, {G, 5} ]
6 = [ {Y, 6}, {Y, 6}, {R, 6}, {R, 6}, {B, 6}, {B, 6}, {G, 6}, {G, 6} ]
7 = [ {Y, 7}, {Y, 7}, {R, 7}, {R, 7}, {B, 7}, {B, 7}, {G, 7}, {G, 7} ]
8 = [ {Y, 8}, {Y, 8}, {R, 8}, {R, 8}, {B, 8}, {B, 8}, {G, 8}, {G, 8} ]
9 = [ {Y, 9}, {Y, 9}, {R, 9}, {R, 9}, {B, 9}, {B, 9}, {G, 9}, {G, 9} ]
= [{Y, }, {Y, }, {R, }, {R, }, {B, }, {B, }, {G, }, {G, } ]
= [ {Y, }, {Y, }, {R, }, {R, }, {B, }, {B, }, {G, }, {G, } ]
˖2 = [ {Y, ˖2}, {Y, ˖2}, {R, ˖2}, {R, ˖2}, {B, ˖2}, {B, ˖2}, {G, ˖2}, {G, ˖2} ]
W = [ {M, W}, {M, W}, {M, W}, {M, W} ]
˖4 = [ {M, ˖4}, {M, ˖4}, {M, ˖4}, {M, ˖4} ]
Such that:
Deck=0 ∪ 1 ∪2∪3 ∪4 ∪5 ∪ 6 ∪ 7 ∪8 ∪ 9 ∪∪ ∪˖ 2∪ W ∪ ˖ 4
Deck=¿ ∪¿ ∪ ¿ ∪ ¿ ∪ Wild
We can define new sets:
DColors = {Yellow, Red, Blue, Green, Wild}
DNumbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, d, f, W, g}
With these multisets, an easier way of defining the color of a card x is defined. We can create a schema
assigning each color to one of these multisets as the formal way of creating these distinctions:
For all cards x:
Y ∈x ⇔ x∈¿
R∈x ⇔ x∈¿
B∈ x ⇔ x ∈¿
G ∈x ⇔ x∈¿
0∈x ⇔ x∈0
1 ∈ x ⇔ x ∈1
2∈x ⇔ x∈2
And so on…
This schema allows us to fully discard the visual data we used to create the deck in favor of the
multisets representing those same qualities, grounding them in a framework wholly grounded on
multisets.
…
This multiset formulation, though more complicated than a potential tuple formulation of the
conceptual deck, allows us a more general framework with useful conventions and notation. On
generality, the concept of order has not yet been used. As for conventions, the multiplicity of
elements of a multiset and the support of a multiset can be used to develop more ideas:
Supp(Deck) = Supp(⟨U, Q⟩)
= { x : x ∈ U ∧ Q(x) > 0}
= { {Y, 0}, {Y, 1}, {Y, 2}, {Y, 3}, {Y, 4}, {Y, 5}, {Y, 6}, {Y, 7}, {Y, 8}, {Y, 9}, {Y, },
{Y, }, {Y, ˖2}, {R, 0}, {R, 1}, {R, 2}, {R, 3}, {R, 4}, {R, 5}, {R, 6}, {R, 7}, {R, 8}, {R, 9}, {R, }, {R,
}, {R, ˖2}, {B, 0}, {B, 1}, {B, 2}, {B, 3}, {B, 4}, {B, 5}, {B, 6}, {B, 7}, {B, 8}, {B, 9}, {B, }, {B, ˖2},
{G, 0}, {G, 1}, {G, 2}, {G, 3}, {G, 4}, {G, 5}, {G, 6}, {G, 7}, {G, 8}, {G, 9}, {G, }, {G, }, {G, ˖2},
{M, W}, {M, ˖4} }
Supp(Deck) is useful because it can be used instead of U to define Deck. If so, then the Q(x) = 0
condition in Q can be removed. It can be easily seen that Supp(Deck) is the smallest set from
which Deck can be defined, as per the use of Supp.
Deck Divisions During Play
We will utilize certain functions that will act upon multisets.
The cards in play are divided in the draw pile, discard pile, and player hands. These multisets
and stacks of cards will be designated with shorthand names due to their prominence:
Draw pile = stack R
Discard pile = stack D
Number of players = n
ith player = player i
Player hands = multisets H1, H2, …, Hn
The player hand of the ith player = multiset Hi
2 < n < 10
|R| + |D| + |H1| + … + |Hn| = 108
For all Hi, cards in R can be drawn into Hi. Cards in Hi can be discarded to D. Discarding can
also be referred to as playing. These are all player actions that require player choice.
If R = {}, D is shuffled and all cards in D move to R. This procedure is called a reset.
The topmost card of R is called r, and the topmost card of D is called d.
The set of cards that can be discarded in player i’s hand Hi is denoted by discardable(Hi). This
set is a subset of Hi, or in other words: discardable(Hi) ⊆ Hi.
Player Choices (Event Ledger?)
add
play
placeholders
Perhaps:
play(Hi) ∈ discardable(Hi)
shuffle(S ) = ?
Game Space g and Game G
We can define the Game Space (or gamespace) as an (n+2)-tuple:
g = ((R, D), (H1, H2, …, Hn)) C?
This represents the entirety of the information in a game at some turn. We can have a sequence
of gamespaces to represent a sequence of turns as such:
g1, g2, …, gm
We also define the following functions for gamespaces:
discard, draw, reset, r, d, hn
The functions in a gamespace represent the player actions detailed above and are also used to
access the gamespace’s entries. These functions require the existence of g1, g2, …, gm. They are
defined as such:
discard(gm, i) = ((R, push(D, play(Hi)), (H1, H2, …, Hi-1, pop(Hi), Hi+1, …, Hn)) = gm+1
draw(gm, i) = ((pop(R ), D), (H1, H2, …, Hi-1, add(Hi, peek(R )), Hi+1, …, Hn)) = gm+1
reset(gm)= ((pop(shuffle(D )), ⟦peek(shuffle(D ))⟧), (H1, H2, …, Hn)) = gm+1
r(gm) = R
d(gm) = D
hi(gm) = Hi
We can define a stack that represents the sequence of gamespaces throughout the game. We call
this stack a game:
Let gi be the ith gamespace in a game and let n be the number of turns in a game. Then:
Drawing and discarding are player actions that occur within a player turn. Player actions are
game events that directly require the choice of a specific player. A player turn, or turn, is the
smallest unit of uninhibited player actions for any single player. A player can draw a card just
once during their turn. Once a player discards a card, their turn ends. To discard a card, it must
share one of two qualities with the topmost card: color and number. These categories will be
clarified and analyzed later.
Resets occur strictly between turns. This is because for R = {} to occur, the last card must be
drawn by a player. To not interrupt their turn, the player must finish discarding before a reset can
be made. Since resets are independent of any player’s choices (they do not require drawing or
discarding), they can exist outside of a turn. For convenience, they do. (Expand the concept of
player choice).
The cards in the UNO deck can be conceptually separated in a number of ways: color and
number. We will focus on color next:
Color
Every card has a sense of color. Formally, two types of color are defined: proper color
and play color. Play color comes in two forms: back color, and front color. A proper color
relates to the card’s visual color. These are red, blue, green, yellow, and wild. These correspond
to the elements of Colors. Actually, a proper color is defined as any element of Colors. A play
color is an attribute of a card that affects its interaction with other cards in the discard pile.
The front color of a card x is given by a function front: Deck → Colors. Similarly, the
back color of a card x is given by the function back: Deck → Colors. Finally, the proper color of
a card x is given by a function proper: Deck → Colors. To define these functions, we will
conduct further analysis.
Most of the cards in the deck are non-wild. This designation is given to cards whose play
colors are assigned by the card’s proper color. This definition applies to cards whose proper
color is in WC . For non-wild cards, their front and back colors are identical.
In contrast, the play colors of wild cards in play are assigned differently and deeper
subtleties need to be addressed. A wild card’s back color is assigned by the front color of the
topmost card in the discard pile. Conversely, a wild card’s front color is assigned by the player
discarding it. In actuality, even the back color is technically chosen by the player discarding it.
This is because, to even discard the card in the first place, it’s back color must equal the front of
d. Thus, by choosing to discard, one is implicitly choosing to set the card’s back color to d’s
front color. This total color assignment by the ith player, called choice colors, is designated
choice. This assignment has multiple properties:
There are only 8 wild cards in the deck. Thus, only 8 or less choice colors can
exist in D at any given time.
Since play color for wild cards is only assigned when discarded, their play color is
not defined when they are in R or H1, H2, …, Hn. In those cases, it might be useful
to define the play color as W.
The choice colors can be though of as a double (b, f) called the choice color
double. The first entry corresponds to the back color, and the second entry
corresponds to the front color. All possible choices or values of choice are given
by the Cartesian product WC 2 = { (Y, Y), (Y, R), (Y, B), (Y, G), (R, Y), (R, R),
(R, B), (R, G), (B, Y), (B, R), (B, B), (B, G), (G, Y), (G, R), (G, B), (G, G) }.
By definition, the first entry of every choice color double equals the front color of
d. This is because, to choose, you must discard the wild card. To discard the wild
card, its back color must equal the front color of d. Thus, this is a requirement for
choosing in the first place else the concept be rote. In other words:
o choice1 = front(d)
Once a wild card is in D, the card has a sense of order within the stack. This order
can be used to correlate the card to one of the created choice color doubles. For
this, we need to create a choice ledger. This ledger holds all of the created choice
colors. Since these doubles are created in turns that follow each other, there is a
sense of order to the doubles (intuitively, their sequence in time). Thus, we can
create a stack L as the choice ledger. This way, we can define a mapping h: D →
L where the ith wild card is assigned the ith choice color double via a simple linear
search algorithm through the two stacks.
One final note: we need to address how the wild card is discarded into D in the
first place. This is a question because we are assigning the choice color doubles
after the card is in D. However, the assigning needs to occur before in some sense
since the assigning is what allows the card to be placed in the first place. This is
solved by the fact that the first entry of every choice color double equals the front
color of d. So this sequence of events is always viable:
o Choice double created ⇒ Choice double appended to L ⇒ Wild card
appended to D.
There is no case where this procedure fails. Thus, the function h can safely be
defined while assuming said procedure has already taken place.
We can now define two functions
o h1: D → WC that returns the 1st entry in h(x).
o h2: D → WC that return the 2nd entry in h(x).
|L| ≤ 8
This definition applies to cards whose proper color is in WC.
We can now define the front, back, and proper functions. To do so, we define an auxiliary t:
𝒫(X) → X:
t({x}) = x
proper(x) = t (x ∩Colors)
If a card’s back color equals the front color of the topmost card in the discard pile, then that card
can be discarded. In other words:
∀i[∀x[ (x ∈ Hi) → [(front(d) = back(x)) → (x ∈ discardable(Hi))] ]]
Formalizations:
∀x [¬(Wild(x)) ↔ ((front(x) = proper(x)) ∧ (back(x) = proper(x)))]
∀x [(Wild(x)) ↔ ((front(x) = h1(x)) ∧ (back(x) = h2(x))]
By looking at these two statements, we see that the notion of proper color is irrelevant for wild
cards.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
JUNK (things that I’m not sure will be used):
To define this function, we define the function index: D → ℕ
h(x) =
In theory, the 4 play colors are arbitrary designations whose only quality is distinction from each
of the other three. As we will see, this distinction ultimately derives from proper color, but is
codified in game through the notion of play color.
Finally, we define the set of all gamespaces and thus set of all games:
= {z : z is a gamespace}
Γ = {⟦x1, x2, …, xn⟧ : xi