您好,欢迎访问三七文档
ConnectFourusingAlpha-BetaPruningBillyLandowskiCptS5407December2010OverviewBackgroundConnectFourasasearchproblemAlpha-betapruningDetailsaboutwinningHeuristicsImplementation/DemoConclusionBackgroundSoldbyMiltonBradleyinFebruary19742playersAlternateturnsGoal:Connectfourtilesinarowhorizontally,vertically,ordiagonallyConnectFourasaSearchProblem≤7possiblemovesperturnEnumerateeachmoveContinueforeachboardconfigurationPlayer1Player2ConnectFourasaSearchProblemStates:Anyboardconfigurationwithatmostoneplayer’stileineachlocationInitialState:Anemptygameboardwithnotiles.Actions:Placeatileofthecurrentplayer’scolorintoanycolumnthatisnotfull.TransitionModel:Returnsaboardconfigurationwithatileaddedtothespecifiedcolumn.Goal/TerminalTest:Aplayerhasfourofhertilesinalineeitherhorizontally,vertically,ordiagonally,orthegameboardisfull(indicatingatie).Utility:+∞ifplayerhasconnectedfour,0ifboardisfull,–∞ifopponenthasconnectedfour.Alpha-betapruningO(bd/2)timecomplexityb=branchingfactor=7d=depth=7×6=42ComputationallyintensiveNeedcut-offdepthCanalsoaddheuristicsWinningConnectFourTowin,playerneedsa“winningline”of43-out-of-4HeuristicTowin,playerneedsa“near”winninglineof33-out-of-4Heuristic(cont.)Counttotal3-out-of-4“unblocked”winninglinesComparetoopponentUtility(p,G)=f(p,G)–f(opponent(p),G)f(a,G)=#of3-out-of-4winninglinesforplayeraonboardGScoreboardHeuristicExtend3-out-of-4heuristicton-out-of-4forn≤3AwardweightedpointsbasedonthevalueofnScore(p,G)=100(n3)+10(n2)+1(n1)niisthenumberofi-out-of-4winninglinesforplayerpongameboardGScoreboardHeuristic(cont.)Five1-out-of-4winninglines(n1=5)Five2-out-of-4winninglines(n2=5)Score=100(0)+10(5)+1(5)=55ScoreboardHeuristic(cont.)Compareplayers’scoresUtility(p,G)=Score(p,G)–Score(opponent(p),G)ImplementationWritteninC#under.NETFrameworkMicrosoftVisualStudio2008WindowsFormsapplicationCPUDifficulties4difficulties–Beginner–random–Moderate–alpha-betapruningwithcutoff-depth3andsimpleutilityfunction–Hard–alpha-betapruningwithcutoff-depth6and3-out-of-4heuristic–Expert–alpha-betapruningwithcutoff-depth6andscoreboardheuristicAspectofrandomnessComparisonofCPUDifficultiesDemonstration
本文标题:人工智能游戏开发
链接地址:https://www.777doc.com/doc-27583 .html