a scrabble artificial intelligence game - cs.sjsu.edu endgame strategies. • evaluate performance...
TRANSCRIPT
AScrabbleArtificialIntelligenceGame
AdvisorDr. Chris Pollett
Committee MembersDr. PhilipHellerDr. RobertChun
ByPriyathaJojiAbraham
• Introduction
• Background
• OverviewofMavenandQuackleAI
• Endgamestrategies
• ExperimentsandObservations
• ConclusionandFuturework
• Questions
Agenda
ProjectGoal
• Buildatwo-playerScrabbleAIgameengine.
• CreatetwoAI computerplayershavingdifferentmovegenerationheuristicsandendgamestrategies.
• Evaluateperformancebasedonthewinningcriteria,qualityofmoves,andtimeconsumption.
• Developvariantsofworld-championcomputerAI,‘Maven,’andanotherAI,‘Quackle.’
• ArtificialIntelligence(AI)isacollectionoftechniquesusedtobuildintelligent
agentsthatperceiveitsenvironmentandactrationallytoaccomplishthe goal.
• Gamesmakeanidealtest-bedforAIapplications.
• Scrabbleisacrosswordboardgame,widelypopularforitsgamestrategy.
• Scrabblecomputerplayershavealreadysurpassedhumanplayersintournaments,however,efficientheuristicsarerequiredtodefeatanotherScrabbleComputerAI.
• MavenandQuackleAIcompeteagainsteachotherusingitsthree-plyfuturelookaheadsimulationtechniqueanddifferentmovegenerations.
Introduction
• Scrabbleisanimperfectinformationgame:partialinformationaboutthegamestatewithalargebranchingfactor.
• Animperfectinformationstateposesdistinctchallengesfordecisionmakingagents,e.g.,playersareunawareofopponent’srack,andit'shardtopredictnextmove.
• End-gamesarecomplexandcrucialtothesuccessofthegame.
• End-gamesarereal-worldsituationswherethemoveoptionsarelimitedandmodelstrategytomaximizerewards.
• Normalhighscoreyieldingapproachesarenotgoodenoughforendgames.
• Scrabblerequiresquickmovegenerationtechniques.
ProblemStatement
• MavenAI createdbyBrianSheppard[1]in2002defeatedseveralworldchampion,humanplayers.
• QuackleAIcreatedbyJasonKatz-BrownandJohn[2]in2006hasbeatenworldchampionDavidBoys.
• AnAIGameenginedevelopedbyStanfordstudentsin2016betweenQuackleAIandanewComputerAIwith MonteCarloSimulationsofdepth2.
• Theyfocusedonmid-gamescenariosandnotendgamesduetotimelimitations.
RelatedWorks
ScrabbleGameRulesandTerminology
• Board:15x15gridgameboard.
• Tiles:Fillseachboardsquare;holdsletterandvalue.
• TileBag:Holds100tiles,98arealphabets and2blanks.
• Rack:Groupofseventilesholdsbyeachplayer.
• RackLeave:Lettersleftoutontherackafteroneplay.
• Bingo:Playwhichusesallthesevenlettersontherack.
• PremiumSquares:Squaresthatearnbonuspoints.Fig1.ConventionalScrabblegameboard[2]
• LegalMoves:Nodiagonalplays,playermustextendthewordsonboard.
• HotSpots:Excellentsquaresontheboardwithbonus-scoringopportunities.
• Ply:Player’sturnorhalfamoveinatwoplayergame.
• Weimplemented MavenAIandQuackleAIfromscratchinJava.
• Mavenapplies3-plylookaheadstrategyandvariousheuristicsforsimulation.
• Quacklecalculateswinprobabilityestimationusing3-plylookaheadstrategy.
• QuackleAIservesasa benchmarktomeasuretheperformanceofMavenAI
variants.
MavenAIandQuackleAI
• OfficialScrabblePlayersDictionary(OSPD)size: 1.8MBcontains>100,000words.
• OurAIplayerusedatrimmeddictionaryofsize:1KBcontains232words.
• MavenusesaDirectedAcyclicWordGraph(DAWG)torepresentdictionarythat
enablesfastmove-generation.
• DAWGisaminimalrepresentationofatriedatastructure.
DictionaryandLexiconRepresentation
TrieandDAWG
Fig3.DAWGwithitslexicon[5] Fig2.Triewithitslexicon[5]
• Weusedtrieandaword-listrepresentationforstoringtheentiredictionary.
TRIE DAWG
• Maven’smovegeneratorappliesdifferentheuristicsoneachplaytofindthebest
candidatemovefrom20-30candidatemoves.
• Onlylegalplacementsareconsideredontheboard.
• E.g.:The best possibleword:“FARM,”placeacross[A]N(Horizontaldirection).
MavenMoveGeneration
Rack:MFRFGTH
Split“FARM”onanchortile[A]intoleftandrightparts
Placeleftpart“F”onboard
Placerightpart“RM”on
board
Iflegalwordformation
withadjacentcellsreturnlegal,elsereturnanillegalflag
Fig4.Anexampleofhorizontallegalplacement
• Heuristics:Setofevaluationparameterstoinstantlysolvetheproblemswhen
traditionalapproachesareoftenslow.
• FourmainheuristicsusedinMaven, implementedinourproject:
1.Vowel-ConsonantBalance
2.U-With-Q-Unseen
3.Hotspotblock
4.First-TurnOpen
MavenHeuristics
MavenGamePhases
FirstMove
Mid-game
Pre-endgame
End-game
• Beginninguntil9orfewertilesinthebag.• Greedyscoringstrategy.
• Totalof16unseentiles.• 9inbagand7inopponent’srack.• Combinesmidandpre-endgame.
• Zerotilesinthebag.• 3endgamestrategies.
• 100tilesinthebag.• FirstturnopenexceptBingo.
• Endgamesarecomplicatedasplayershouldmakeamoveinacontrolledmannerto
maximizerewards withinthetimelimit.
MavenAIendgame
Q-Sticking
Slowendgame
Q-Stickingwith
slowendgame
MavenEnd-GameStrategies
• WhenopponentstuckwithunplayabletileslikeQorV.
• Blockthebighotspotandplaygreedyapproach.
Fig5.MavenAIvariants
• Maximizethevalueoftilesbyplayingoutslowly.
• Delaythegameusinglow-scoringtiles.
• Blocktheopponentmoves usinglow-scoringtilesifplayerisbehind.
• Ifplayerisahead,closethegamebymaximizingreward.
• Traptheopponentwithawkwardtiles.
• Mavencomputes 3plylook-aheadoffuturemoves.
• Ply1:Placethebestscoringcandidatewordforagivenrackandboardstate.
• Ply2:Findtheopponent’spossiblecandidatewordandresultantscoreifthatwordisplaced.
• Ply3:Evaluatethecurrentstateandfindthebestwordtoblockthatmoveinanendgame.
MavenAILook- AheadandSimulation
QuackleAISchematic Diagram
Fig6.Quackleworkflow[2]
• Quackleconsidersrackleaveheuristics.
• Quacklehasfollowingtwocomponents:
i)Kibitzer:Itappliesstaticevaluationandrankscandidatemovesquickly.
ii)Simulationengine:Itapplies3-plylookahead andrepeated100-300timesfor100randomracksandcalculatespointdifferential.Pointdiff=OurTotalScore– Opponent’sScore+Residualrackleavevalueestimate
23candidatewords
e.g.:30words
2300min.simulations
• Quackledetermineswinningprobability
basedonthepointdifferentialandthe
remainingtilecountforeachcandidate
move.
• Candidatemovelistissortedindescending
orderofwinningprobabilitypercentage.
• Ifwordsarefoundwiththesame
probability,breakthetiebyselectingthe
wordwithlowestrackleavevalue.
QuackleWinPercentageEstimation
Fig7.Quacklesimulationexample
Breakthetie
• Experimentsareconductedon10randomlygeneratedScrabbleendgames.
• ExecutedonaMacMachinewith16GBRAM-quad-coreprocessorrunningJava
version7.
• Weloadedreal-worldend-gamescenarios[8,11,13]usedintournamentsintoour
projectconsideringcurrentgameboardstate,playerrack,playerscore,tilebagand
scorelead.
Experiment1:MavenQ-StickingAIversusQuackleAI
Experiment2:MavenslowendgameAIversusQuackleAI
Experiment3:MavenQ-Sticking-slowendgameAIversusQuackleAI
Experiment4:MavenQ-Sticking-slowendgameAIversusNo-Q-Sticking
ExperimentsandObservations
• Howtoruntheexperiment?
• CreateMavenandQuackleAIsintwoseparateclasses.
• Makefunctioncallstofirstmove()ofgameopenAIandbestmove()ofbothAIsfor
subsequentplaysalternativelyuntilaRun experimentfor10randomScrabble
end-gamessimulatedintheprogram.
• Winnerisdetected.
• Markthescoresandcalculatetheaveragemeanscorescoreandstandard
deviation(SD).
• Determinethewinnerandcomparethepointscorespread.
ExperimentsandObservations
I.Experiment1:MavenQ-StickingAIversusQuackleAIforEndgameconductedon
randomlygeneratedScrabbleendgames.
Hypothesis:WepredictedthatMavenQ-StickingAIwilloutscore Quackleas
MavenAIcanblockthehotspotsofQuacklewhenQuackleisstuckwithQandplay
withagreedyapproach.
ExperimentsandObservations
Observations:
Manyfactorsinfluencedthewinner.• Blockedhot-spots• Scoredifference• Racktilevalue• Numberofracktiles• Kindofunplayabletile
Result:MavenoutscoresQuackle.Hypothesisconfirmed.
PlayerAI MeanScore+StandardDeviation
MavenQ-StickingAI 473.2± 70
Quackle 450.4± 59.2
II.Experiment2:MavenslowendgameAIversusQuackleAIforEndgameconductedon
10randomlygeneratedScrabbleendgames.
Hypothesis:WepredictedthatMavenwilloutscore Quackle.
ExperimentsandObservations
Observations:
• HighScorelead• Maventilesfinishedsoon,couldnotdrag
endgame• Highpointunplayabletile
Result:QuackleoutscoresMaven.Hypothesisinvalid. PlayerAI MeanScore+StandardDeviation
Mavenslow-endgameAI 461.9± 80
Quackle 442.6± 60
III.Experiment3:MavenQ-Sticking-slowendgameAIversusQuacklefor10random
endgames.
Hypothesis:WepredictedthatMavenwilloutscore Quackleasitblockallthespots
ExperimentsandObservations
Observations:
• Blockedhotspots• Blockedsingleopportunity• Lowscoringtilesmaximizedrewards• Placementonpremiumbonus• Gainedpenaltyscore• Highscorevariation
Result:MavenoutscoreQuackle.Hypothesisconfirmed.
PlayerAI MeanScore+
StandardDeviation
MavenQ-Sticking
slow-endgameAI
472.2±86.79
Quackle 417.9± 54.63
III.Experiment3:MavenQ-Sticking-slowendgameAIversusNo-Q-Stickingfor10random
games.
Hypothesis:WepredictedthatMavenwilloutscoreQuackleasitblockallthespots.
ExperimentsandObservations
Observations:
• Blockedhotspots• Blockedsingleopportunity• Lowscoringtilesmaximizedrewards• Fastplay-out• Penaltyscore• Highscorelead
Result:MavenoutscoredQuackle.Hypothesisconfirmed.
PlayerAI MeanScore+SD
MavenQ-Stickingslow-end
gameAI
479.9± 75
No-QStickingAIScore 415.1± 45
• MavenAIwithQ-Sticking-slow endgameAIplaysthebest.
• Mavenblockshotspotsaswellasearnbonuspointsbytrappingtheopponent.
• NoQ-StickingAIaremostfavorableduringmid-games.
• Projecttakes100-255stofinish100simulationsofQuackle,originally19-50s.
• MavenAItakes0-2000ms,originally0-30msforonemovegeneration.
• Infuturework,wewillreducethesimulationtime andimplementaninteractive
graphicalUIfortheproject.
• QuackledataanalysisfeaturescanbeincorporatedintoourAIwhichsimulate
deeperpliesupto1000iteration.
ConclusionsandFutureWork
[1]B.Sheppard,“World-championship-caliberScrabble,” ArtificialIntelligence,vol.134,pp.241- 275,Jan.2002.[Online].Available:https://smp.uq.edu.au/sites/smp.uq.edu.au/files/WorldChampionshipScrabble.pdf
[2]J.K.BrownandJ.O'Laughlin,“HowQuacklePlaysScrabble,”2007.[Online].Available:http://people.csail.mit.edu/jasonkb/quackle/doc/how_quackle_plays_scrabble.html
[3]S.RussellandP.Norvig,“Adversarialsearch,”inArtificialIntelligence:AModern Approach,3rded.NewJersey:Pearson,2010,Ch.5,pp.161-189.
[4]Review:ScrabbleforiPad,[Online].Available:https://appadvice.com/appnn/2010/04/review-scrabble-ipad
[5]C.JosephsonandR.Greene,“CS221Fall2016projectfinalreport:ScrabbleAI,”2016.[Online].Available:https://web.stanford.edu/class/cs221/2017/restricted/p-final/cajoseph/final.pdf
[6]N.Gupta et.al,“AIAgenttoplayScrabble,”2017,[Online].Available:https://web.stanford.edu/class/cs221/2017/restricted/p-final/rsbauer/final.pdf
References
[7]S.A.Gordon,“AfasterScrabblemovegenerationalgorithm,”Software:PracticeandExperience,vol.24,no.2,pp.219- 232,Feb.1994.[Online].Available:http://ericsink.com/downloads/faster-scrabblegordon.pdf
[8]“Endgamefinesse”,AustralianScrabble® PlayersAssociation,Mar.2005.[Online].Available:http://www.scrabble.org.au/strategy/endgame.htm
[9]J.Mandziuk,“MavenandQuackle-Thetoplevelmachinescrabbleplayers,”inKnowledge-Free andLearning-BasedMethodsinIntelligentGamePlaying,Chennai,India:Springer,2010,Ch.4,pp.45- 47.
[10] A.W.AppelandG.J.Jacobson,“Theworld'sfastestScrabbleprogram,”CommunicationsoftheACMpp.572-576,May.1988.[Online].Available:http://www.gtoal.com/wordgames/jacobson+appel/aj.pdf
[11]“Masteringtheendgame”,BattleLine GamesLLC,2013.[Online].Available:http://www.2letterwords.com/Mastering_the_End_Game.html
[12]“Breakingthegame,”2014.[Online].Available:http://www.breakingthegame.net/strategy
[13]J.Edley andJ.Williams,“EverythingScrabble:ThirdEdition,”2009,pp.255- 315.[Online].Available:https://books.google.com/books?id=Uml_kpOO64gC&lpg=PP1&pg=PR5#v=onepage&q=end%20game&f=false
References