Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 28 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
28
Dung lượng
142,04 KB
Nội dung
m c o en Zo ne Game Playing Si nh Vi Chapter SinhVienZone.com https://fb.com/sinhvienzonevn m ne Overview Zo Minimax search en Adding alpha-beta cutoffs Vi Additional refinements Iterative deepening Si nh • • • • • c o Outline SinhVienZone.com https://fb.com/sinhvienzonevn ne c o Old beliefs m Overview Zo Games provided a structured task in which it was very easy to measure success or failure Si nh Vi en Games did not obviously require large amounts of knowledge, thought to be solvable by straightforward search SinhVienZone.com https://fb.com/sinhvienzonevn m Overview ne c o Chess Zo The average branching factor is around 35 en In an average game, each player might make 50 moves Si nh Vi One would have to examine 35100 positions SinhVienZone.com https://fb.com/sinhvienzonevn m Overview Si nh Vi en Zo ne c o • Improve the generate procedure so that only good moves are generated SinhVienZone.com https://fb.com/sinhvienzonevn m Overview ne c o • Improve the generate procedure so that only good moves are generated Si nh Vi en Zo plausible-moves vs legal-moves SinhVienZone.com https://fb.com/sinhvienzonevn m Overview Si nh Vi en Zo ne c o • Improve the test procedure so that the best moves will be recognized and explored first SinhVienZone.com https://fb.com/sinhvienzonevn m Overview Si nh Vi en Zo less moves to be evaluated ne c o • Improve the test procedure so that the best moves will be recognized and explored first SinhVienZone.com https://fb.com/sinhvienzonevn m Overview ne c o • It is not usually possible to search until a goal state is found en Zo • It has to evaluate individual board positions by estimating how likely they are to lead to a win Vi Static evaluation function Si nh • Credit assignment problem (Minsky, 1963) SinhVienZone.com https://fb.com/sinhvienzonevn .c o • Good plausible-move generator m Overview Si nh Vi en Zo ne • Good static evaluation function 10 SinhVienZone.com https://fb.com/sinhvienzonevn m Minimax Search c o Opponent(Position, Depth): Zo ne for each S ∈ SUCCESSORS(Position) RESULT = Player(S, Depth + 1) Vi en NEW-VALUE = PLAYER-VALUE(RESULT) if NEW-VALUE < MIN-SCORE, then return Si nh MIN-SCORE = NEW-VALUE BEST-PATH = PATH(RESULT) + S VALUE = MIN-SCORE PATH = BEST-PATH 14 SinhVienZone.com https://fb.com/sinhvienzonevn .c o Any-Player(Position, Depth): m Minimax Search Zo ne for each S ∈ SUCCESSORS(Position) RESULT = Any-Player(S, Depth + 1) Vi en NEW-VALUE = − VALUE(RESULT) if NEW-VALUE > BEST-SCORE, then return Si nh BEST-SCORE = NEW-VALUE BEST-PATH = PATH(RESULT) + S VALUE = BEST-SCORE PATH = BEST-PATH 15 SinhVienZone.com https://fb.com/sinhvienzonevn ne c o MINIMAX(Position, Depth, Player): m Minimax Search Zo • MOVE-GEN(Position, Player) en • STATIC(Position, Player) Si nh Vi • DEEP-ENOUGH(Position, Depth) 16 SinhVienZone.com https://fb.com/sinhvienzonevn m Minimax Search c o if DEEP-ENOUGH(Position, Depth), then return: Zo ne VALUE = STATIC(Position, Player) PATH = nil en SUCCESSORS = MOVE-GEN(Position, Player) Si nh Vi if SUCCESSORS is empty, then as in Step 17 SinhVienZone.com https://fb.com/sinhvienzonevn .c o if SUCCESSORS is not empty: m Minimax Search ne RESULT-SUCC = MINIMAX(SUCC, Depth+1, Opp(Player)) Zo NEW-VALUE = - VALUE(RESULT-SUCC) en if NEW-VALUE > BEST-SCORE, then: Vi BEST-SCORE = NEW-VALUE Return: Si nh BEST-PATH = PATH(RESULT-SUCC) + SUCC VALUE = BEST-SCORE PATH = BEST-PATH 18 SinhVienZone.com https://fb.com/sinhvienzonevn m Adding Alpha-Beta Cutoffs ne c o • At the player choice, maximize the static evaluation of the next position Zo > α threshold Si nh Vi < β threshold en • At the opponent choice, minimize the static evaluation of the next position 19 SinhVienZone.com https://fb.com/sinhvienzonevn m Adding Alpha-Beta Cutoffs c o A β cutoff G en J F Vi I Zo E < 4? Si nh D C > 3? ne B α cutoff H Maximizing ply Player Minimizing ply Opponent Maximizing ply Player Minimizing ply Opponent 20 SinhVienZone.com https://fb.com/sinhvienzonevn m Adding Alpha-Beta Cutoffs c o A C > α? β cutoff G H v≤α en J F Vi I v≥β Zo E < β? Si nh D β ne B α α cutoff Maximizing ply Player Minimizing ply Opponent Maximizing ply Player Minimizing ply Opponent 21 SinhVienZone.com https://fb.com/sinhvienzonevn Player(Position, Depth, α, β): c o m for each S ∈ SUCCESSORS(Position) RESULT = Opponent(S, Depth + 1, α, β) Zo ne NEW-VALUE = PLAYER-VALUE(RESULT) α = NEW-VALUE en if NEW-VALUE > α, then Vi BEST-PATH = PATH(RESULT) + S if α ≥ β then return return Si nh VALUE = α PATH = BEST-PATH VALUE = α PATH = BEST-PATH 22 SinhVienZone.com https://fb.com/sinhvienzonevn Opponent(Position, Depth, α, β): c o m for each S ∈ SUCCESSORS(Position) RESULT = Player(S, Depth + 1, α, β) Zo ne NEW-VALUE = PLAYER-VALUE(RESULT) β = NEW-VALUE en if NEW-VALUE < β, then Vi BEST-PATH = PATH(RESULT) + S if β ≤ α then return return Si nh VALUE = β PATH = BEST-PATH VALUE = β PATH = BEST-PATH 23 SinhVienZone.com https://fb.com/sinhvienzonevn Any-Player(Position, Depth, α, β): c o m for each S ∈ SUCCESSORS(Position) RESULT = Any-Player(S, Depth + 1, −β, −α) Zo ne NEW-VALUE = − VALUE(RESULT) α = NEW-VALUE en if NEW-VALUE > α, then Vi BEST-PATH = PATH(RESULT) + S if α ≥ β then return return Si nh VALUE = α PATH = BEST-PATH VALUE = α PATH = BEST-PATH 24 SinhVienZone.com https://fb.com/sinhvienzonevn m Additional Refinements Vi en • Using book moves ne • Secondary search Zo • Waiting for quiescence c o • Futility cutoffs Si nh • Not assuming opponent’s optimal move 25 SinhVienZone.com https://fb.com/sinhvienzonevn • Futility cutoffs Vi Zo E < 4? Si nh D en B ne A I J c o m Additional Refinements F G 3.1 C > 3? H 26 SinhVienZone.com https://fb.com/sinhvienzonevn ne c o m Iterative Deepening Iteration Si nh Vi en Zo Iteration Iteration 27 SinhVienZone.com https://fb.com/sinhvienzonevn m Homework 1-7, (Chapter 12 – AI Rich & Knight) Si nh Vi en Zo ne c o Exercises 28 SinhVienZone.com https://fb.com/sinhvienzonevn ... https://fb.com/sinhvienzonevn ne c o Old beliefs m Overview Zo Games provided a structured task in which it was very easy to measure success or failure Si nh Vi en Games did not obviously require large amounts... https://fb.com/sinhvienzonevn m Overview ne c o Chess Zo The average branching factor is around 35 en In an average game, each player might make 50 moves Si nh Vi One would have to examine 35100 positions SinhVienZone.com