Ch. 5 – Adversarial Search Supplemental slides for CSE 327 Prof. Jeff Heflin.

Presentation on theme: "Ch. 5 – Adversarial Search Supplemental slides for CSE 327 Prof. Jeff Heflin."— Presentation transcript:

Ch. 5 – Adversarial Search Supplemental slides for CSE 327 Prof. Jeff Heflin

Tic-Tac-Toe Transition Model XX O O X O XXO O X O to top-left O to bottom-center O to top-center O to top-right O XXO O X O XXO O X XXO OOX

Minimax Algorithm function M INIMAX -D ECISION (state) returns an action return arg max a  ACTIONS(s) M IN -V ALUE (R ESULT (state,a)) function M AX -V ALUE (state) returns a utility value if T ERMINAL -T EST (state) then return U TILITY (state) v  -  for each a in A CTIONS (state) do v  M AX (v, M IN -V ALUE (R ESULT (s,a))) return v function M IN -V ALUE (state) returns a utility value if T ERMINAL -T EST (state) then return U TILITY (state) v  +  for each a in A CTIONS (state) do v  M IN (v, M AX -V ALUE (R ESULT (s,a))) return v From Figure 5.3, p. 166

Utility-Based Agent sensors actuators Agent Environment What the world is like now What action I should do now Utility State How the world evolves What my actions do What it will be like if I do action A How happy will I be in such a state

Minimax with Cutoff Limit function M INIMAX -D ECISION (state) returns an action return arg max a  A CTION S(s) M IN -V ALUE (R ESULT (state,a),0) function M AX -V ALUE (state,depth) returns a utility value if C UTOFF -T ES t(state,depth) then return E VAL (state) v  -  for each a in A CTIONS (state) do v  M AX (v, M IN -V ALUE (R ESULT (s,a)), depth+1) return v function M IN -V ALUE (state,depth) returns a utility value if C UTOFF -T ES t(state,depth) then return E VAL (state) v  +  for each a in A CTIONS (state) do v  M IN (v, M AX -V ALUE (R ESULT (s,a)), depth+1) return v