a guest Mar 19th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rgb(216, 216, 240)
  3. Zen Mahjong: Part I - Perfect
  5. Zen Mahjong is a thought experiment that arose from a simple question: "Is a perfect game of
  6. Tenhou possible?" As it turns out, that question has a very simple null hypothesis answer.
  7. Since Tenhou uses a mahjong ruleset a ruleset where busting (having negative points) ends the game,
  8. and results in Tenhou are based solely on placement, there is a nice and easy solve for this
  9. problem. A Tenhou + 1 Double Yakuman tsumo on the first turn would simultaneously bust the other
  10. players, ending the game while also giving us the best possible outcome (first place).
  12. With that out of the way, we can begin asking ourselves the real tough questions. "When does a
  13. perfect game cease to be perfect?" and "What constitutes a perfect play?" To answer these
  14. questions, we need to dive into and explore exactly what we mean when we say "perfect" when talking
  15. about games. To do that, we need to define what perfect is; this will prove to be the pillar and
  16. foundation for Zen Mahjong.
  18. -- "Perfect" doesn't always mean perfect --
  20. When I was a young lad, I was fascinated to death with a mini-game NPC that exists in the video
  21. game Tales of Phantasia. If my memory serves me correctly, this certain NPC appears in the past
  22. city of Alvanista, and challenges you to a game he calls "Ishi-Tori". The premise of the game is
  23. simple; starting with a randomised number of counters, take turns removing either one, two, or
  24. three counters from the community pot. The person who removes the last counter is the loser.
  26. Beating the so called "Ishi-Tori" master was quite challenging for my younger self. The NPC seemed
  27. to play flawlessly every time, and I somehow found myself always ending up as the one to take the
  28. last counter. Frustrated, I swallowed my pride and went online to find a perfect strategy to defeat
  29. the NPC. As it turns out, the strategy is roughly as follows:
  31. "The number of counters at the beginning of the game will always be of the form (X * 4) + 1. When
  32. challenging the Ishi-Tori master, always elect to go second. When the Ishi-Tori master takes his
  33. turn, note how many counters Y he takes. Then, simply take (4 - Y) counters from the community
  34. pot. The Ishi-Tori master will be forced into taking the last counter every time."
  36. This was a mind blowing revelation to my infant mind. If you played the game of Ishi-Tori perfectly,
  37. there was a surefire way of winning everytime. In technical terms, Ishi-Tori is a "solved game." So
  38. long as the starting number of counters is of the form (X * 4) + 1, the player who goes second can
  39. always force a win.
  41. But there is something that I didn't bother to think about as a kid; is there a "perfect" strategy
  42. for the player going first? No matter what the first player does, the second player can always
  43. force a win. I believe in chess, they refer to the first player's situation as a "zugzwang."
  44. Assuming that the second player knows the winning strategy, whatever move the first player makes
  45. will be a losing move. The EV of each move that the first player makes is strictly the same: 0.
  46. Does this mean that any play that the first player follows can be considered a "perfect" play?
  48. (Interestingly, there is a winning strategy for the player who goes first if the starting number of
  49. counters is any number that does not produce a remainder of one. For example, if the starting
  50. number of counters is 10, the player that goes first can choose to take a single counter. This
  51. creates a game state where the "first" player is now second to act, and the "second" player is now
  52. in zugzwang.)
  54. -- "The game of Chess" and "That game of Chess" --
  56. There's a video out there that shows Magnus Carlsen, the current chess champion at the time of this
  57. post, checkmating multi-billionaire Bill Gates in only 9 moves. Perhaps most impressively is that
  58. Carlsen accomplished this feat with a meager time budget of 30 seconds, against Gates's 2 minutes.
  60. Needless to say, when Magnus Carlsen checkmated Bill Gates in 9 moves, he didn't play a perfect
  61. game of chess. There are numerous videos on the internet that explain how, if Gates had made a few
  62. different moves, he would have easily attained the upper hand against Carlsen. Carlsen himself
  63. admitted that he essentially relied on a "trick"; he presented Bill Gates with a problem that he
  64. didn't believe Gates would be able to solve.
  66. Let's twist the question a little bit. Clearly, Carlsen didn't play "the game of chess" perfectly.
  67. But did Carlsen play "that game of chess" perfectly? I think that it's arguable that he did. Given
  68. his knowns, Carlsen had ample reason to believe that Gates would undoubtedly fall for his trick.
  69. Gates, while an obviously intelligent individual, is relatively unfamiliar with the game of chess.
  70. He knows the rules of course, but not much else about the game. Since Carlsen only has 30 seconds
  71. on his clock, he needs to find a checkmate sequence fast. As Gates is unfamiliar with the game, and
  72. has himself only 2 minutes on the clock, Carlsen made a pretty safe bet that the sequence of moves
  73. he made would result in his victory. Gates fell for the trick, Carlsen converted that mistake into
  74. an advantage, and the rest is history.
  76. This might seem like a stretch, but chess players play like this all the time. A lot of chess
  77. basically lends itself to putting the opponent in the most uncomfortable position possible. When
  78. playing against weaker players, stronger players put themselves in "theoretically" weaker positions
  79. simply to take the weaker player out of their comfort zone. If the strong human player was playing
  80. against a supercomputer that could read the entire game tree, from the current board state all the
  81. way to a forced checkmate sequence, then the human player would obviously lose. But, because the
  82. weaker player doesn't know how to play that board state, the stronger player is advantaged even if
  83. they are in a theoretically disadvantaged state.
  85. Of course, this can't work all the time. The reason it doesn't work is because it's impossible to
  86. accurately predict someone's thoughts. Imagine a scenario where you're playing Rock-Paper-Scissors
  87. with a child who stubbornly refuses to throw anything but Rock. You've played 100 games with them,
  88. and they've thrown rock everytime. If we assume that child will throw Rock for their next move,
  89. there is a "perfect play" to win the next round: throw Paper! All too predictably, the child has a
  90. sudden change of heart and throw Scissors.
  92. The reason that your "perfect play" was not perfect, is because what you initially considered was
  93. a "known" (your opponent's action/response), was actually an unknown. This happens all the time. In
  94. chess, the weaker player might just end up randomly finding the correct way to deal with your
  95. trick. In mahjong, a player is in guarenteed 1st place, unless they play into your mangan hand.
  96. It is in their best interest to fold, but they brazenly push multiple dangerous tiles. They end up
  97. hitting you with their mangan hand, dropping you into 4th place.
  99. -- "The Axiom of Perfection" -- [WIP]
  101. This is the train of thought that led me to the first axiom of Zen Mahjong -- the Axiom of
  102. Perfection.
  104. "A perfect play is the play with the highest scoring Expected Value given all known relevant
  105. variables."
  107. Observe:
  109. In the example where we are playing Ishi-Tori, there are really two relevant variables:
  111. EV of Ishi-Tori = -1 * P((4 * X) + 1 | First to act) + 1 * P((4 * X) + 1 | Second to act)
  113. Where P((4 * X + 1) | First to act) = Probability that the are (4 * X) + 1 counters in the
  114. community pot given that you are first to act.
  116. In the example when we were playing Rock-Paper-Scissors with the child, there are three relevant
  117. variables, and we can model the game as follows:
  119. EV of Throwing Paper = -1 * P(Child(Scissors)) + 0 * P(Child(Paper)) + 1 * P(Child(Rock))
  121. If we are given that the child will always throw Rock, then our model becomes:
  123. EV of Throwing Paper = -1 * 0 + 0 * 0 + 1 * 1 = 1
  125. And thus, if we are given that the child will always throw Rock, the perfect play is to throw
  126. Paper.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand