1. Trang chủ
  2. » Cao đẳng - Đại học

Trí tuệ nhân tạo chapter8 game playing

28 10 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 28
Dung lượng 118,96 KB

Nội dung

Game Playing Chapter CuuDuongThanCong.com https://fb.com/tailieudientucntt Outline • • • • • Overview Minimax search Adding alpha-beta cutoffs Additional refinements Iterative deepening CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview Old beliefs Games provided a structured task in which it was very easy to measure success or failure Games did not obviously require large amounts of knowledge, thought to be solvable by straightforward search CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview Chess The average branching factor is around 35 In an average game, each player might make 50 moves One would have to examine 35100 positions CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • Improve the generate procedure so that only good moves are generated CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • Improve the generate procedure so that only good moves are generated plausible-moves vs legal-moves CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • Improve the test procedure so that the best moves will be recognized and explored first CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • Improve the test procedure so that the best moves will be recognized and explored first less moves to be evaluated CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • It is not usually possible to search until a goal state is found • It has to evaluate individual board positions by estimating how likely they are to lead to a win Static evaluation function • Credit assignment problem (Minsky, 1963) CuuDuongThanCong.com https://fb.com/tailieudientucntt Overview • Good plausible-move generator • Good static evaluation function 10 CuuDuongThanCong.com https://fb.com/tailieudientucntt Minimax Search Opponent(Position, Depth): for each S ∈ SUCCESSORS(Position) RESULT = Player(S, Depth + 1) NEW-VALUE = PLAYER-VALUE(RESULT) if NEW-VALUE < MIN-SCORE, then MIN-SCORE = NEW-VALUE return BEST-PATH = PATH(RESULT) + S VALUE = MIN-SCORE PATH = BEST-PATH 14 CuuDuongThanCong.com https://fb.com/tailieudientucntt Minimax Search Any-Player(Position, Depth): for each S ∈ SUCCESSORS(Position) RESULT = Any-Player(S, Depth + 1) NEW-VALUE = − VALUE(RESULT) if NEW-VALUE > BEST-SCORE, then BEST-SCORE = NEW-VALUE return BEST-PATH = PATH(RESULT) + S VALUE = BEST-SCORE PATH = BEST-PATH 15 CuuDuongThanCong.com https://fb.com/tailieudientucntt Minimax Search MINIMAX(Position, Depth, Player): • MOVE-GEN(Position, Player) • STATIC(Position, Player) • DEEP-ENOUGH(Position, Depth) 16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Minimax Search if DEEP-ENOUGH(Position, Depth), then return: VALUE = STATIC(Position, Player) PATH = nil SUCCESSORS = MOVE-GEN(Position, Player) if SUCCESSORS is empty, then as in Step 17 CuuDuongThanCong.com https://fb.com/tailieudientucntt Minimax Search if SUCCESSORS is not empty: RESULT-SUCC = MINIMAX(SUCC, Depth+1, Opp(Player)) NEW-VALUE = - VALUE(RESULT-SUCC) if NEW-VALUE > BEST-SCORE, then: BEST-SCORE = NEW-VALUE BEST-PATH = PATH(RESULT-SUCC) + SUCC Return: VALUE = BEST-SCORE PATH = BEST-PATH 18 CuuDuongThanCong.com https://fb.com/tailieudientucntt Adding Alpha-Beta Cutoffs • At the player choice, maximize the static evaluation of the next position > α threshold • At the opponent choice, minimize the static evaluation of the next position < β threshold 19 CuuDuongThanCong.com https://fb.com/tailieudientucntt Adding Alpha-Beta Cutoffs A B D E < 4? I β cutoff J C > 3? F G α cutoff H Maximizing ply Player Minimizing ply Opponent Maximizing ply Player Minimizing ply Opponent 20 CuuDuongThanCong.com https://fb.com/tailieudientucntt Adding Alpha-Beta Cutoffs A C > α? B α D β E < β? I v≥β β cutoff J F G H v≤α α cutoff Maximizing ply Player Minimizing ply Opponent Maximizing ply Player Minimizing ply Opponent 21 CuuDuongThanCong.com https://fb.com/tailieudientucntt Player(Position, Depth, α, β): for each S ∈ SUCCESSORS(Position) RESULT = Opponent(S, Depth + 1, α, β) NEW-VALUE = PLAYER-VALUE(RESULT) if NEW-VALUE > α, then α = NEW-VALUE BEST-PATH = PATH(RESULT) + S if α ≥ β then return VALUE = α return PATH = BEST-PATH VALUE = α PATH = BEST-PATH 22 CuuDuongThanCong.com https://fb.com/tailieudientucntt Opponent(Position, Depth, α, β): for each S ∈ SUCCESSORS(Position) RESULT = Player(S, Depth + 1, α, β) NEW-VALUE = PLAYER-VALUE(RESULT) if NEW-VALUE < β, then β = NEW-VALUE BEST-PATH = PATH(RESULT) + S if β ≤ α then return VALUE = β return PATH = BEST-PATH VALUE = β PATH = BEST-PATH 23 CuuDuongThanCong.com https://fb.com/tailieudientucntt Any-Player(Position, Depth, α, β): for each S ∈ SUCCESSORS(Position) RESULT = Any-Player(S, Depth + 1, −β, −α) NEW-VALUE = − VALUE(RESULT) if NEW-VALUE > α, then α = NEW-VALUE BEST-PATH = PATH(RESULT) + S if α ≥ β then return VALUE = α return PATH = BEST-PATH VALUE = α PATH = BEST-PATH 24 CuuDuongThanCong.com https://fb.com/tailieudientucntt Additional Refinements • Futility cutoffs • Waiting for quiescence • Secondary search • Using book moves • Not assuming opponent’s optimal move 25 CuuDuongThanCong.com https://fb.com/tailieudientucntt Additional Refinements • Futility cutoffs A B D E < 4? I J C > 3? F G 3.1 H 26 CuuDuongThanCong.com https://fb.com/tailieudientucntt Iterative Deepening Iteration Iteration Iteration 27 CuuDuongThanCong.com https://fb.com/tailieudientucntt Homework Exercises 1-7, (Chapter 12 – AI Rich & Knight) 28 CuuDuongThanCong.com https://fb.com/tailieudientucntt ... https://fb.com/tailieudientucntt Overview Old beliefs Games provided a structured task in which it was very easy to measure success or failure Games did not obviously require large amounts of knowledge,... https://fb.com/tailieudientucntt Overview Chess The average branching factor is around 35 In an average game, each player might make 50 moves One would have to examine 35100 positions CuuDuongThanCong.com

Ngày đăng: 15/12/2021, 16:37

TỪ KHÓA LIÊN QUAN

w