Top Banner
Solving Mahjong Solitaire Positions Bachelor Thesis Presentation Tijmen Stam December 6, 2007 [email protected]
16

Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 [email protected]. Overview

Feb 26, 2019

Download

Documents

trannhan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Solving Mahjong Solitaire Positions

Bachelor Thesis Presentation

Tijmen Stam

December 6, 2007

[email protected]

Page 2: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Overview

● Introduction● The Game● Research Question● Heuristics and Strategies● Results● Conclusion

Page 3: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Introduction

Mahjong is the name of two games:– Mahjong, a 4-player table game invented by

Confucius (or in the 19th century)

– Mahjong Solitaire, a 1-player computer game first implemented by Brodie Lockard in 1981

The subject of our research is Mahjong Solitaire.

Page 4: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

The Game (1)

Mahjong Solitaire is a tile removal game.

Stones: 144, in 36 quadruplets

Goal: Remove all stones

Page 5: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

The Game (2)

Rules:– Stones have to be removed in matching pairs

– A stone has to be free when it is removed

– A stone is free when● there is no stone to the left and to the right of it, and● there is no stone on top of it

In this research, we have imperfect information: we don't know the stones we don't see.

Page 6: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Research Question

How well do various solving strategies handle the solving of Mahjong Solitaire positions?– In the imperfect-information game

– Using the Turtle layout

Page 7: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Solutions

Two solving methods:● Heuristics (1 + random researched)● Search strategies (4 researched)

Strategies & Heuristics are combined: 8 test configurations

Page 8: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Random Strategy

“Hey, there is a free pair. Let's pick it!”

Randomly pick one pair from all available free pairs.

Page 9: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

MultipleFirst Strategy

“I can freely pick quadruplets – Let's pick them first.”

If there are quadruplets, pick them first.

Else, pick two stones from all triplets first.Else, if there are only pairs, pick those.

Page 10: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Greedy Strategy

“Free stones gives possibilities. I want maximum possibilities.”

Pick a pair such that the increase in free stones is maximal.

Page 11: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Obstruction-Tree Strategy (1)

“Stone X is blocking many other stones. I want to remove stone X first.”

Process:● Find stone a that blocks other stones

● Find matching stone(s) b to a (findMatches)

● If b is free, pick pair (a,b). Else, find all stones c blocking b (expandObstructors)

● Find matching stone(s) d to stones c (findMatches)

Page 12: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Obstruction-Tree Strategy (2)

Example: remove stone with ID 123

Page 13: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Heuristics

If in one of the strategies there are multiple equal choices, a heuristic is used.

2 heuristics: Random and MaxBlock

MaxBlock ≈ “# stones a stone n is blocking”● For each layer of stones, the “distance” to the

center of the row. ● MaxBlock = sum of row values for stones below

Page 14: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Results

Percentage of solved positions

Page 15: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Conclusion

To solve positions of the imperfect-information game of Mahjong, using a heuristic without using a complex search strategy is a simple yet very effective way to achieve that goal.

Page 16: Bachelor Thesis Presentation Tijmen Stam December 6, 2007iivq.net/scriptie/Presentatie Scriptie.pdf · Bachelor Thesis Presentation Tijmen Stam December 6, 2007 info@iivq.net. Overview

Questions?

Literature:

● Allis, L. Victor (1994). Searching for Solutions in Games and Artificial Intelligence. Ponsen & Looijen, Wageningen.

● Butler, Jonathan (2001). The tiles of mah jong. http://www.atdesk.com/jon/mahjong.html.

● Elonen, Jarno (2003 - 2004). There is no deterministic way to solve a mahjongg solitaire game. http://elonen.iki.fi/code/ misc-notes/no-alg-mahj-solit/.

● Emmett, Christopher James (2007). Mahjong solitaire. Technical report, The University of Manchester.

● Fregger, Brad (1999). Lucky That Way. Sunstar Publishing,U.S.

● Gimeno Fortea, Pedro (1998-2005). Mahjongg solitaire solver. http://www.formauri.es/ personal/pgimeno/mj/mjsol.html.

● Marsaglia, George (1968). Random numbers fall mainly in the planes. Proc Natl Acad Sci U S A., Vol. 61(1), pp. 25-28.

● Matsumoto, Makoto and Nishimura, Takuji (1998). Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation, Vol. 8(1), pp. 3-30.

● Petersen, Vegard Krog (2003-2005). Solitaire mahjongg - a guide to the world of the computer tile-matching, solitaire mahjongg games - history. http://home.halden.net/vkp/vkp/.

● Schaeffer, Jonathan, Burch, Neil, Bjornsson, Yngvi, Kishimoto, Akihiro, Muller, Martin, Lake, Rob, Lu, Paul, and Sutphen, Steve (2007). Checkers is solved. Science, Vol. 317.

● Shannon, Claude E. (1950). Programming a computer for playing chess. Philosophical Magazine, Vol. 41, No. 314.

Images based upon the "postmodern" tileset released with Gnome Mahjongg under the GNU General Public Licence