Jenga ¡ B ED2 F DG I HI H9 HI DPQ# , where DRS £T DR2DRUGV

Jenga
Uri Zwick
Abstract
Jenga is a popular block game played by two players. Each
player in her turn has to remove a block from a stack, without
toppling the stack, and then add it the top of the stack. We
analyze the game mathematically and describe the optimal
strategies of both players. We show that ‘physics’, that seems
to play a dominant role in this game, does not really add
much to the complexity of the (idealized) game, and that
Jenga is, in fact, a Nim-like game. In particular, we show
that a game that starts with full layers of blocks is a win
, or
for the first player if and only if
and
. We also suggest some several natural extensions
of the game.
1 Introduction
Jenga, see Figure 1, is a popular block game played by
players of all ages around the world. We analyze an idealized
version of this game and show that it is equivalent to a very
simple Nim-like game. (See Berlekamp et al. [BCG82] for
Figure 1: A typical position in the game of Jenga.
information on Nim and similar games.) We then give a
complete solution of this simple combinatorial game, giving
the optimal strategies of both players. We also consider some
In a real game of Jenga, when a player tries to remove a block
natural physical, and non-physical, generalizations of Jenga.
from the stack, she inevitably changes, by small amounts,
the position of some of the other blocks. We consider an
2 Rules of the game
idealized version of the game in which each player simply
chooses the block to be removed. This block is then carefully
wooden blocks each of dimenThe game is played using
removed by a robot, without changing the positions of the
sions
. In the commercially available game,
.
other blocks. The resulting tower then either continues to
The initial position of the game in an -level tower of dimenstand, or it collapses. The same holds for the placement of
sions
. Each level is composed of three adjacent
the removed block on the top of the tower.
blocks that are at right angles to the blocks of the level below
them. The two players then take turns alternately. The official instructions attached to the game say that each player, 3 Stability of towers
in her turn, has to remove a block from anywhere below the
highest completed level, and then stack it on top of the tower, A stack of blocks of height is represented by a -tuple
at right angles to the blocks just below it. The stacked block
, where
,
should not start a new level, unless the highest level is full. for
. We assume that the dimensions of each block
The player that topples the tower loses the game.
are
. If
, then there is a block in the th slot of the -th level, i.e., at
,
if is odd, and at
, if is even.
Jenga (R) is a Milton Bradley Game.
School of Computer Science, Tel Aviv University, Tel Aviv 69978, We refer to such a stack as an alternating tower, or just a
Israel. E-mail address: [email protected]. This research was tower, for short. For example, the tower shown in Figure 1
supported by the ISRAEL SCIENCE FOUNDATION (grant no. 475/98).
is
.
!" #"
(
)*
$%'&
+
+
-, .,/
1010'01
,23
,456,4 ,47/8,94 ";:<>= '? "A@ <B=== ?
DCFEGCH+
# " " , 4JIKL IPO I
M
R
4
O
4
=
E
N " "Q N ' Q (N " "Q
E
N = '
Q SN IPO " I" Q SN 4RO " "4 Q E
T
= 1
= 1 = '
101010 R, ., / '01010'
., 2 D EFINITION 3.1. (S TABILITY ) A tower
is
said to be stable if and only if a physical realization of it does
not collapse, even if blocks are very slightly displaced from
their intended positions. A tower is said to be semi-stable if
and only if an exact physical realization of it might stand, at
least temporarily, but an infinitesimal displacement of one of
its blocks would collapse it.
:V < == == ? , then c1eijR, , / €
, ., / 
/
/
N" " Q [
N" " Q
C LAIM 3.2. If
.
The proofs of these claims are given below. We show first
that they imply the validity of the lemma.
+
R, ., / '01010'
., 2 +‚ƒ
We show first, by induction on , that if
is valid, then it is stable. We already know that the claim
holds for
. Suppose therefore that
.
is valid, then
is It is easy to see that if
is also valid. By the induction hypothesis,
,
is stable. We only have to show, therefore, that
is
. This follows
immediately from the two claims.
+ U
-, .,/
1010'0P
.,U2
R= = , .,/
'010101
.,U2= =
,4FW
V and ,4F V - ,/
10'010'
.,U23
- ,/
10'010'
.,U23
XCY
= =E
Z%
= += 1
== +[= %
= = = == -B, 2>, O\ =/
.,U2B
O= =
.,U
12 = = c11d e9fB-,/
., " 1010'01
,23qo :„u e9fBRc1eiR, .,/'.
T = = = == B
We next show, again by induction on + , that if
L EMMA 3.1. (S TABILITY L EMMA ) A tower is stable if and -, ., / 1010'01
, 2 is not valid, then it is not stable. If
only if it is valid.
-, / ., " 1010'01
, 2 is not valid, then by the induction hypothesis, it is not stable, and R, , / 10'010'
., 2 is not staProof: By elementary physics, a tower of height + is stable ble either. Suppose, therefore, that -,9/
., " 1010'0P
.,U2 is
== . (The case , = == = is identiif and only if, for every !CYE]Z^+ , the center of gravity of valid, but ,
c1: eijR, / ,9/Bv…†/ N " Q N 1 Q , while
cal.)
But
then
clearly
levels E`_a up to + lies above the interior of the convex hull
"
1
c
1
d
9
e
B
f
.
R
,
/
,
1
'
0
1
0
'
0
.
U
,
2
T
o
B" " ~B" " and the claim folof the area of contact between levels E and Eb_Y . A tower
lows.
is semi-stable if for some E , the center of gravity lies above a
D EFINITION 3.2. (VALIDITY ) A tower
said to be valid, if and only if
for every
, and if
then
,
not one of
and
.
boundary point of the convex hull of the contact area.
All that remains, therefore, is to prove the two claims:
Pc d'e9f'R, ., / '010101
., 2 Proof: (of Claim 3.1) The inspection used to verify the claim
R, ,9/
10'0101
,U23
g h
of the lemma for +‡ˆ also shows that for every valid
cPeijR, .,/'
g h
/
/
tower -, .,/' we have c1d1e9fB-, .,/B : >" " SN‰" " Q . (It
to check, for example, that the tower that minimizes
R, ,/' k$lg .gm/> : n /
kop%Rgm/
qg istheeasy
h
coordinate of c1d1e9fB-, .,/B is = = 1 == , and that the
R, .,/
'01010'
.,U23
is then " . Now, it is also easy to check that if
cPd'e9fBR, 4sr ., 47rtu / '010101
., 2 To :Lu e9f3RcPei`-, 4 , 4sr q h, coordinate
/
/
=
=
%
V
and , V == , then cPd'ef>R, : " " " " . As
vCHEwZ6+
x 1c d1e9fB-, ., / 1010'01
, 2 is a weighted average of c1d1e9fB-, and
ef>Rx
c1Š d1e9fB-, / ., " 0'010'
., 2 , the claim follows easily by induction.
cPd1e9f>R, 47r , 4sr/ 1010'01
, 2 qo : c1eijR, 4 , 47r DCEyZS+
E cPd'ef>R, 4sr , 47r/ 10'0101
, 2 o
The proof of Claim 3.2 is immediate. This completes the
Š
cPe9ij-, 4 ., 4sr proof of the stability lemma.
Let
be the projection of the center of
gravity of the tower
on the - plane. Let
be the projection, again on the - plane, of
the area of contact between the first and second levels of the
tower
. If
I , we let
.
More formally then, a tower
is stable if and
only if
,
for
, where
denotes the interior of a set .
The reverse operation is needed here as the orientation of
the layers alternates. (A tower is semi-stable if and only if
, for
,
and for at least one such ,
is on
the boundary of
.)
It is easy to check, by inspection, that a 2-layer tower
is stable if and only if it is valid. The only towers
that are non-stable and non-valid have
. 4 Combinatorial formulation
These towers are not even semi-stable. (Recall that the even Each position in the game is, therefore, characterized by a
numbered levels are rotated by
.)
, for some
. In the initial
valid tower
position,
.
The
rules of the
It is also easy to check that a 3-level tower
game
instruct
each
player
to
“remove
a
block
from
anywhere
is stable if and only if it is valid. Here the situation is
below
the
highest
completed
story.
Then
stack
it on top
a little bit more interesting. The towers
,
of
the
tower,
at
right
angles
to
the
blocks
just
below
it.”
,
and
are
If
follows
easily,
by
induction,
that
in
any
tower
obtained
semi-stable and are therefore defined not to be valid.
during a valid game of Jenga, we have
or
To prove the claim for higher towers, we need the following
. (Note, in particular, that this means that no semiclaims:
stable towers can be encountered during the game. Is this the
rational behind the requirements that blocks should only be
C LAIM 3.1. If
is a valid tower, and
, removed from stories below the highest completed story, and
then
.
not, for example, from anywhere below the top story?)
R, ,9/B
{ =9|
= = = = = = B = = = 1
== : < == == ?
, z
R, ., / '010101
., 2 +F‹
, L
, / Œ0'010L, 2 Ž
-, ., / ., " = = = = = = = = ' == =
q B
,U2;%
R, .,/
'01010'
.,U23
c1d1e9f'-, .,/
1010'0P
.,U2 : " /" ~ " /" +$}
,U2BO 
The configuration of blocks at each of the levels of a valid
tower, except possibly the highest level, is, up to symmetry,
of one of these types: III, II-, I-I, -I-, where I denotes a block,
and - denotes an empty position. Levels of type I-I and -Iare inactive, in the sense that any block removed from them
would topple the tower. There are, therefore, only three types
of moves that a player can make without toppling a tower:
I-I
Remove the middle block from a story of type III.
II-
Remove a side block from a story of type III.
-I-
Remove the side block from a story of type II-.
5 Analysis
–!lgt
.h`
.
Rgt
.h\
9
 :F<>= 1
U?
Let
be the value of position
, where the
value of a position is 1 if the first player can force a win from
this position, and 0 otherwise. Clearly, for
we
have:
—˜˜
˜˜
˜˜
˜
™˜
˜˜
˜˜
˜˜š
–#lg8
qh`
.
—
@ h`
._}B › œ
@ u e ™ š –!l–#g Rg@ qh
q_}
_H>
–#Rgt
qh @ ._}B 
@ u eŸ –#Rg @@ = ._}B
–#Rg 1
._}B¡ @ –! = .h @ _H>
=
u7ž g$“ = qh#“ = u7ž $g “ = qhv = 7u ž Xg = qh#“ = 7u ž Xg Hhv = The name given to each type of move is the configuration in
which the corresponding level is left after this move. In each
case, the removed block is placed at the top level, at right
angles to the blocks below it. (Actually, the rules do not
specify where at the top level this block should be placed.
while
But, as it is placed on top of a full story, it follows from the
stability lemma that if the removal of the block did not topple
the tower, placing that block at any position on the top level
would not topple it either.
This gives a simple recursive procedure for computing
for any
. Would this recursive procedure
As a further consequence of the stability lemma, note that
always
halt?
Yes,
as,
for
example,
each recursive call deif there are several levels at which a given type of move
creases
by
at
least
,
while
the ‘normalization’
may be applied, then it does not matter which one of these
rule
does
not
increase
it. (The exlevels is chosen. In other words, a position in the game is
istence
of
some
weight
function
that
could
be
used
to show
characterized, combinatorially, by a triplet
, where:
that the recursion is well defined is not surprising. We know
that each Jenga game must end as each move raises the cen– number of III levels, below highest full level.
ter of gravity of the tower.)
– number of II- levels, below highest full level.
Let
–!lgt
.h`
.’–!lgv_}
.h\
= ¢0
lg8
qh`
.
g
h
–!lg8
qh`
.
lg8
qh`
.
£
g;_^/ h_^" 
lg8
qh`
.9‘¤lg!_6
.h\
= ¥
¨=© = ¨ =¨= = ª«
©¨ ¨
0
¥ ަ§ =
= = ¨ ¥ ¨©
Here gt
.h are non-negative integers, while  :z<>= '
U? .
¥ let Rgt
qh`
9 , where
¥ g8
qh`
. :Y<B= 1
? be the lgt
.h¬ -th
Note that the number and type of the inactive levels is We
not recorded, as it has no influence on the continuation of element of the  -th matrix defining . Thus, for example
the game. The three possible moves, in this notation, are
= 1
­ = while -¬¥3
1® = ­% . We also let
therefore:
N = = Q 0
@
=
I-I
Rgt
.h\
9y‘’lg .h\
_H> (valid if g”“ ), We claim:
Rgt
.h\
9y‘’lg @ qh_H
.w_S> (valid if g$“ = ), THEOREM 5.1.
II¥
-IRgt
.h\
9y‘’lgt
.h @ _H> (valid if hX“ = ),
¥3®
–!lgt
.h`
.[
3g!vUw
Uh¯vUw
¬G if gK“ = or =#“ = ,
where position Rgt
.h\
, when it occurs, is immediately
Ÿ
if g°H¯
.
3h¯vUG
converted to Rgv_}
qh`
= .
@
Š
= = ,
A tower of full levels corresponds to position l

– number of blocks on top of the highest full level
= = 9
 B< = '
•?
as only full levels below the highest full level are counted.
The positions
, where
, are losing positions,
as the player whose turn is to move has no legal moves.
Proof: By simple induction.
g° = 1
GU]
In particular, we get that
or
and
–!lg8
= = y^ , if and only if g°Y ,
g”S . (Consult the first column of
¥
the first matrix in the definition of .) It follows, therefore,
that a game that starts with a tower of height is a win for
the first player if and only if
, or
and
.
”a
(
°%
•wU[
I-I
-I-
II-
³
± ²² I-I ³ II- I-I
II²²
§ ³ -I- ³ -I-³
®
and
± %9N ³
-I-
³
³
I-I
II-
II-I-
I-I
-I-
³ «
II-
I-I
I-I
II-
I-I
II-
I-I
³Q0
-I-
+X“
2
ªµ´´
-I-
2
Open problem 2: What is the complexity of determining
, is a win for
whether a given position in Jenka , for
the first player?
The optimal moves from any position are given by:
¦²²
Open problem 1: For which values of can the first player
force a win in a game of Jenka that starts with -full levels,
where
is an odd number?
´´
´´
7 Concluding remarks
+¡“º
"
We presented a complete analysis of Jenka . Analyzing
Jenka , for
,
odd, remains a challenging open
problem.
2
+‚“» +
References
± g¶vUw
l gt
.h`
.
gp“ = °® “ =
h·= Uv= ¬G
± 3 h·U
.h`
®
lg8
qh`
1> g‡ˆµvU­9
h° ± = ‰± ¸
³
More specifically, the optimal move(s) from position [BCG82] E.R. Berlekamp, J.H. Conway, and R.K. Guy. Winning
, where
or
, are given by
Ways for your mathematical plays, volume 1. Academic
Press, 1982.
, while the optimal move(s) from position
, are given by
. From some positions, there are several optimal moves. In particular, from
positions of the form
, where
and
, all three moves are winning moves! Entries
in
and
containing correspond to loosing positions,
so all moves from these positions are loosing moves. The
claim that these are indeed the optimal moves can again be
verified by induction.
There does not seem to be a more compact way of characterizing the winning positions in Jenga, and the optimal moves
from each position. Note, however, that the characterization
given is very compact. Given the constant-size arrays and
, we can find an optimal move from any position in constant time.
®
±
±
6 Generalization
We suggest the following natural generalization of Jenga,
called Jenka . This game is played by blocks of dimension
, and each layer in the initial tower is composed of
such blocks. The rules of the game remain unchanged. As
pointed out by one of the reviewers, the starting position of
Jenka , for even , is a win for the second player, as the
second player can always play a move that is the mirror
image of the move played by the first player. Analyzing
Jenka , for
, odd, seems to be a more challenging
task. Our analysis of Jenka relied heavily on the stability
lemma that implied, among other things, that two towers
that contain the same number of layers of each type are
equivalent. Unfortunately, this claim does not hold when
. Thus, at least potentially, there may be an exponential
number of non-equivalent towers with a given number of
blocks.
+
2 2 °
2
+
2
+!(
2
+H“¹ +
"