CAN YOU WIN AT TETRIS?ByJohn BrzustowskiB. Math, University of Waterloo, 1988A THESIS SUBMITTED IN PARTIAL FULFILLMENT OFTHE REQUIREMENTS FOR THE DEGREE OFMASTER OF SCIENCEinTHE FACULTY OF GRADUATE STUDIESDEPARTMENT OF MATHEMATICSINSTITUTE OF APPLIED MATHEMATICSWe accept this thesis as conformingto the required standardTHE UNIVERSITY OF BRITISH COLUMBIAMarch 1992© John Brzustowski, 1992In presenting this thesis in partial fulfilment of the requirements for an advanced degree atthe University of British Columbia, I agree that the Library shall make it freely availablefor reference and study. I further agree that permission for extensive copying of thisthesis for scholarly purposes may be granted by the head of my department or by hisor her representatives. It is understood that copying or publication of this thesis forfinancial gain shall not be allowed without my written permission.Department of MathematicsInstitute of Applied MathematicsThe University of British Columbia2075 Wesbrook PlaceVancouver, CanadaV6T 1W5Date:AbstractTETRIS is a popular video game in which you try to fill rows in a rectangular well usinga sequence of tetrominoes chosen by the machine. Each time you succeed in filling a row,it is deleted from the well. Your game ends when you have stacked pieces up to the topof the well. I build a model of TETRIS and analyze the worst-case scenario, in whichthe machine is treated as an adversary. I say you have a winning strategy when youcan make your game last indefinitely. I construct winning strategies for some subsets ofthe TETRIS pieces, and prove that none exists for some others. Finally, I compare theseanalytic results to some empirical average-case data that I obtain from a passive surveyof TETRIS players.iiTable of ContentsAbstract^ iiList of Tables vList of Figures^ viAcknowledgement viii1 Introduction 11.1 The Real Game ^ 11.2 TETRIS meets Plato 42 Strategies 62.1 Doing well at tetris and TETRIS ^ 62.2 Telling you how to play ^ 72.3 Strategies for tetris 82.4 Meaningless numbers ^ 93 Two at a time 173.1 Squares with bars or elbows ^ 173.2 Elbow couples, single elbows, and the bar^ 224 Organic tetris and the cycle-band 264.1 Life history of flats ^ 264.2 Killing flats with squares 27in4.3 A recipe for your defeat ^ 304.4 Published recipes and two minor fallacies ^ 334.5 The cycle-band ^ 345 Kinky Sets^ 385.1 Playing in the cycle-band^ 385.2 The shield in the cycle-band 435.3 Defeating you with kinks ^ 456 Conclusion^ 496.1 Pessimism vs. Realism ^ 496.2 The player survey 506.3 Personal Conclusion ^ 52Bibliography^ 56ivList of Tables2.1 A summary of winning single-piece strategies. ^ 133.2 A summary of winning two-piece strategies for wells of even width.^. 256.3 The average rank of TETRIS pieces^ 496.4 Results of the TETRIS player survey. 54vList of Figures1.1 A schematic diagram of the TETRIS machine ^21.2 Typical TETRIS screens. ^31.3 The seven TETRIS pieces. ^32.4 Four examples of arrows, and what their labels tell you to do. ^82.5 A strategy for playing only squares.^ 92.6 A strategy for bars^ 102.7 A strategy for left elbows. ^102.8 A strategy for left kinks^ 112.9 A strategy for tees. 112.10 Strategies for left elbows in wells of widths 3 and 5. ^142.11 Strategies for tees in wells of widths 3 and 5. ^ 152.12 The proof that you can't win with kinks in odd wells. 163.13 A winning strategy for bars and squares.^ 173.14 A winning strategy for right elbows and squares ^ 183.15 Making and smoothing a bumpy lane. ^ 193.16 Playing a square in the bumpy lane clears two rows. ^ 213.17 Waiting for an elbow ^ 233.18 Waiting for a bar. 244.19 Specimens of flats. ^ 274.20 A changing population of flats. ^ 28vi4.21 02 with some 02-targets and 0 3 with some 0 3-targets. ^ 294.22 A sequence of plays you might make. ^ 314.23 A cycle induced by left kinks ^ 355.24 Left- and right-immune flats. 385.25 What P(x) means. ^ 395.26 The only way to fill the empty cell of anl IN I segment in fiat f. .^405.27 Four ways you can play a left kink. ^ 405.28 Lanes in a left kink cycle-band. 425.29 Finding the shield in the cycle-band. ^ 445.30 Playing one more kink. ^ 456.31 The TETRIS player survey form. ^ 526.32 Instructions for TETRIS player survey participants. ^ 53viiAcknowledgementThese people deserve (and are hereby given) my thanks for their help and/or encourage-ment: my supervisor Richard Anstee, my second reader Tom McCormick, my parentsTom and Louise, my brothers Marc and Paul, and (in alphabetical order) Bob Bajwa,John Baker, David Balser, Doug Brigham, Judy Burke, James Cash, Donald D. Cowan,Jack Edmonds, Kensi Gounden, Mike Ho, Kaz Hobbes, Bryce Kendrick, Leah Edelstein-Keshet, Paul McLelland, Gra,cia Murase, Sunmbola Oyawoye, Luigi Pavan, Anthony Poh,Eric Sather, Stephen M. Smith, Phil Taylor, Sebastien Trudel, Kazuko Tsurumi, and acouple of dozen anonymous TETRIS players at UBC. All of them have made positivecontributions to the completion of this thesis, whether they realize it or not.In addition, these people get my thanks for purchasing, sight unseen, the "education"which this thesis brings to a close: the citizens of Ontario, British Columbia, and Canada.I hope someday to compensate them.... instead of a classical concerto, I chose one of my own. While I mightnot be able to compete successfully in performance of a classical concerto,there was a chance that my own might impress the examiners by the noveltyof technique; they simply would not be able to judge whether I was playing itwell or not! On the other hand, even if I did not win, the defeat would be lessmortifying since no one would know whether I had lost because the concertowas bad or because my performance was faulty. [1]viiiChapter 1IntroductionIf I tell you I'm doing "applied math", you might ask, with raised eyebrows, "applied towhat?". If I respond with "plants", "people", or the name of any other complicated partof the real world, your interest might well turn into suspicion. To avoid this, I've chosento study a simple object, one whose reflection in the Platonic world of mathematicalexistence is clear enough that you will find no cause for alarm in the analysis I performon it.1.1 The Real GameTETRIS is a video game invented by Russian mathematician Alexey Pazhitnov and firstprogrammed by Vadim Gerasimov. I'll describe first the arcade version (©1988 by AtariCorporation, TM and ©1987 by AcademySoft-Elorg) and then the generic version whichI actually analyze. Figure 1.1 shows what you'll see if you venture into an arcade for agame. After absolving yourself of a quarter and selecting single player mode, you mustchoose whether to begin at the Easy, Medium, or Hard level.Figure 1.2 is a sample of what appears on the screen in a typical TETRIS game. Thelarge rectangular region is the well, and the shaded squares in it are coloured tiles. (OnEasy level, you begin the game with an empty well.) The well has space for 20 rows often tiles each. At the top of the well, you can see the current piece, which is made upof four tiles. The lookahead piece is shown just outside the well. If you don't touchthe controls, the current piece will drop straight down the well until it hits a tile, or the1Chapter 1. Introduction^ 2joystickFigure 1.1: A schematic diagram of the TETRIS machine. The quarter slot is not shown.bottom of the well, and stops. The lookahead piece then becomes the current piece atthe top of the well, and a new lookabead piece is displayed outside. The game ends whentiles have accumulated to such a height that the machine can't place a new piece at thetop of the well.Most TETRIS players are not content merely to watch this (expensive) stacking, andinstead, grab the controls. Hitting the rotate button rotates the current piece 900 clock-wise as it falls (see Figure 1.3). Pushing the joystick left or right moves the current piecein that direction, again while it falls. (Pulling the joystick toward you causes the piece tofall more rapidly, and is a sign of impatience.) The point of all this is to place pieces soas to create full rows of tiles. After a piece stops falling, and before the next piece entersplay, TETRIS deletes every full row of tiles from the well (you are said to have clearedthese rows), and each tile in the well drops down one position for every row deleted belowit. Clearing rows delays the end of your game, since it moves tiles away from the top ofthe well. Moreover, depending on how many rows (1, 2, 3, or 4) you clear with a piece,points (50, 150, 450, or 900) are added to your score, which is shown to the right of thewell in Figure 1.2.A game of TETRIS is divided into rounds on the basis of how many rows you'veL 1 -Teer L- 1Right ElbowLeft Elbow BarChapter 1. Introduction^ 335150•35200Figure 1.2: The typical TETRIS screen on the left can lead to the one on the right if youdon't touch the controls. The tee has fallen straight down, filling and clearing the secondrow from the bottom. As a result, you are awarded 50 points, and have one less row leftto clear.L..,^1^1 ^1Left Kink^Right Kink^SquareFigure 1.3: The seven TETRIS pieces are shown in all of their orientations. Hitting therotate button gives the next orientation (in cyclic order from left to right) of a givenpiece.Chapter 1. Introduction^ 4cleared. The number still to be cleared in the current round is displayed outside thewell (it's 5 in Figure 1.2). At the end of each round, you're awarded a number of bonuspoints that depends on the maximum height of tiles in the well at that time (the lowerthe tiles, the more points earned). The next round begins with a new well (which mayalready contain some tiles) and a new goal of rows to clear. The speed at which pieces fallgenerally increases from one round to the next, leaving you less and less time to decidewhere to place them. Moreover, some rounds include extra complications: the machineadds tiles to the well at random locations and times, or it inserts extra rows of tiles atthe bottom of the well, pushing up any tiles already in the well.In most implementations of TETRIS for microcomputers and home video game units,these complications don't exist. Rather, the entire game is just like the first round of theEasy level of arcade TETRIS: you begin with an empty well, and the game ends whenyou have filled cells up to its top. It's this generic version that I'll call "TETRIS" fromnow on.1.2 TETRIS meets PlatoIn constructing a mathematical model of the game, I'll make several simplifications andidealizations. You should recognize TETRIS behind this axiomatic facade, but I postponea full discussion of its validity until Chapter 6, where the opinions of other TETRIS playersare included. My abstraction of TETRIS, namely tetris, follows.First, the well is a rectangular array of cells, each of which is either full or empty(so I've removed colour). Rows of cells are numbered from the bottom of the well, andcolumns from its left, both starting at 1. The well has no fixed depth, so the rows ofempty cells extend to the heavens, but pieces enter into play just above the highest fullcells. The pattern of empty and full cells in the well is called its state, and changes asChapter 1. Introduction^ 5the game proceeds.Next, the rules of movement are just as in TETRIS: you can move a piece down, left,and right, as well as rotate it in 90° increments, until you decide to let it drop. (Disputesover the validity of rotations in the vicinity of full cells can be resolved by a Euclideanreferee: the well and the piece are copied to the plane, and a rotation in the original wellis allowed only if it can be performed in the plane without ever having the piece intersecta full cell.) The piece then falls straight down, without further rotation, until its descentis stopped by either a full cell or the well floor. The status of the four cells it occupiesthen changes from empty to full, and if this fills any rows, they are deleted and the wellcompressed, just as in TETRIS. I let you move pieces left and right as far as you wish,but notice that gravity still acts once you drop them. More importantly, I've eliminatedtime as a factor: you can take as long as you want to play a piece.Finally, the game ends when you fill a cell above row 20; this is essentially the same asin TETRIS. To summarize, a game of tetris is a sequence of plays, each of which proceedsas follows:• the machine hands you a piece, while displaying the next piece you'll be given• you put the piece into the well above all full cells, then slide and rotate it into anyposition, never moving it through a full cell• you let go of the piece, and it falls straight down as far as possible• the machine deletes each full row, moving all rows above it down one position• if there is a full cell above row 20, the game endsYou'll notice that I've said nothing about tetris scores. This is because there won'tbe any! The reasons why not lead to the central concept of my thesis, and you'll findthem in the next chapter.Chapter 2StrategiesLet me introduce you to the main concept of this thesis, but first, some motivation.2.1 Doing well at tetris and TETRISYour high score is one measure of your TETRIS-playing ability, but perhaps you're sotalented that you can actually beat the game: you can make your score as high as youlike. But is this really possible? Can TETRIS be beaten? This is almost the question I'llanswer, but first, a matter of equity.With all due respect, is it fair that you must compete against a machine? Your reflexesare no doubt spectacular, but can they hold out indefinitely against an unwavering siliconopponent when you are forced to play faster and faster using a sluggish joystick? Surelynot. For there to be any hope of beating TETRIS, its pieces cannot be allowed to fallso quickly that you lose track of the game: there must be a speed limit. But since areasonable speed limit for you might be still too fast for other players, I'm going to setit so low that, effectively, all players can take whatever time they need in positioning apiece. That's what I've done in tetris: the speed and timing factors of TETRIS have beeneliminated. So, the fairer question I ask is "Can tetris be beaten?""Wait a minute", you implore, "how can I beat tetris when I don't even get anypoints?" The answer is to use the length of your game, rather than a score, as themeasure of your ability: if the game ends, you have lost, otherwise, you have beatentetris. This might seem strange, but think about what you need to beat TETRIS: making6Chapter 2. Strategies^ 7your score very high requires playing for a long time. If you can score as high as youwant, you really must be able to make your game last indefinitely. Therefore, if you canbeat TETRIS, you can also beat tetris. Conversely, suppose you can beat tetris. Eachpiece adds four new full cells to the well. If you don't keep clearing rows, then eventually,some of these full cells will be above row 20, and your game will end. Therefore, as longas you continue the game, you must clear, on average, four rows every ten plays, so thatthe number of full cells doesn't increase past a certain point. But if you can do this intetris, then you can do it (with good reflexes) in TETRIS.I could end here simply by stating "Yes, I (or someone else) can beat tetris", but you'dprobably be less than convinced (especially if you had seen me play). Alternatively, Icould state "No one can beat tetris", but you would doubt this even more: had I actuallyinvestigated every claim to the contrary ever made, and found each to be false? Surelywhat you demand is either a way of beating tetris, or a proof that it can't be done.2.2 Telling you how to playIf there's a way to beat tetris, then I can describe it in pictures. Figure 2.4 shows whatsuch pictures are composed of, namely state diagrams with arrows between them. In astate diagram, the well is a simple outline which I draw only as tall as I need to showyou all the state's (shaded) full cells. If I need to refer to a state, I will label it witha letter just below its diagram. Between some states I draw arrows to represent a playthat takes the well from the state at the arrow's tall to the one at its head. Each arrowis labelled with pieces: the current piece is the large one with a number below it, andany small ones are lookahead pieces. The best way to understand how to interpret theselabels is to study Figure 2.4.Chapter 2. Strategies^ 8A [2:23 ,rzo)Egj5 not o7^)10.ci3Figure 2.4: Four examples of arrows, and what their labels tell you to do. A: When the(big) current and (small) lookahead pieces are both right elbows, rotate the elbow intothe same orientation as the big piece, and place it so that its leftmost cell goes in column3. B: when the current piece is a square, and the lookahead piece is anything, play thesquare so that its leftmost cell goes in column 1. C: when the current piece is a bar andthe lookahead piece is one of the elbows, play the bar horizontally, with its leftmost cellin column 7 D: when the current piece is a left kink and the lookahead piece is anypiece other than a square, play the kink horizontally, starting in column 5.2.3 Strategies for tetrisThe pictures in Figure 2.4 are only fragments of instructions: if you try to use them,you will get stuck in the first state unless the machine gives you the same current andlookahead pieces as appear on the arrow. Even if it does, you'll be stuck after the firstplay, since there are no arrows leading from the second state. You can see that for acomplete set of instructions, every state must have enough links leading from it that youwon't get stuck, no matter what pieces the machine gives you. Such a complete set ofstates and links, whether or not it actually beats tetris, is what I call a strategy. Myquest is to seek a winning strategy for tetris.Any strategy must be able to deal with whatever sequence of pieces the machinesends you. I'll test my strategy building and your arrow interpretation by consideringthe simplest sequences, those in which all pieces are the same. Figure 2.5 shows a simpleChapter 2. Strategies^ 9way of playing such a sequence of squares. Notice that the highest row in which a fullcell is found is 2. I'll call this number the height of the strategy. If the square were theonly piece in tetris, this would be a winning strategy, since its never fills a cell higherthan row 2, let alone row 20. F71711611091116111111116/111111SUSt45111111111WININON0111111111►9Figure 2.5: A strategy for playing only squares. You clear two rows when you play thesquare in column 9, and this leads you back to the empty well.The square is not alone: if the machine sends you a sequence consisting entirely ofany one of the pieces, you can make your game last indefinitely by using one of thesingle-piece strategies shown in Figures 2.6 to 2.9. For kinks and elbows, I've only showna strategy for the left version of the piece. You can obtain a strategy for the right versionby reversing the picture with a mirror, left to right. It's important that these strategiesexist, for otherwise, the machine could quickly end your game by simply handing you thesame piece over and over again.2.4 Meaningless numbersThe size of the well in arcade TETRIS happens to be 10 by 20, but there's no obviousreason why it couldn't be different. In some versions of TETRIS, the well is wider, andso I might as well try to find winning strategies for all widths. Similarly, there seemsto be nothing magical about 20: other well depths are possible (and likely). I will noteDUE189tOINNEMUMINIM=58181811881U IN MUIRaf ti DE 8RI^U 5 ElChapter 2. Strategies^ 1 01 0XONXIIINOUN IMMINNUOMMI 18088881111 8881488 XMOMIlik88182018181511,155185168.80118,NANNANNUMIU111UNIMUNNXIIIS8111111188818 M818818111 1811818111111811188018188 5111088811 assomo811882118110111118 80181118.81111811 88,1111511111 806181181 51111181121Figure 2.6: A strategy for bars with a height of 4 and 10 states. 411N8881151111W11418418515181111811181188188888888811801NOUN MR11111108X 8 IX SUMSIV I le MIMSINIS U 8 1 SEIN U ittFigure 2.7: A strategy for left elbows with a height of 3 and 10 states.r 44-L itt St St St StX Xi X St IXFigure 2.9: A strategy for tees with a height of 4 and 15 states.Chapter 2. Strategies^ 11[I]Figure 2.8: A strategy for left kinks with a height of 4 and 10 states.Chapter 2. Strategies^ 12the height of each strategy I find so that you will know the depth of well you require inorder to use it. (It might be the case that I can find a winning strategy for seven-piecetetris in a well of depth 21, but that none exists for the real well of depth 20.) For singlepieces, you'll see that the width of the well usually doesn't matter.I begin by showing you that the single-piece strategies of Figures 2.5 to 2.9 easily leadto strategies for all wells of even width. You can think of the well as being partitionedinto five pairs of adjacent columns which I'll call lanes, and will number from left toright, starting at 1. Thus lane 1 consists of columns 1 and 2, lane 2 consists of columns3 and 4, and so on. Notice that in each strategy, pieces are placed entirely within lanes:no piece adds full cells to two different lanes. Moreover, in each strategy, the pattern ofplaying pieces is identical for every lane. This pattern can be repeated for any number oflanes, giving strategies for wells with any even number of columns The height of thesestrategies doesn't depend on the width of the well, except for the simple case of width 2.There, the square has a zero-height strategy (it disappears upon being played), the barhas a height four strategy, and the other pieces all have strategies of height two. (Also,you might have noticed that there is a zero-height strategy for the bar in a well of width4, and a height one strategy for the bar in wells of widths 8, 12, 16, and so on.)What about wells of odd width? Squares immediately present a problem, since theyare two cells wide, and so you can't even fill a single row with them. This settles thequestion: there can be no winning strategy for tetris in an odd width well, since themachine can simply send you a sequence of squares, and you'll never clear a row. (Perhapsthat's why every version of TETRIS that I've ever seen has a well of even width.)Are squares the only pieces which prevent you from winning in an odd well? Thepattern of Figure 2.6 gives a strategy for bars in odd wells: just play each one vertically.Elbows and tees are more interesting, and in Figures 2.10 and 2.11, I've shown strategiesfor the left elbow and for the tee in wells of width 3 and 5 (as before, you get a strategyChapter 2. Strategies^ 13for right elbows by reflecting the left elbow strategy in a mirror). The figure captionstell you how to construct strategies for these pieces in wells of any other odd width. Onthe other hand, Figure 2.12 explains why there is no winning strategy for either of thekinks in a well of odd width.The winning strategies I've found for single pieces are summarized in Table 2.1. Theylet you beat tetris in wells of various widths only if the machine sends just one type ofpiece and the well is at least as deep as the height of the strategy.Table 2.1: A summary of winning single-piece strategies.Well Width=2 Well Width=2n, n > 1 Well Width=2n + 3, n > 0Piece Height No. of States Height No. of States Height^No. of StatesSquare 0 1 2 n (no winning strategy)Kink 2 2 4 2n (no winning strategy)Bar 4 2 4 2n 4^2n + 3Elbow 2 2 3 2n 8 4n + 6Tee 2 3 4 3n 7^5n + 5Chapter 2. Strategies^ 144 ONNOUN.NOVORNMweegasONmINOsaeWOESWOESIN OMNIMENMENUN WI NON1Figure 2.10: Strategies for left elbows in wells of widths 3 (below the heavy gray line)and 5 (above it). The first four plays in the width 5 strategy fill in the two rightmostcolumns of the well. This leaves three empty columns which can be treated just like awell of width 3. In fact, the next six plays in the width 5 strategy are exactly the sameas the plays in the width 3 strategy, and to emphasize this, I've drawn them on top ofeach another, separated by the gray line (the dashed vertical lines inside the states ofwidth 5 are to help you see this correspondence). For wells of greater odd width, youperform the same trick: fill pairs of columns just like you filled in columns 4 and 5 here,then use the width 3 strategy in the remaining three empty columns.Chapter 2. Strategies^ 154 SIaNW SIM I.iNOWOMO O RNOWN MO OWOWSWW• OM MO4+—Fr-At.Figure 2.11: Strategies for tees in wells of widths 3 (below the heavy gray line) and 5(above it). Just as for left elbows, the first part of the width 5 strategy serves to fill(almost) the rightmost two columns, leaving three empty columns which can be treated(almost) like a well of width 3. After the first three plays of the width 5 strategy, thenext five mimic those in the width 3 strategy, and I've drawn them above each other,separated by the gray line. To construct strategies for wells of greater odd width, repeatthe first three plays of the width 5 strategy in every additional pair of columns. You willthen be left with three empty columns in which you can perform the width 3 strategyfor the next five plays. Then, you must refill columns 4 and 5, 6 and 7, and so on, justas in the width 5 strategy.Chapter 2. Strategies^ 16Figure 2.12: The proof that no winning strategy exists for a kink in wells of odd widthis easy. Notice that no matter how you play either kink, you create the same numberof full cells in even columns ("even cells" — labelled e) as in odd columns ("odd cells" —shaded but unlabelled). I call the number of even cells minus the number of odd cellsthe skew. The picture shows that when you play a kink, you don't change the skew. Afull row has one more odd cell than even cell, so when you clear a row (i.e. when youremove a row of full cells from the well), you increase the skew by one. As you makemore plays, the only way to prevent the skew from increasing is to stop clearing rows,but this will soon end your game. If, on the other hand, you keep increasing the skew,then the number of even cells keeps increasing too, and that will eventually end yourgame — either way, you lose.Chapter 3Two at a timeIn the last chapter, I gave you winning strategies for tetris played with only one piece.The logical next step is to show you how to play tetris with two pieces.3.1 Squares with bars or elbowsFigure 3.13: A winning strategy for bars and squares in a well of width 4.In Figure 3.13, I've drawn a winning strategy for bars and squares in a well of width4. A similar winning strategy for right elbows and squares appears in Figure 3.14 (for left17Chapter 3. Two at a time^ 18Figure 3.14: A winning strategy for right elbows and squares in a well of width 4.Chapter 3. Two at a time^ 19elbows and squares, use a mirror). Neither strategy uses lookahead information. Similarstrategies exist for wells of any even width:Lemma 1 If you play tetris using only the square and one of left elbow, right elbow, orbar, then for a well of any even width, you have a winning strategy whose height doesn'tdepend on the width of the well.Proof: You can probably discover the proof yourself, by staring at the diagrams I'llcall the elbow or bar the non-square piece. Just as for states and columns, the heightof a lane is the height of the highest full cell in that lane. Notice that in every stateshown in Figures 3.13 and 3.14, each lane, except possibly one, is smooth, consisting ofa 2 column wide rectangle of full cells (of zero height, if the lane is empty). The possibleexception is a bumpy lane which, in at least one row, has only a single full cell. Youcreate a bumpy lane when you play the non-square piece in a smooth lane. You canrestore that lane to smoothness by playing the same piece in it again — see Figure 3.15.Figure 3.15: How to make a bumpy lane and how to smooth it. By playing a single elbow(left) or bar (right) in a smooth lane, you make it bumpy. By playing the same piece ina bumpy lane, you smooth it. (These plays don't necessarily occur one right after theother.)For any even width of well, I describe the strategy by telling you how to play eachpiece:Chapter 3. Two at a time^ 20Square: If there is a bumpy lane and if its height is at least two less than that of anyother lane, then play the square in the bumpy lane. Otherwise, play the square ina lowest smooth lane.Non-Square: If there is a bumpy lane, then play this piece to make it smooth. Other-wise, play this piece in a lowest smooth lane, making it bumpy.Notice that if every lane in a state is smooth, then at least one lane is actually empty.Otherwise, the bottom row in the state would be full, which is impossible. Therefore,when you play the non-square piece in a lowest smooth lane, you are actually playing itin an empty lane. Also, notice that there is never more than one bumpy lane.I claim that the strategy above will never result in a state whose height is more than7. To see this, consider the following three statements:Statement Si: There is at most one bumpy lane in the well.Statement S2: If there is a bumpy lane, its height is at most 4.Statement S3: The height of every smooth lane is at most 7.Notice that if both S2 and S3 are true for some state of the well, then the height of thatstate is at most 7. Each of Si, S2, and S3 is certainly true of the empty inital well. Iwill show that the strategy has a height of at most 7 by showing that every type of playin the strategy preserves the truth of these three statements. That is, if Si , S2, and S3are all true for a state, then playing either piece leads to another state for which theyare also true. There are four cases:• If you play a square in a lowest smooth lane, then either that lane is empty (ifthere is no bumpy lane in the well), or that lane is less than two rows higher thanthe bumpy lane. In the first case, the new height of the lane will be 2, and in theChapter 3. Two at a time^ 21second case, the new height will be at most 3 plus the height of the bumpy lane,which is at most 7, since S2 was true of the state you played on. In both cases,the new height of the lane you played in is at most 7, and so S3 is still true. S2 isstill true since the bumpy lane is unaffected. Also, S1 is true since playing a squarenever makes a lane bumpy.• If you play a square in the bumpy lane, it disappears, clearing two rows (see Fig-ure 3.16). The height of the smooth lanes decreases by 2, and the height of thebumpy lane doesn't change. Therefore, S2 and S3 are both still true. Again, S1remains true since you're playing a square.ME MEMOOM OMENMEN OMEN MEM MEMOMINIII SWIMSWIM ENE MOONMEN MEMOus OMEN III NENEFigure 3.16: Playing a square in the bumpy lane clears two rows.• If you play the non-square piece in a lowest smooth lane, then there is no bumpylane and so any lowest smooth lane is actually empty. Thus, you create a bumpylane whose height is at most 4, and you don't affect the heights of the other smoothlanes. This means S2 and S3 remain true. S1 is still true since you've just createdthe only bumpy lane in the well.• Finally, if you play the non-square piece in the bumpy lane, then you make itsmooth, but its height will still be at most 4, since a pair of bars or elbows form a2 by 4 rectangle. The heights of the other smooth lanes only changes if this playChapter 3. Two at a time^ 22decreases them by clearing rows. Again, S2 and S3 will still be true. Moreover, Siremains true since you've just smoothed the only bumpy lane.More careful accounting can actually show that the smooth lanes never reach a heightof more than 6 when you play with the bar, and 5 when you play with an elbow, but thisis a minor improvement. •In this lemma, the description of the strategy was incomplete: I told you to playpieces in a lowest smooth lane, giving you the freedom to choose which one. This reallymeans there are several strategies which satisfy the description. Using any of them, youcan win at two-piece tetris in an even well if the two pieces are the square and either thebar or one of the elbows.3.2 Elbow couples, single elbows, and the barIf you play tetris with the two elbows, or with one elbow and the bar, you have winningstrategies which are very similar to those in the previous section. I won't give proofs, butwill just describe how these strategies differ from the previous ones. The idea is againto have as few bumpy lanes as possible, but now you might need two of them, one foreach type of piece. If there is a bumpy lane of each type in the well, then whatever thecurrent piece is, you can use it to smooth one of those lanes. There is a new problemyou might run into, which I'll illustrate using bars and left elbows. Suppose that at somepoint, the well has a bumpy lane, say 1, which requires a left elbow to smooth it. I'll call/ an elbow-deficient lane. What happens if the machine sends a long sequence of bars?As before, you can play these bars in lanes other than /, taking them to quite a height.Eventually, these lanes will all be smooth, and at least four rows higher than lane /. Atthis point, you must make a decision (see Figure 3.17). If the current piece is an elbow,you can just play it to smooth lane /, clearing three rows. However, if the current pieceIF• • 'weHMOS30161612111151111111IISSINNIMISSM61410311tieN16342MIR=OMNIOWEINNISSION111,11111110161(11120111111MINISISIWIRANNIIMENIMIDINNI1111111111111§11110MEENINSNIMMEIBEENNIENISZOISINEEMINERIPHINSINEVIMBREChapter 3. Two at a time^ 23is a bar, playing it in lane / to clear rows would make lane / into an elbow-deficient lane,but of the opposite type. That is, lane / would now require a right elbow to smooth it.To avoid this problem, you examine the lookahead piece. If it's an elbow, you play thecurrent bar on top of a smooth lane, and use the elbow to smooth lane /, thus clearingthree rows. On the other hand, if the lookahead piece is a bar, then play the current andnext pieces (both bars) in lane /, thus clearing four rows and leaving / left-elbow-deficient.Figure 3.17: Where lookahead is used in playing bars and elbows. Above: if there is anelbow-deficient lane, and you get a long sequence of bars, play them as shown until youget to the second state. There, depending on the lookahead piece, you will either playthe bar on a smooth lane, or play two bars in the elbow-deficient lane. Either way, youend up in a state with only one bumpy lane, and with lower smooth lanes.The trick in the last paragraph also works when the well has a bar-deficient lane andthe machine sends you a long sequence of elbows (see Figure 3.18), or when the wellhas an elbow-deficient lane of one type (left or right), and the machine sends you a longsequence of elbows of the opposite type. Notice that there are never more than twobumpy lanes, and the bumpy portion of those lanes (i.e. the rows in which those lanesare not completely full) each consist of at most four rows. Moreover, no pair of lanes willISSEHISSESSSESSUBIEUMUSSHINSHISSSNSUSSIBUSSISI IS6MISISSUONS ISSURESSISIESSUNISSU ESSIISSISE77-÷SUMMIUS SILIEUMSSIINSU6111111111/1111111 ensersessien 0SOSSESESE ISSERNISSON SEESSIMENISSISINSUESS EISISMIRUSSIN SMISESSISOilliXSUNNEVIS 111*SSISISSII NUCRIONINSSTISSOUSUSUS SUSSIESSUS SIESSMUSS[I]1Chapter 3. Two at a time^ 249 ^IF Ir 10\4 SISSIXONANIESIIIMOMMISSUINGISKIISUMtlISISOUSSINSFigure 3.18: If there is a bar-deficient lane, and you get a long sequence of elbows, playthem as shown until you get to the second state. There, you use lookahead to determinehow to proceed. You end up in a state with only one bumpy lane, and with lower smoothlanes.ever differ in height by more than a fixed amount. This is enough to show that theseare winning strategies, at least for deep enough wells. In fact, careful counting can showthat the heights of these strategies are 10 for the pair of elbows, and 11 for one elbowand the bar.I've summarized the two-piece strategies in this chapter in Table 3.2. You might findit amusing to discover two-piece strategies for other pairs of pieces, say in a well of width4. In that setting, I quickly and easily found strategies for the pairs of pieces listed inthe table. However, for some other pairs of pieces, I didn't find strategies even thoughI spent a long time trying. There is a good reason for this, but I'll need the next twochapters to give it to you.Chapter 3. Two at a time^ 25Table 3.2: A summary of winning two-piece strategies for wells of even width.Pieces Height of Strategy Uses Lookahead?Square, Bar 6 NoSquare, Elbow 5 NoElbow, Bar 11 YesBoth Elbows 10 YesChapter 4Organic tetris and the cycle-bandI now examine what goes on in the tetris well from a different perspective. The ideas inthis chapter will help settle the question of whether there exists a winning strategy fortetris. Moreover, they demonstrate how well-known concepts from biology can be used,as analogies, to discover and explain proofs in mathematics.4.1 Life history of fiatsFlats are multi-celled creatures that live in the bottom of the tetris well (see Figure 4.19).When a game of tetris begins, there are no flats in the empty well. New flats are bornwhenever you play a piece that fills cells in a previously empty row of the well. Flatsgrow when your plays add full cells to them, and die and disappear when they've grownto fill an entire row of the well. Flats are territorial (each non-empty row of the well isoccupied by just one) but gregarious (there are never any empty rows between them —think about why not). Because they are diffuse (not all of their full cells are necessarilyadjacent), you can often drop a piece right through a flat. Although they are not motile,flats do sink deeper in the well whenever a flat below them dies, and so they can occupyseveral different rows over the course of their lives. As you might expect, if new flats areborn faster than existing fiats die, then eventually, the well is overrun and your gameends. Therefore, if you want to win at tetris, you must keep killing flats.In order to keep track of flats, I give them unique tags which they bear throughouttheir lives. These are simply numbers, and I assign them to flats on the play in which261111111111.4111111Chapter 4. Organic tetris and the cycle-band^ 27Figure 4.19: Specimens of flats. On the left, three flats taken from a well of width 10.On the right, three flats taken from a well of width 6. The thick-walled gray shell is notvisible when flats are in their well.they are born: the first flat born will be tagged "1", the second, "2", and so on. If severalflats are born on the same play, I will tag them in order by position, starting with thelowest one. When a flat dies, its tag goes with it, never to be reused. If you look at theflats in a single state of the well, their tag numbers increase from the bottom of the wellto its top. I will say that one flat is older(younger) than another when its tag is smaller(larger). This means that an older flat has been in the well for at least as many plays asa younger one. Don't confuse a fiat's age with the number of full cells it has — they arenot necessarily related. Figure 4.20 shows a few plays in the life of a population of flats.4.2 Killing flats with squaresTo demonstrate that my organic view of tetris is helpful, I will use it in proving that nowinning strategy exists for a variant of the game in which no lookahead is provided andin which you use only two pieces: the usual two by two square, which I'll denote 02, andone new piece, a three by three square that I'll call 03. To keep the argument concrete,I'll fix the width of the well at 6. Although it says nothing about standard tetris, I'mincluding this proof because it lets me introduce some concepts more easily than I canusing only standard pieces.Squares are simple pieces to analyze because they have only one orientation: hittingthe rotate button does nothing. When you play a square, any flats you affect all grow2 —6-÷13Chapter 4. Organic tetris and the cycle-band^ 28Figure 4.20: A changing population of flats in a well of width 6. For emphasis, dashedlines have been drawn between flats. Their tags are shown to their right, just outside thewell. (As always, the number under a piece tells you in what column to play its leftmostcell.) Play by play: (i) flats 1, 2, and 3 are born. (ii) flats 1, 2, and 3 grow. (iii) flat 4 isborn and flats 1, 2, and 3 grow. (iv) flats 1, 2, and 3 grow. (v) flat 5 is born, flat 3 dies,and flat 4 grows and sinks. (vi) flats 2 and 4 die, and flat 5 sinks (vii) flats 6 and 7 areborn, flat 1 dies, and flat 5 grows and sinks.RIME111111111111=Chapter 4. Organic tetris and the cycle-band^ 29by the same number of cells. For example, ^ 3 always adds three cells to the flats youplay it into. Therefore, if you want to fill and kill a flat using a single ^ 2 (or ^3 ), thatflat must have exactly two (or three) adjacent empty cells. I call these flats ^2-targets(or ^3-targets), and have drawn some in Figure 4.21. So, ^2-targets are the only flatswhich you can kill with a single ^ 2 , and ^3-targets are the only ones you can kill with asingle ^ 3 .Figure 4.21: Left: ^2 with some ^2-targets and ^3 with some ^3-targets. Right: ^2can't kill a ^3-target and ^3 can't move through a ^2-target. A bar through an arrowindicates an impossible play.Because its empty space is only two cells wide, a ^ 2-target won't let a ^3 throughit. Therefore, a ^2-target protects all the ^3-targets below it. If you make a ^ 3-targetgrow by using a ^2 , it will no longer be a ^3-target, but you still won't be able to killit with ^2 , since it will have only one empty cell. Therefore, once a flat has been a^3-target, it can never become a ^2-target (see Figure 4.21 again).How can I show that you have no winning strategy for (variant) tetris using only ^ 2and ^3 in a well of width 6? One way is for me to play machine's advocate: each timeyou make a play, I'll look at the well and help the machine to select the next piece togive you (you aren't getting lookahead information, so we can wait until the end of yourplay before deciding what piece to send next). Since you must keep killing flats in orderChapter 4. Organic tetris and the cycle-band^ 30to win, we will try to defeat you by handing you harmless pieces.4.3 A recipe for your defeatYou start with the empty well, and we hand you a 03. You might play it in columns 1,2, and 3 (or 4, 5, and 6), thereby creating three 03-targets. If so, it would be stupid forus to hand you another 03 right away, since you could just use it to kill those 03-targets.On the other hand, if you played the 03 without creating any 03-targets, then we mayas well give you another 03 since you can't kill any fiats with it. Thus, we'll keep givingyou 03 to play until you create some 03-targets. You must eventually do this, otherwiseyou'll never kill a single flat, they will overrun the well, and your game will end.At this point, there is at least one 03-target, which I'll call f , in the well, so we'll startsending you 02, with which you can never kill it. (In fact, you'll soon see that you willnever be able to kill it with 03 either — f is immortal!) In playing these 02, you musteventually create some 02-targets, or (again) you'll never kill another flat. We won'tstop sending you 02 just yet, though. Instead, we'll wait until you create a 02-targetsomewhere above flat f . (We know you'll do this because eventually, the 02-targetswhich you are creating and killing must be younger than f , and so live higher than fin the well.) Notice that this 02-target protects f , and any present or past 03-targetsbelow f , from 03. SO next, we'll hand you these harmless 03 until you create another03-target. Then we'll hand you 02 until that 03-target is in turn protected by a higher02-target, and so on (see Figure 4.22).As the machine and I continue this process indefinitely, the population of immortal03-targets will increase beyond any bound and overrun the well, no matter how deep itwas to start with. This ends your game in defeat. We didn't have to start with the emptywell: any initial population of flats would have led to the same outcome. Moreover, theChapter 4. Organic tetris and the cycle-band^ 31Figure 4.22: A sequence of plays you might make. You create flat f, a 03-target, in thefirst play, so we then give you 02 until you create the 02-target g above f (notice that gprotects f from the subsequent 03). Next, we send 03 until you create more 03-targets,one of which I've labelled h. In the subsequent sequence of 02, you manage to kill severalflats, but f and h still live.Chapter 4. Organic tetris and the cycle-band^ 32choice of 2 and 3 for square sizes, and the choice of 6 for the well width are not essentialto the proof. If we use squares with sizes a and b (with a < b), then we can defeat youas long as b is not a multiple of a."That's not fair", you complain, "you're helping the machine!" True, but the helpI've given can easily be mechanized to make what I'll call a defeating algorithm: arecipe for your defeat at tetris (or one of its variants) which the machine can follow. Thedefeat I described above is summarized as:Algorithm 1 If you play (variant) tetris using only 0 2 and 03 as pieces and with nolookahead information, the machine can defeat you by following this recipe:1. Send 0 3 until there is an unprotected 0 3-target in the well.2. Send 0 2 until a 02-target protects all 0 3-targets in the well.3. Go to step 1.To summarize the previous discussion, this algorithm leads to your defeat because allthe 03-targets detected in step 1 are immortal: they can't be killed by 0 2 , and whileyou play 03 , they are protected from above by a 0 2-target. Notice that the machine caneasily determine whether or not there are unprotected 03-targets in the well: in order,starting with the highest flat in the well, it examines one flat at a time until it findseither a 0 3-target or a flat (such as a 0 2-target) whose largest hole is less than 3 cellswide. If the former, it has found an unprotected 0 3-target, otherwise, any 0 3-targets inthe well are protected by the latter.You might still complain that in real TETRIS, the machine seems to send pieces atrandom, and so this idea of a recipe is irrelevant. Your objection is a strong one, butfor now, my answer to it is simply that even if the machine does send pieces at random,there is a chance that this random sequence will be exactly the same (finite) one thatChapter 4. Organic tetris and the cycle-band^ 33the machine would have generated by following the recipe. I'll return to this matter inChapter 6.4.4 Published recipes and two minor fallaciesI can think of two ways in which you might (and in which I did) misinterpret the result ofthe last section. Both of them are based on the following observation: "I know the recipethe machine will use to defeat me, so I can work out in advance exactly what sequenceof pieces I will be given." You might then conclude:Fallacy 1 Since I know what sequence of pieces I will get, I actually do have lookaheadinformation, whereas your proof of my defeat assumed I had none. Therefore, you haven'tproven that I will be defeated once I know the recipe.OrFallacy 2 Since I can always predict what piece I'll get next, you've actually proventhat the machine can defeat me even if it gives me lookahead information, since thatinformation doesn't tell me anything I don't already know.Both of these false conclusions result from a subtle misunderstanding of lookahead. Tosay that you have one piece lookahead (as you do in TETRIS) means not only that themachine must tell you in advance what piece you're getting next; it also means that themachine must decide what piece that will be before it sees how you play the current one.Lookahead is a promise on the part of the machine to hand you a certain piece next,regardless of how you play the current one. Since the defeating algorithm above doesn'tdecide what piece it will send you next until after you've played the current one, it doesn'tactually provide lookahead and neither do your predictions — the pre-commitment justisn't there.Chapter 4. Organic tetris and the cycle-band^ 344.5 The cycle-bandWhen you use a winning strategy, you'll eventually find that you're seeing the samewell states over and over. This is because there is only a finite number of well stateswith no full cells above row 20. Since each of the 10 x 20 = 200 cells in or below row20 is either full or empty, there can be at most 2 x 2 x x 2 = 2200 different statesin a winning strategy. (This is a slight over-estimate, since no full rows and no emptyrows below non-empty rows are allowed.) For each of these possible states, the machinecan be displaying as lookahead any of the seven pieces. Therefore, there is still onlya finite number of different situations (i.e. combinations of well state and lookaheadpiece) which you can encounter when using a winning strategy. (The same is true for anon-winning strategy, but simply because your game ends after a finite number of plays).If you continue your game indefinitely, you will eventually have made more plays thanthere are situations in the strategy, and so some of those plays must have been made inthe same situation. A cycle is a sequence of plays which starts and ends with the samesituation. For example, all of the single-piece strategies in Chapter 2 eventually end upin a cycle. Notice that if a sequence of pieces induces a cycle, and if the machine repeatsthat sequence of pieces, you will, if you are following a strategy, be forced to repeat thecycle.In a single pass through a cycle, some flats are born, some grow, some sink, and somedie. I call this collection of flats the cycle-band corresponding to that cycle. Some fiatsare born into the cycle-band, others are there from the start of the cycle, and some diebefore the cycle ends, as I've shown in Figure 4.23. If a sequence of pieces leads youthrough a cycle, then the machine can force you to pass through that cycle endlessly,simply by repeating the sequence of pieces over and over again. Each of these passes has acycle-band associated with it, and I call the collection of all the flats in these cycle-bandsChapter 4. Organic tetris and the cycle-band^35the infinite cycle-band. In other words, the infinite cycle-band is the set of all flatswhich are born, grow, sink, or die when a cycle is repeated ad infinitum. I now provesome useful facts about these objects. 3LJrFigure 4.23: A cycle induced by left kinks. One pass through the cycle consists of threeplays, and restores the well to its initial state. Even so, the identity of the flats changes:for example, flat f is the oldest flat in the cycle-band, and dies on the first play of thecycle. On the same play, the flat g grows and sinks into the row formerly occupied byf . On the last play of the cycle, g grows again so that its structure is the same as f'swas in the initial state. In each state, the flats in the cycle-band are those between thedashed lines.Proposition 1 If f is a flat in the cycle-band which doesn't sink in the cycle, then itmust die there. Moreover, the oldest flat in the cycle-band dies during the cycle.Proof: Since f doesn't sink, it must occupy the same row (call it r) throughout thecycle, or until it dies. Suppose f is born or grows during the cycle (if neither, then fmust die during the cycle in order to satisfy the criterion for membership in the cycle-band). On a play in which this happens, the number of full cells in row r increases. Butthis number must decrease before the end of the cycle so that the well can return to thecycle's initial state, in which r had fewer full cells. The only way this can happen is forf to die (and to be replaced by a flat with fewer full cells, or by an empty row). Theoldest flat in the cycle-band is also the lowest there, and so it can't sink. (Otherwise, itChapter 4. Organic tetris and the cycle-band^ 36would have to sink into a row just vacated by another fiat, and the latter would thus bein the cycle-band, and lower than the oldest such flat. This is a contradiction.) •Proposition 2 If f is a fiat in the infinite cycle-band, then f eventually dies.Proof: The last time f sinks, it moves into a row just vacated by another flat. (If fnever sinks, then it must die.) That other flat must have died, rather than sunk, sinceotherwise f would sink again when this play was repeated in the next pass through thecycle. Thus, f itself will die on the next pass through the cycle. •Proposition 3 If g is a flat which lives in a state of the cycle, and g is younger thanthe oldest flat in the cycle-band, then g is also in the cycle-hand.Proof: Let f be the oldest flat in the cycle-band. If g is in the well when f dies, theng sinks (it's younger and so lives above f), and thus is in the cycle-band. On the otherhand, if g is born in the cycle only after f dies, or if g dies during the cycle before fdoes, then, by definition, g is in the cycle-band. aYou might wonder why I chose the term "cycle-band". This is explained by:Proposition 4 In any state of the cycle, those flats which are in the cycle-band form acontiguous band at the top of the state.Proof: Let g and h be flats in a state of the cycle. Suppose that g is in the cycle-bandand that h lives above g. Since g is no older than f (the oldest flat in the cycle-band),and since h is younger than g, therefore h is younger than f , and so, by the previousproposition, h is in the cycle-band. aIn summary, if you are using a winning strategy, you will eventually pass through acycle. The flats which participate in that cycle will form a band at the top of each stateof the cycle. You'll soon see why this matters.Chapter 5Kinky SetsNow that I've told you what cycle-bands and defeating algorithms are, I'm ready to showyou why there is no winning strategy for standard tetris. In fact, I'll prove that as longas you are playing with a set of pieces that includes both kinks, you have no winningstrategy in any well. Before giving a recipe for your defeat, I'll use the next two sectionsto establish facts which I need in order to prove that the recipe actually works.5.1 Playing in the cycle-bandYou might recall that the well can be divided into pairs of adjacent columns that I calllanes. In each lane, a flat can have zero, one, or two full cells, and I'll use segment torefer to the portion of a flat that occupies one lane. Moreover, I'll use the symbols FT1 I• 1^I and ININ Ito represent the four possible configurations of empty and full cells■CIin a segment.If a flat has an 1 la 1 as its leftmost segment, then you can't kill that flat with a leftkink (see Figure 5.24). I'll call such a flat left-immune. Similarly, a flat with a IC Ias its rightmost segment is right - immune. I now show that if the machine gives you along enough sequence of left kinks, and you play them without ending your game, thenthe well will develop a certain kind of structure.Lemma 2 While following a strategy, if you pass through a cycle in which every piece isa left kink, then you must have played each one entirely within a single lane. Moreover,37Chapter 5. Kinky Sets^ 38H Figure 5.24: Arrows indicate left- and right-immune flats. The plays shown are impossiblesince they require the pieces to be moved upward. Even if I allow you upward moves,the E cells will have to be empty for you to slide the pieces into place, and gravity willthen pull the kinks down into these empty cells. You still can't kill the immune flats.for every lane in every state of the cycle, the portion of that lane within the cycle-bandwill consist of a stack of zero or more segments, topped with a single I • I IProof: To begin, I will define a sequence of statements which might describe your playsduring the cycle. Each of these statements tells how your plays affected one lane, andcan be either true or false. The statements are called P(1), P(2), and so on, where thenumbers represent which lane the statement is about. The statements have the followingmeaning:For a lane x, P(x) says that whenever you played a left kink so as to fillat least one cell to the left of lane x, you played that kink entirely within asingle lane. This means, among other things, that during the cycle, you neverplayed a left kink so that it filled cells in both lane x in the lane to the leftof x (see Figure 5.25).I repeat: each of P(1), P(2), and so on could be either a true or a false statement abouthow you played the kinks during the cycle. I want to show that, in fact, all of them aretrue.What does P(1) really mean? It means that during the cycle, any kink you playedwhich filled some cells to the left of lane 1 was played entirely within a single lane. ThisChapter 5. Kinky Sets^ 39is true, in a trivial way, simply because there are no cells to the left of lane 1, and soyou couldn't have filled any. More importantly, this means that you never played a kinkwhich stuck partly into lane 1 from the left (again, this just isn't possible). cycle bandFigure 5.25: P(x) is true if and only if plays of the type illustrated don't occur: laneboundaries to the left of lane x, including x's own left boundary, are not crossed by piecesplayed in the cycle. P(1) is true simply because no piece can cross the left wall of thewell.Now that you know P(1) is true, I will use that fact to prove that P(2) is true. Evenbetter, I will prove that if for some lane n, P(n) is true, then P(n + 1) (i.e. the statementfor the next lane to the right) is also true. This will mean P(2) is true, and thus thatP(3) is true, and so on, all the way across the well.Let n be a lane for which P(n) is true. I first prove that no flat in the cycle-band canhave an ( ■i segment in lane n. Suppose, to the contrary, that f is the oldest flat (in thecycle-band) that has an 1.1in lane n. If you fill the empty cell of that segment duringthe cycle, it can only be by making the play shown in Figure 5.26, because P(n) impliesno left kink can be played to fill the cell from the left. However, this play creates anotherI 1E1 in lane n, but in a flat, say g, which is lower (and hence older) than f. Moreover,since this play changes g, it is also in the cycle-band, contradicting my choice of f (seeChapter 5. Kinky Sets^ 40Figure 5.26). Therefore, you can't fill the empty cell in that segment of f, and so even ifthe cycle is endlessly repeated, you won't kill f . But this contradicts the fact that f isin the infinite cycle-band, since every flat therein must eventually die. Therefore, neitherf nor any other flat in the cycle-band can have a I I NI segment in lane n.Acycle bandFigure 5.26: The only way you can fill the empty cell of an I I• I segment in lane n offlat f , if P(n) is true. Doing so requires that the E: cell be empty: think of where thekink could have been just before ending up as drawn. Thus, if you play the kink thisway, you create a new I_ I a I segment in a fiat g that's below f.Figure 5.27: When P(n) is true, there are at most four ways you can play a left kink soas to fill a cell in lane n. In each case, the * cells must be full or else you will create anin lane n.In Figure 5.27 I've shown the four possible ways you could fill a cell in lane n (whenP(n) is true, as I've assumed). In order not to create the forbidden I lal in lane n, theChapter 5. Kinky Sets^ 41F41 cells must already have been full when you played the kink. But that means thesegment containing that cell must have been al • I (consisting of the full ,E, cell and itsempty right neighbour) before you played the kink. Therefore, if you filled a cell in lanen, there must already have been a INI I there. But notice that the last three ways ofplaying a left kink change at least one I•1 1 into a ININI and so decrease the number of III I in lane n by at least one. In contrast, suppose you played the left kink in the firstway I've shown (i.e. entirely within lane n). You would have destroyed one is I I segment(the one with the ri 1 ) , but created another (the one at the top of the piece; its rightcell is empty since otherwise, that segment would have been the forbidden I INI beforeyou played the piece). Thus the number of Is I I segments in lane n of the cycle-bandcould only have declined or remained constant each time you played a left kink In fact,it must have remained constant since the initial and final states of the cycle are identical.Therefore, during the cycle, you could have used only the first method to play a left kinkwhen filling a cell in lane n. Hence, during the cycle, you never played a left kink thatfilled cells in both lane n and lane n + 1. Together with P(n) being true, this is enoughto imply that P(n + 1) is true. Therefore, all of the statements P(1), P(2), and so onare true: during the cycle, you played every left kink entirely within a single lane.The second part of the lemma is a consequence of the first. Notice that during thecycle, you must have played each left kink at the top of a lane: playing it below thetop would have required an I I I segment below the non-empty top segment of the lane.But how could this empty segment have arisen? During the cycle, gravity would preventyou from leaving any empty segments in a lane, and so in infinite repetition of the cycle,all such empty segments would eventually disappear. But then the play which requiredthe empty segment could never be repeated. Therefore, such a play doesn't occur in thecycle.Chapter 5. Kinky Sets^ 42Playing left kinks within and at the top of lanes can give rise to lane structures onlyof the type shown in Figure 5.28. •VFigure 5.28: During a left kink cycle, the lanes in the cycle band all have a simplestructure: a Isi segment on top of a (possibly empty) stack of5.2 The shield in the cycle-bandThe importance of this kind of cycle-band structure is that it contains a collection offlats which together protect underlying flats from right kinks, and which no number ofright kinks can kill. This is what I call a shield against right kinks.Lemma 3 In a cycle induced by a sequence of left kinks, the cycle-band contains a shieldagainst right-kinks.Proof: Look at any state in the cycle. Let f be the highest flat in that state whoserightmost segment is not an M. The previous lemma shows that this segment mustbe a Isi J, and so f is right-immune. This is the highest flat in the shield, and you canfind the other ones by this procedure:-,A^a ^ segment---- 0 or more^segmentsAcycle bandChapter 5. Kinky Sets^ 431. f is a flat in the cycle-band which can't be deleted by right kinks, and whoserightmost segment is not an ^2. If none of f's segments is an I I I (for example, if f is the lowest fiat in the cycle-band for this state) then each of f's segments is either a NI I or a DO But thenf has no pair of consecutive empty cells at all, and so it prevents right kinks fromreaching any rows below (kinks need a space of two empty cells to pass through arow). This flat is the lowest one in the shield, so you can stop.3. Otherwise one of f's segments is an mi. Let / be the lane with the rightmostsuch segment, and notice that f has a full cell in the left column of lane / +1 — seeFigure 5.29. (Notice that / is not the rightmost lane in the well, since f's rightmostsegment isn't an III4. Put your hand on this full cell and descend lane 1, dragging your hand down alongthe "wall" of full cells to your immediate right, until you reach a flat, say g, whosesegment in lane 1 is not an I I I Flat g is still in the cycle-band since the bottomflat of the cycle band, having no I I I segments (by the previous lemma), wouldhave stopped your descent. Thus, g must have a 101 I segment in lane / (previouslemma again). Notice that the empty cell of this segment can't be filled by a rightkink until all the full cells you touched are gone (Figure 5.29 again). That is, flatg can't be killed (using only right kinks) until you've killed all of the flats above g,up to and including f. Since f can't be killed by right kinks, neither can g.5. Reuse the labels so that "f" now refers to this flat g.6. Go to step 1.Since you descend at least one row each time you perform step 4, following this procedurewill eventually lead you to stop, successfully, in step 3. At that point, the set of all flatscycle bandAChapter 5. Kinky Sets^ 44Figure 5.29: The flat f is right-immune, but has anl I in lane 1. The cells you touchwhile dropping down empty portions of lanes are shown notched. In this example, theshield you eventually find consists of flats f , g, and h.you ever called f forms a shield against right kinks, since you can't kill any of these flatswith right kinks, and since the lowest one actually prevents you from playing right kinksanywhere below.5.3 Defeating you with kinksWhen the machine performs the defeating algorithm for 0 2 and 0 3 which I gave in Chap-ter 4, it does not provide you with lookahead information. However, when it performsthe following algorithm, it does. You can verify this by making sure that in every step,the piece being handed to you is the one displayed (as lookahead piece) in the previousstep.Algorithm 2 The following procedure generates a sequence of kinks which defeats anystrategy for tetris:I. Send left kink and display left kink until a cycle is detected.Chapter 5. Kinky Sets^ 452. Send one left kink and display right kink.3. Send right kink and display right kink until a cycle is detected.4. Send one right kink and display left kink.5. Go to step 1.Proof: For reasons I've already mentioned, if your game doesn't end in step 1 or 3,you must eventually pass through a cycle. The machine will detect this when you revisita state within step 1 or 3. Lemmas 2 and 3 show that when a cycle is detected in step 1,the cycle-band will contain a shield against right kinks. Can you disable this shield whenyou play the left kink sent in step 2? No: the shield consists of flats having structuresof the type illustrated in Figure 5.30. The only way you can fill the empty cell in one ofthose structures (and hence the only possible way you can disable the shield) with thesingle left kink of step 2 is to play that kink within a lane. But doing so preserves thestructural form of the cycle-band: it will contain a (possibly new) shield against rightkinks.Figure 5.30: Every flat, say f , in the shield must have an empty cell, shown as a E,with a full cell in the position one up and one to the right. The only way you can fill thisempty cell using a single left kink is shown. (In both cases, the lane boundary indicatedwith an arrow might actually be the right wall of the well.)So, even after step 2, the well still has a shield against right kinks Therefore, nothingyou do with the right kinks you get in steps 3 and 4 will kill any of the flats in that shield.Chapter 5. Kinky Sets^ 46Also, notice that the cycle-band of the cycle detected in step 3 must lie entirely abovethe shield from steps 1 and 2. This is simply because the top flat of that shield can't bekilled by right kinks, and so isn't in the infinite cycle-band corresponding to repetitionof the right-kink cycle. (Remember, every fiat in the infinite cycle-band must die.) Butnow the mirror images of Lemmas 2 and 3 show that the cycle-band induced by rightkinks will contain a shield against left kinks. Since this new cycle-band is above the oldshield, so is the new shield. Thus, the second time the machine follows step 1, you willbe playing left kinks above this new shield, without killing any of the flats in it. As themachine repeats steps 1 to 4, you will be forced to create a stack of shields of alternatingtype until eventually, one of the flats in those shields is above row 20, and your gameends. Obviously, you could have chosen any other maximum well depth and the machinewould still have (eventually) defeated you.When following Algorithm 2, how can the machine detect a cycle? One way (popularwith the American recreational vehicle crowd) is for it to create a list of states visited.Each time you enter step 1 or 2, the machine empties the list. Every time you reacha state within that step, it checks to see if it's already in the list. If so, you have justpassed through a cycle. If not, it adds the state to its list. It's quite possible for thislist to get arbitrarily large, even if a cycle is always (eventually) detected, so a bettermethod is for the machine to wait for the cycle-band structure itself. This structure canarise even if you haven't yet completed a cycle. Moreover, the machine requires no listfor this, but only needs to scan each state you visit to see if it has the required structure."Now that I know how the machine is defeating me, can't I choose to avoid creatingthe shields?" No. Remember that with my concept of "strategy", the way you playa piece can depend only on the current state of the well and on which piece is shownas lookahead. Therefore, if you revisit a situation, you have no choice but to play thecurrent piece in the same way you did when you first encountered that situation. This isChapter 5. Kinky Sets^ 47enough to guarantee that if you are given a long enough sequence of left kinks, you musteventually pass through a cycle (or end your game). Once you've done this, Lemma 3guarantees that there will be a shield in the corresponding cycle-band.I repeat: no matter what the width of the well, no matter how great you set its depth,no matter what state the well is initially in, and even if you are allowed to move piecesup before dropping them, you can't beat tetris. The machine can defeat you by usingjust the two kinks. You can't win at tetris, and so you can't win at TETRIS.Chapter 6ConclusionI now return to the real world to see what, if anything, the analysis of the previouschapters has to say about it.6.1 Pessimism vs. RealismIf I had given you a winning strategy for tetris, you could have used it to make a realgame of TETRIS last as long as you wished, provided the game didn't get too fast for you.You would have been able to beat TETRIS no matter how cleverly it was programmed todefeat you. In fact, I've shown that you don't have a winning strategy for tetris, becauseif it were programmed to do so, the machine could send you a sequence of kinks whichwould quickly end your game. But what does this say about TETRIS?I have no evidence to contradict the hypothesis that the TETRIS machine simplyflips a seven-faced coin to decide which piece it will hand you — TETRIS doesn't appearprogrammed to act as an opponent. In a typical game, the random sequence of pieces youreceive will probably allow you to play for much longer than you could if the pieces werecarefully chosen. If I call this the average case scenario, then my concept of strategyassumes a worst case scenario: the machine tries its best to defeat you, turning thegame into a contest between two players. (You can actually play tetris against a humanopponent using a pencil and a piece of paper; delete rows by folding them out of existence.If the player sending the pieces has read this thesis, the game won't last long!)I suspect it would be more difficult to come up with any exact results in the average48Chapter 6. Conclusion^ 49case scenario. However, I'd still like some indication of how my worst-case results relateto reality. One question I find interesting is whether the seven pieces can be rankedaccording to how difficult, on average, they are to play. Instead of analyzing the averagecase mathematically, I've decided to bring in some expert opinion.6.2 The player surveyFor two weeks in February, 1992, I conducted a passive survey of TETRIS players. I put atotal of 100 survey forms (see Figure 6.31) into envelopes stuck to three TETRIS machineson the UBC campus (one in each of Gage and Vanier residences, and one in the SUBvideo arcade). Players were informed about the survey by the instruction sheet shownin Figure 6.32. Twenty-four forms were returned, and I have summarized the results inTable 6.4.Table 6.3: The average rank of TETRIS pieces, where smaller means harder. The samplesize is 24, and the standard error equals the standard deviation divided by -■/RRight Kink^Left Kink Right Elbow Left Elbow Tee Square BarAvg. Rank 0.75 0.96 2.13 2.54 3.92 3.96 4.67Std. Dev. 1.01 1.40 1.13 1.22 2.02 1.65 1.95Std. Err. 0.21 0.29 0.23 0.25 0.41 0.34 0.40In Table 6.3, I've listed the "average" rank for each piece. Each player was asked torank the pieces, with 1 for the hardest, higher numbers for easier pieces, and with equallydifficult pieces getting the same rank. I counted, for each piece and player, how manypieces that player ranked as being less difficult to play than that piece. The averages andstandard deviations in the table are for this transformed rank For example, the averagerank of 2.54 for left elbows indicates that, on average, players ranked 2.54 other piecesas being more difficult to play than left elbows.Chapter 6. Conclusion^ 50The fact that the two kinks had the lowest average rank indicates they were generallyperceived to be the hardest pieces to play. This is reminiscent of the results in Chapter 5.The square was ranked easier than all other pieces except the bar. This might remindyou of the two-piece strategies in Chapter 3: if one of the pieces you are playing with is asquare, then your winning strategy (if you have one) doesn't require lookaheakl. Elbowsreceived an intermediate rank. This might reflect the fact that winning strategies for setsof pieces with an elbow require lookahead, unless the other piece is a square. I know ofno strategy for the two elbows which doesn't use lookahead. That makes elbows "moredifficult" to play than the square, but "less difficult" than the kinks. These comparisonsare vague, but I find them interesting nonetheless.I posed questions 8 and 9 of the survey to see what factors players found most im-portant in ending their games. One of the assumptions I made in formulating tetris wasthat you could take as long as you wanted to play the pieces. This affects the relevanceof tetris to TETRIS: the more important are time factors, the less relevant is this thesis.For the game just played, 14 out of 24 players chose a time-related factor (i.e. "b", "c",or "h") as most important in ending their game, while only 6 chose a piece-related factor(i.e. "a" or "g"). (Other responses deal with factors incidental to the game.) As for whatusually ended their games, 18 of 24 players indicated a time-dependent factor, while only6 chose a piece-related factor. It probably doesn't surprise you that speed and timingplay a major role in influencing the length of a game of TETRIS, and thus the scoreobtained therein.The answers to the lookahead questions indicate that most players make use of thisinformation at least often (19 of 24 players), with a slight trend towards greater usageamong players with higher scores. Of the 19 frequent lookahead users, 5 thought twopiece looka head would not be helpful, 8 thought it would be somewhat helpful, and 5thought it would be very helpful. In Chapter 3, I gave you winning strategies for someChapter 6. Conclusion^ 51pairs of pieces in which you had to use lookahead, but not very often. I know of no setof pieces for which there is a winning strategy with two- (or more) piece lookahead, butnone for one-piece lookahead.The most common piece of advice selected was "Try not to leave any holes" (8 of24 players). Players' own advice included "Stay calm", "Leave a space by the wall for atetris [i.e. a simultaneous clearing of four rows]" , "Don't wait for that perfect piece", and"Pretend you are having sex" (the latter profferred by player 3, who, judging by his/herscore, is adept at following this advice).Unfortunately, when I posed question 10, I was thinking in terms of tetris. In TETRIS,the best way to play a piece seems usually to depend on how many rows you have left toclear in the current round. I didn't indicate this number in the six situations, and so it'snot clear that I can conclude anything from the responses. Moreover, I had intended eachsituation to pose a simple tradeoff (clearing a row vs. not leaving a hole, for example),but, for example, players indicated five different plays in the first situation, and six inthe second.6.3 Personal ConclusionEven with knowledge of the results in this thesis, I can't get a TETRIS score higher thanabout 100000. However, 6 of the 24 people in the survey can obtain much higher scores,and the typical high score on TETRIS machines at UBC is roughly 900000. Therefore, Ihave no choice but to conclude that, at least for TETRIS,We do not learn from inference and deduction and the application of math-ematics, but by direct intercourse and sympathy. [2]Tetris Player Survey (to be completed right after a game)1. What was your 600f* (roughly)? ^2. At what level did you *an this game? Easy Medium Hard3. At what level do you usually begin? Easy Medium Hard4. Rank the Tetra pieces according to how difficult you usually find it b play them. Use 1 to indicate the hardest piece(s) to play, and use 2, 3, and soon to intimate easier pieces. if you find two or more pieces roughly aqua,* difficult to May, give them the same number. Please assign a nuntberam), pieceRea:Your ranking:(1-hardest)(El E3^e-r-77,4 5. While you are playing a piece, Teats shows you the next piece youl have to play. How often do you uas this information?a) Never^b) Seldom^ci) Often^d) Usually6. At low gams speeds, how helpful would it be to see the next two pieces, rather than just the next on.?a) Not helpful^b) Somewhat helpful a) Very helpful7. If you wanted to help a beginning Teats player, and could cave only one dna* piece of advice to that player, what would k be? (If you haveadvice you prefer to the ones listed, please circle f and write it hi the spaoe provided.)a) May pieces as low as possible.^b) Try not to Nave say hobs.^a) If you can alms • row, do It.d) Winch to cm which piece wiN come next.^is) Pies piece* of the same type doers to one another.f) (your own): ^For questions 8 and 9, choose the factor that you feel contributed most to ending this game of Istria, end the one which usually does so when you play.If you think a factor not listed here was more Important, please rind* I and vain it in the space provided,8. This game:^9. Usually:^(Please circle only one leiter In each column.)a) a)^I was wafting for. certain piece, and the machine didn't send ILplease circle which one:b) b)^I was trying to play a plea* in a certain spot, but it was dropping so fast I didn't have time M move Itsone* to that spot.c) I accidently played • piece where I didn't mean to.d) The Joystick or Intel* button enalfunodoned.fs) •)^I got distracted by something outside of the game.I)^1 ddn't feel Nke playing soy longer.g)^The machine was minding too num of a certain type of piece.please alit* which OMh)^h)^The gem* got so fast I couldn't keep track of what was happening.(your own): ^Thanks for your help. If you have commentalmmadons about Tetra or this surrey, pleat* put them on the back of this sheet.10. Here are 6 situations you might face. Please draw the piece where you would pleat It. (The next piece Is shown In small.)czm••9 0• IIIII11.10^•cS3Chapter 6. Conclusion^ 52Figure 6.31: The TETRIS player survey form.Chapter 6. Conclusion^ 53The Tetris Player Survey: Why and How?Why:The purpose of this survey is to discover commonly held beliefs aboutTetris. In particular, I'm interested in strategies people are using and inhow different aspects of the game affect their scores.This data is being collected as part of the research for my Master'sthesis. (I'm a graduate student in the Institute of Applied Mathematics,here at UBC.) Survey results will appear in copies of the thesis at bothMain and Math libraries.The aim of the thesis is to investigate, mathematically, commonknowledge about Tetris. The survey data will tell me both what beliefs(if any) people hold about the game, and what aspects of the game areessential and must be included in reasonable mathematical models ofit. Such models will be used to explore questions about strategy likethose on the other sign.How* Play a game of Tetris* Fill out a survey form:- give the answers you feel are best- don't peek at other people's forms- if you're really unsure about what a question is asking for, leaveit blank.- write any comments or questions you have about this survey,or Tetris, on the back of the page* Leave the completed form in the envelope provided.* Feel good about yourself for contributing to interesting research and forhelping another student to graduate.Thank-you for your help!Figure 6.32: Instructions for TETR IS player survey participants.Chapter 6. Conclusion^ 54Table 6.4: Results of the TETRIS player survey. Each row corresponds to answers pro-vided by one player, in the same order as questions appear on the survey. Levels: easy,medium, hard. Ranks: Tee, Right Elbow, Left Kink, Square, Bar, Left Elbow, RightKink. Lookahead: 1 is use of current lookahead, 2 is potential use of 2-piece lookahead.Reasons why game ends: Now is this game, Most is usually. The letters correspond tothe choices on the survey form.PlayerNo. Score Levels RanksLookAdviceGame End1 2 Now Most9 e,e 3,2,1,4,5,2,1 c a a d b14 m,e 3,2,1,5,4,2,1 c b b b a10 e,e 6,3,1,5,7,4,2 d c d a f7 e,e 1,2,2,3,3,2,2 d c f ah ach6 7,3,5,6,1,2,4 b b f ac2 16000 e,e 3,4,2,6,7,5,1 b a b c c12 20000 e,e 3,1,2,4,5,1,2 d b b b b22 20000 e,e 4,3,1,2,5,3,1 d a a c b16 30171 e,e 6,4,1,3,7,5,2 b b c eg abcdfh8 50000 e,e 7,5,2,6,3,4,1 c b c be bcdh4 59289 e,e 2,3,1,4,5,3,1 d b b c b21 60000 6,2,1,4,5,3,2 cd b cf c c18 75000 e,m 6,3,1,5,7,4,2 c c b a b11 80978 e,e 5,2,1,3,4,2,1 c a d b b13 93000 h,h 7,5,1,3,4,6,2 b b b a f17 103979 h,h 4,3,2,1,5,3,2 d b c c cg20 110000 e,e 7,2,5,6,3,4,1 b c a h h24 122246 m,m 5,3,1,6,7,4,2 d c f h f23 235000 e,e 3,4,2,6,7,5,1 d a b c c1 287635 e,e 6,4,2,5,3,4,1 c b c e d19 350000 e,e 1,1,1,1,1,1,1 d c f d h5 400000 h,h 3,3,2,4,4,3,1 d a f c c3 847088 e,e 1,3,2,4,5,3,2 d b f a gi15 987000 4,1,6,3,7,2,5 c b b e cBibliography[1] David Gutman. Prokofiev. The Alderman Press, London, 1988.[2] Henry David Thoreau. The Natural History Essays. (Robert Sattelmeyer, ed.) Pere-grine Smith Books, Salt Lake City, 1980.55
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- Can you win at TETRIS?
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
Can you win at TETRIS? Brzustowski, John 1992
pdf
Page Metadata
Item Metadata
Title | Can you win at TETRIS? |
Creator |
Brzustowski, John |
Date Issued | 1992 |
Description | TETRIS is a popular video game in which you try to fill rows in a rectangular well using a sequence of tetrominoes chosen by the machine. Each time you succeed in filling a row, it is deleted from the well. Your game ends when you have stacked pieces up to the top of the well. I build a model of TETRIS and analyze the worst-case scenario, in which the machine is treated as an adversary. I say you have a winning strategy when you can make your game last indefinitely. I construct winning strategies for some subsets of the TETRIS pieces, and prove that none exists for some others. Finally, I compare these analytic results to some empirical average-case data that I obtain from a passive survey of TETRIS players. |
Extent | 3112820 bytes |
Genre |
Thesis/Dissertation |
Type |
Text |
FileFormat | application/pdf |
Language | eng |
Date Available | 2008-12-20 |
Provider | Vancouver : University of British Columbia Library |
Rights | For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use. |
DOI | 10.14288/1.0079748 |
URI | http://hdl.handle.net/2429/3263 |
Degree |
Master of Science - MSc |
Program |
Mathematics |
Affiliation |
Science, Faculty of Mathematics, Department of |
Degree Grantor | University of British Columbia |
GraduationDate | 1992-05 |
Campus |
UBCV |
Scholarly Level | Graduate |
AggregatedSourceRepository | DSpace |
Download
- Media
- 831-ubc_1992_spring_brzustowski_john.pdf [ 2.97MB ]
- Metadata
- JSON: 831-1.0079748.json
- JSON-LD: 831-1.0079748-ld.json
- RDF/XML (Pretty): 831-1.0079748-rdf.xml
- RDF/JSON: 831-1.0079748-rdf.json
- Turtle: 831-1.0079748-turtle.txt
- N-Triples: 831-1.0079748-rdf-ntriples.txt
- Original Record: 831-1.0079748-source.json
- Full Text
- 831-1.0079748-fulltext.txt
- Citation
- 831-1.0079748.ris
Full Text
Cite
Citation Scheme:
Usage Statistics
Share
Embed
Customize your widget with the following options, then copy and paste the code below into the HTML
of your page to embed this item in your website.
<div id="ubcOpenCollectionsWidgetDisplay">
<script id="ubcOpenCollectionsWidget"
src="{[{embed.src}]}"
data-item="{[{embed.item}]}"
data-collection="{[{embed.collection}]}"
data-metadata="{[{embed.showMetadata}]}"
data-width="{[{embed.width}]}"
async >
</script>
</div>
Our image viewer uses the IIIF 2.0 standard.
To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0079748/manifest