SlideShare a Scribd company logo
CptS 440 / 540
Artificial Intelligence
Adversarial Search
Game Playing
Why Study Game Playing?
• Games allow us to experiment with easier versions of real-world situations
• Hostile agents act against our goals
• Games have a finite set of moves
• Games are fairly easy to represent
• Good idea to decide about what to think
• Perfection is unrealistic, must settle for good
• One of the earliest areas of AI
– Claude Shannon and Alan Turing wrote chess programs in 1950s
• The opponent introduces uncertainty
• The environment may contain uncertainty (backgammon)
• Search space too hard to consider exhaustively
– Chess has about 1040 legal positions
– Efficient and effective search strategies even more critical
• Games are fun to target!
Assumptions
• Static or dynamic?
• Fully or partially observable?
• Discrete or continuous?
• Deterministic or stochastic?
• Episodic or sequential?
• Single agent or multiple agent?
Zero-Sum Games
• Focus primarily on “adversarial games”
• Two-player, zero-sum games
As Player 1 gains strength
Player 2 loses strength
and vice versa
The sum of the two strengths is always 0.
Search Applied to Adversarial Games
• Initial state
– Current board position (description of current game state)
• Operators
– Legal moves a player can make
• Terminal nodes
– Leaf nodes in the tree
– Indicate the game is over
• Utility function
– Payoff function
– Value of the outcome of a game
– Example: tic tac toe, utility is -1, 0, or 1
Using Search
• Search could be used to find a perfect sequence
of moves except the following problems arise:
– There exists an adversary who is trying to minimize
your chance of winning every other move
• You cannot control his/her move
– Search trees can be very large, but you have finite
time to move
• Chess has 1040 nodes in search space
• With single-agent search, can afford to wait
• Some two-player games have time limits
• Solution?
– Search to n levels in the tree (n ply)
– Evaluate the nodes at the nth level
– Head for the best looking node
Game Trees
• Tic tac toe
• Two players, MAX and MIN
• Moves (and levels) alternate between two players
Minimax Algorithm
• Search the tree to the end
• Assign utility values to terminal nodes
• Find the best move for MAX (on MAX’s turn), assuming:
– MAX will make the move that maximizes MAX’s utility
– MIN will make the move that minimizes MAX’s utility
• Here, MAX should make the leftmost move
• Minimax applet
Minimax Properties
• Complete if tree is finite
• Optimal if play against opponent with same strategy (utility
function)
• Time complexity is O(bm)
• Space complexity is O(bm) (depth-first exploration)
• If we have 100 seconds to make a move
– Can explore 104 nodes/second
– Can consider 106 nodes / move
• Standard approach is
– Apply a cutoff test (depth limit, quiescence)
– Evaluate nodes at cutoff (evaluation function estimates
desirability of position)
Static Board Evaluator
• We cannot look all the way to the end of the game
– Look ahead ply moves
– Evaluate nodes there using SBE
• Tic Tac Toe example
– #unblocked lines with Xs - #unblocked lines with Os
• Tradeoff
– Stupid, fast SBE: Massive search
• These are “Type A” systems
– Smart, slow SBE: Very little search
• These are “Type B” systems
– Humans are Type B systems
– Computer chess systems have been more successful using
Type A
– They get better by searching more ply
Comparison
0
2
4
6
8
10
12
14
16
18
20
1.4 1.6 1.8 2 2.2 2.4 2.6 2.8
ply
U.S. Chess Federation Rating x 103
40
…
Belle
Belle
Belle
Belle
Bobby
Fischer
Deep
Thought
Deep
Blue
Anatoly
Karpov
Gary
Kasparov
Hitech
Example
• Chess, SBE is typically linear weighted sum of features
– SBE(s) = w1f1(s) + w2f2(s) + … + wnfn(s)
– E.g., w1 = 9
• F1(s) = #white queens - #black queens
• For chess:
– 4 ply is human novice
– 8 ply is typical PC or human master
– 12 ply is grand master
Example
• Othello
• SBE1: #white pieces - #black pieces
• SBE2: weighted squares
Alpha-Beta Pruning
• Typically can only look 3-4 ply in allowable chess time
• Alpha-beta pruning simplifies search space without eliminating
optimality
– By applying common sense
– If one route allows queen to be captured and a better move is available
– Then don’t search further down bad path
– If one route would be bad for opponent, ignore that route also
Maintain [alpha, beta] window at each node during depth-first search
alpha = lower bound, change at max levels
beta = upper bound, change at min levels
2 7 1 No need to
look here!
Max
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Example
Bad and Good Cases for Alpha-Beta Pruning
• Bad: Worst moves encountered first
• Good: Good moves ordered first
• If we can order moves, we can get more benefit from alpha-beta pruning
4 MAX
+----------------+----------------+
2 3 4 MIN
+----+----+ +----+----+ +----+----+
6 4 2 7 5 3 8 6 4 MAX
+--+ +--+ +--+ +-+-+ +--+ +--+ +--+ +--+ +--+--+
6 5 4 3 2 1 1 3 7 4 5 2 3 8 2 1 6 1 2 4
4 MAX
+----------------+----------------+
4 3 2 MIN
+----+----+ +----+----+ +----+----+
4 6 8 3 x x 2 x x MAX
+--+ +--+ +--+ +--+ +-+-+
4 2 6 x 8 x 3 2 1 2 1
Alpha Beta Properties
• Pruning does not affect final result
• Good move ordering improves effectiveness of
pruning
• With perfect ordering, time complexity is
O(bm/2)
Problems with a fixed ply: The Horizon Effect
• Inevitable losses are postponed
• Unachievable goals appear achievable
• Short-term gains mask unavoidable
consequences (traps)
Lose queen Lose pawn
Lose queen!!!
The “look ahead horizon”
Solutions
• How to counter the horizon effect
– Feedover
• Do not cut off search at non-quiescent board positions
(dynamic positions)
• Example, king in danger
• Keep searching down that path until reach quiescent (stable)
nodes
– Secondary Search
• Search further down selected path to ensure this is the best
move
– Progressive Deepening
• Search one ply, then two ply, etc., until run out of time
• Similar to IDS
Variations on 2-Player Games
Multiplayer Games
• Each player maximizes utility
• Each node stores a vector of utilities
• Entire vector is backed up the tree
• 3-player example: If in leftmost state, should player 3 choose first
move because higher utility values?
• Result will be terminal state with utility values (v1=1, v2=2, v3=3)
• This vector is backed up to the parent node
• Need to consider cooperation among players
to move
1 (1 2 3)
+------------------+ +---------------------+
2 (1 2 3) (-1 5 2)
+--------+ +-----+ +--------+ +-------+
3 (1 2 3) (6 1 2) (-1 5 2) (5 4 5)
/  /  /  / 
1 (1 2 3) (4 2 1) (6 1 2) (7 4 -1) (5 -1 -1) (-1 5 2) (7 7 -1) (5 4 5)
Nondeterministic Games
• In backgammon, the dice rolls determine legal moves
Nondeterministic Games
Nondeterministic Game Algorithm
• Just like Minimax except also handle chance nodes
• Compute ExpectMinimaxValue of successors
– If n is terminal node, then ExpectMinimaxValue(n) =
Utility(n)
– If n is a Max node, then
ExpectMinimaxValue(n) = maxsSuccessors(n) ExpectMinimaxValue(s)
– If n is a Min node, then
ExpectMinimaxValue(n) = minsSuccessors(n) ExpectMinimaxValue(s)
– If n is a chance node, then
ExpectMinimaxValue(n) =
sSuccessors(n) P(s) * ExpectMinimaxValue(s)
Status of AI Game Players
• Tic Tac Toe
– Tied for best player in world
• Othello
– Computer better than any human
– Human champions now refuse to play
computer
• Scrabble
– Maven beat world champions Joel
Sherman and Matt Graham
• Backgammon
– 1992, Tesauro combines 3-ply search &
neural networks (with 160 hidden units)
yielding top-3 player
• Bridge
– Gib ranked among top players in the
world
• Poker
– Pokie plays at strong intermediate level
• Checkers
– 1994, Chinook ended 40-year reign of
human champion Marion Tinsley
• Chess
– 1997, Deep Blue beat human champion
Gary Kasparov in six-game match
– Deep Blue searches 200M
positions/second, up to 40 ply
– Now looking at other applications
(molecular dynamics, drug synthesis)
• Go
– 2008, MoGo running on 25 nodes (800
cores) beat Myungwan Kim
– $2M prize available for first computer
program to defeat a top player

More Related Content

Similar to CptS 440/ 540 AI.pptx

Game playing.ppt
Game playing.pptGame playing.ppt
Game playing.ppt
DrIndrajeetKumar
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topics
chougulesup79
 
cai
caicai
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
SabrinaShanta2
 
GamePlaying.ppt
GamePlaying.pptGamePlaying.ppt
GamePlaying.ppt
VihaanN2
 
games, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .pptgames, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .ppt
MuhammadAbdullah311866
 
chess-180927202627.pdf
chess-180927202627.pdfchess-180927202627.pdf
chess-180927202627.pdf
AhmedMaherAlmaqtari
 
Capgemini 1
Capgemini 1Capgemini 1
Capgemini 1
berasrujana
 
Chess Engine Programming
Chess Engine ProgrammingChess Engine Programming
Chess Engine Programming
Arno Huetter
 
484-7.ppt
484-7.ppt484-7.ppt
484-7.ppt
jimkana13
 
Games
GamesGames
cs-171-07-Games and Adversarila Search.ppt
cs-171-07-Games and Adversarila Search.pptcs-171-07-Games and Adversarila Search.ppt
cs-171-07-Games and Adversarila Search.ppt
Samiksha880257
 
AI subject - Game Theory and cps ppt pptx
AI subject  - Game Theory and cps ppt pptxAI subject  - Game Theory and cps ppt pptx
AI subject - Game Theory and cps ppt pptx
nizmishaik1
 
ch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.pptch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.ppt
SanGeet25
 
Ibm's deep blue chess grandmaster chips
Ibm's deep blue chess grandmaster chipsIbm's deep blue chess grandmaster chips
Ibm's deep blue chess grandmaster chips
Nadeeshaan Gunasinghe
 
AI Lecture 5 (game playing)
AI Lecture 5 (game playing)AI Lecture 5 (game playing)
AI Lecture 5 (game playing)
Tajim Md. Niamat Ullah Akhund
 
AlphaGo and AlphaGo Zero
AlphaGo and AlphaGo ZeroAlphaGo and AlphaGo Zero
AlphaGo and AlphaGo Zero
☕ Keita Watanabe
 
How i taught a computer to play chess
How i taught a computer to play chessHow i taught a computer to play chess
How i taught a computer to play chess
Rohit Vaidya
 
AI subject - cps 570 _ game _ theory.ppt
AI subject - cps 570 _ game _ theory.pptAI subject - cps 570 _ game _ theory.ppt
AI subject - cps 570 _ game _ theory.ppt
nizmishaik1
 
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
udayvanand
 

Similar to CptS 440/ 540 AI.pptx (20)

Game playing.ppt
Game playing.pptGame playing.ppt
Game playing.ppt
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topics
 
cai
caicai
cai
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
 
GamePlaying.ppt
GamePlaying.pptGamePlaying.ppt
GamePlaying.ppt
 
games, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .pptgames, infosec, privacy, adversaries .ppt
games, infosec, privacy, adversaries .ppt
 
chess-180927202627.pdf
chess-180927202627.pdfchess-180927202627.pdf
chess-180927202627.pdf
 
Capgemini 1
Capgemini 1Capgemini 1
Capgemini 1
 
Chess Engine Programming
Chess Engine ProgrammingChess Engine Programming
Chess Engine Programming
 
484-7.ppt
484-7.ppt484-7.ppt
484-7.ppt
 
Games
GamesGames
Games
 
cs-171-07-Games and Adversarila Search.ppt
cs-171-07-Games and Adversarila Search.pptcs-171-07-Games and Adversarila Search.ppt
cs-171-07-Games and Adversarila Search.ppt
 
AI subject - Game Theory and cps ppt pptx
AI subject  - Game Theory and cps ppt pptxAI subject  - Game Theory and cps ppt pptx
AI subject - Game Theory and cps ppt pptx
 
ch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.pptch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.ppt
 
Ibm's deep blue chess grandmaster chips
Ibm's deep blue chess grandmaster chipsIbm's deep blue chess grandmaster chips
Ibm's deep blue chess grandmaster chips
 
AI Lecture 5 (game playing)
AI Lecture 5 (game playing)AI Lecture 5 (game playing)
AI Lecture 5 (game playing)
 
AlphaGo and AlphaGo Zero
AlphaGo and AlphaGo ZeroAlphaGo and AlphaGo Zero
AlphaGo and AlphaGo Zero
 
How i taught a computer to play chess
How i taught a computer to play chessHow i taught a computer to play chess
How i taught a computer to play chess
 
AI subject - cps 570 _ game _ theory.ppt
AI subject - cps 570 _ game _ theory.pptAI subject - cps 570 _ game _ theory.ppt
AI subject - cps 570 _ game _ theory.ppt
 
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 

CptS 440/ 540 AI.pptx

  • 1. CptS 440 / 540 Artificial Intelligence Adversarial Search
  • 3. Why Study Game Playing? • Games allow us to experiment with easier versions of real-world situations • Hostile agents act against our goals • Games have a finite set of moves • Games are fairly easy to represent • Good idea to decide about what to think • Perfection is unrealistic, must settle for good • One of the earliest areas of AI – Claude Shannon and Alan Turing wrote chess programs in 1950s • The opponent introduces uncertainty • The environment may contain uncertainty (backgammon) • Search space too hard to consider exhaustively – Chess has about 1040 legal positions – Efficient and effective search strategies even more critical • Games are fun to target!
  • 4. Assumptions • Static or dynamic? • Fully or partially observable? • Discrete or continuous? • Deterministic or stochastic? • Episodic or sequential? • Single agent or multiple agent?
  • 5. Zero-Sum Games • Focus primarily on “adversarial games” • Two-player, zero-sum games As Player 1 gains strength Player 2 loses strength and vice versa The sum of the two strengths is always 0.
  • 6. Search Applied to Adversarial Games • Initial state – Current board position (description of current game state) • Operators – Legal moves a player can make • Terminal nodes – Leaf nodes in the tree – Indicate the game is over • Utility function – Payoff function – Value of the outcome of a game – Example: tic tac toe, utility is -1, 0, or 1
  • 7. Using Search • Search could be used to find a perfect sequence of moves except the following problems arise: – There exists an adversary who is trying to minimize your chance of winning every other move • You cannot control his/her move – Search trees can be very large, but you have finite time to move • Chess has 1040 nodes in search space • With single-agent search, can afford to wait • Some two-player games have time limits • Solution? – Search to n levels in the tree (n ply) – Evaluate the nodes at the nth level – Head for the best looking node
  • 8. Game Trees • Tic tac toe • Two players, MAX and MIN • Moves (and levels) alternate between two players
  • 9. Minimax Algorithm • Search the tree to the end • Assign utility values to terminal nodes • Find the best move for MAX (on MAX’s turn), assuming: – MAX will make the move that maximizes MAX’s utility – MIN will make the move that minimizes MAX’s utility • Here, MAX should make the leftmost move • Minimax applet
  • 10. Minimax Properties • Complete if tree is finite • Optimal if play against opponent with same strategy (utility function) • Time complexity is O(bm) • Space complexity is O(bm) (depth-first exploration) • If we have 100 seconds to make a move – Can explore 104 nodes/second – Can consider 106 nodes / move • Standard approach is – Apply a cutoff test (depth limit, quiescence) – Evaluate nodes at cutoff (evaluation function estimates desirability of position)
  • 11. Static Board Evaluator • We cannot look all the way to the end of the game – Look ahead ply moves – Evaluate nodes there using SBE • Tic Tac Toe example – #unblocked lines with Xs - #unblocked lines with Os • Tradeoff – Stupid, fast SBE: Massive search • These are “Type A” systems – Smart, slow SBE: Very little search • These are “Type B” systems – Humans are Type B systems – Computer chess systems have been more successful using Type A – They get better by searching more ply
  • 12. Comparison 0 2 4 6 8 10 12 14 16 18 20 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 ply U.S. Chess Federation Rating x 103 40 … Belle Belle Belle Belle Bobby Fischer Deep Thought Deep Blue Anatoly Karpov Gary Kasparov Hitech
  • 13. Example • Chess, SBE is typically linear weighted sum of features – SBE(s) = w1f1(s) + w2f2(s) + … + wnfn(s) – E.g., w1 = 9 • F1(s) = #white queens - #black queens • For chess: – 4 ply is human novice – 8 ply is typical PC or human master – 12 ply is grand master
  • 14. Example • Othello • SBE1: #white pieces - #black pieces • SBE2: weighted squares
  • 15. Alpha-Beta Pruning • Typically can only look 3-4 ply in allowable chess time • Alpha-beta pruning simplifies search space without eliminating optimality – By applying common sense – If one route allows queen to be captured and a better move is available – Then don’t search further down bad path – If one route would be bad for opponent, ignore that route also Maintain [alpha, beta] window at each node during depth-first search alpha = lower bound, change at max levels beta = upper bound, change at min levels 2 7 1 No need to look here! Max
  • 55. Bad and Good Cases for Alpha-Beta Pruning • Bad: Worst moves encountered first • Good: Good moves ordered first • If we can order moves, we can get more benefit from alpha-beta pruning 4 MAX +----------------+----------------+ 2 3 4 MIN +----+----+ +----+----+ +----+----+ 6 4 2 7 5 3 8 6 4 MAX +--+ +--+ +--+ +-+-+ +--+ +--+ +--+ +--+ +--+--+ 6 5 4 3 2 1 1 3 7 4 5 2 3 8 2 1 6 1 2 4 4 MAX +----------------+----------------+ 4 3 2 MIN +----+----+ +----+----+ +----+----+ 4 6 8 3 x x 2 x x MAX +--+ +--+ +--+ +--+ +-+-+ 4 2 6 x 8 x 3 2 1 2 1
  • 56. Alpha Beta Properties • Pruning does not affect final result • Good move ordering improves effectiveness of pruning • With perfect ordering, time complexity is O(bm/2)
  • 57. Problems with a fixed ply: The Horizon Effect • Inevitable losses are postponed • Unachievable goals appear achievable • Short-term gains mask unavoidable consequences (traps) Lose queen Lose pawn Lose queen!!! The “look ahead horizon”
  • 58. Solutions • How to counter the horizon effect – Feedover • Do not cut off search at non-quiescent board positions (dynamic positions) • Example, king in danger • Keep searching down that path until reach quiescent (stable) nodes – Secondary Search • Search further down selected path to ensure this is the best move – Progressive Deepening • Search one ply, then two ply, etc., until run out of time • Similar to IDS
  • 59. Variations on 2-Player Games Multiplayer Games • Each player maximizes utility • Each node stores a vector of utilities • Entire vector is backed up the tree • 3-player example: If in leftmost state, should player 3 choose first move because higher utility values? • Result will be terminal state with utility values (v1=1, v2=2, v3=3) • This vector is backed up to the parent node • Need to consider cooperation among players to move 1 (1 2 3) +------------------+ +---------------------+ 2 (1 2 3) (-1 5 2) +--------+ +-----+ +--------+ +-------+ 3 (1 2 3) (6 1 2) (-1 5 2) (5 4 5) / / / / 1 (1 2 3) (4 2 1) (6 1 2) (7 4 -1) (5 -1 -1) (-1 5 2) (7 7 -1) (5 4 5)
  • 60. Nondeterministic Games • In backgammon, the dice rolls determine legal moves
  • 62. Nondeterministic Game Algorithm • Just like Minimax except also handle chance nodes • Compute ExpectMinimaxValue of successors – If n is terminal node, then ExpectMinimaxValue(n) = Utility(n) – If n is a Max node, then ExpectMinimaxValue(n) = maxsSuccessors(n) ExpectMinimaxValue(s) – If n is a Min node, then ExpectMinimaxValue(n) = minsSuccessors(n) ExpectMinimaxValue(s) – If n is a chance node, then ExpectMinimaxValue(n) = sSuccessors(n) P(s) * ExpectMinimaxValue(s)
  • 63. Status of AI Game Players • Tic Tac Toe – Tied for best player in world • Othello – Computer better than any human – Human champions now refuse to play computer • Scrabble – Maven beat world champions Joel Sherman and Matt Graham • Backgammon – 1992, Tesauro combines 3-ply search & neural networks (with 160 hidden units) yielding top-3 player • Bridge – Gib ranked among top players in the world • Poker – Pokie plays at strong intermediate level • Checkers – 1994, Chinook ended 40-year reign of human champion Marion Tinsley • Chess – 1997, Deep Blue beat human champion Gary Kasparov in six-game match – Deep Blue searches 200M positions/second, up to 40 ply – Now looking at other applications (molecular dynamics, drug synthesis) • Go – 2008, MoGo running on 25 nodes (800 cores) beat Myungwan Kim – $2M prize available for first computer program to defeat a top player