Bachelor thesis presentation - Solving Mahjong Solitaire Positions

Transcription

Bachelor thesis presentation - Solving Mahjong Solitaire Positions
Solving Mahjong Solitaire Positions
Bachelor Thesis Presentation
Tijmen Stam
December 6, 2007
[email protected]
Overview
●
Introduction
●
The Game
●
Research Question
●
Heuristics and Strategies
●
Results
●
Conclusion
Introduction
Mahjong is the name of two games:
–
Mahjong, a 4-player table game invented by
Confucius (or in the 19 century)
th
–
Mahjong Solitaire, a 1-player computer game first
implemented by Brodie Lockard in 1981
The subject of our research is Mahjong Solitaire.
The Game (1)
Mahjong Solitaire is a
tile removal game.
Stones: 144, in 36
quadruplets
Goal: Remove all
stones
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.
Research Question
How well do various solving strategies handle the
solving of Mahjong Solitaire positions?
–
In the imperfect-information game
–
Using the Turtle layout
Solutions
Two solving methods:
●
Heuristics (1 + random researched)
●
Search strategies (4 researched)
Strategies & Heuristics are combined: 8 test
configurations
Random Strategy
“Hey, there is a free pair. Let's pick it!”
Randomly pick one pair from all available free
pairs.
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.
Greedy Strategy
“Free stones gives possibilities. I want maximum
possibilities.”
Pick a pair such that the increase in free stones
is maximal.
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)
Obstruction-Tree Strategy (2)
Example: remove stone with ID 123
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
Results
Percentage of solved positions
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.
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-algmahj-solit/.
●
●
●
●
●
Emmett, Christopher James (2007). Mahjong solitaire. Technical report,
The University of Manchester.
Fregger, Brad (1999). Lucky That Way. Sunstar Publishing,U.S.
●
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.
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.
Images based upon the "postmodern" tileset released with Gnome Mahjongg
under the GNU General Public Licence