Game Programming. Bing-Yu Chen National Taiwan University

Similar documents
Heuristic search, A* CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop. Reading: R&N

Informed search algorithms

Heuris'c search, A* CS171, Fall 2016 Introduc'on to Ar'ficial Intelligence Prof. Alexander Ihler. Reading: R&N

Selectively Breeding Sheep

Kuroda s Identities. We find that Kuroda s Identities can be very useful in making the implementation of Richard s transformations more practicable.

Introduction. Experimental Approach

Cat owners survey Prepared for: Prepared by: Date of issue: Pam Whetnall Project Officer Dog and Cat Management Board

Breeding, paternal behavior, and their interruptionin Betta splendens

Animal. nimals have always provided humans with food, clothing, and transportation, but today they're also

City Unveils New Website

Niche Overlap and Diffuse Competition

April, 2018 vs. April, 2017

Approximating the position of a hidden agent in a graph

Accelerate Your Antibody Discovery with High throughput Array SPR

Machine Learning.! A completely different way to have an. agent acquire the appropriate abilities to solve a particular goal is via machine learning.

ROMÂNIA VETERINARY CHECKS AT THIRD COUNTRY ENTRY POINTS (EP) OF ROMANIA I II III IV V VI VII VIII IX. Veterinary 1774/2002) Authority (CA) * Jimbolia

Propuneri de proiect primite la termenul limită 4 martie Proiecte de mobilitate pentru învățământ superior

Bobcat Unit Study. Created by: Super Mommy To The Rescue

David J. Lewkowicz. Robert Lickliter. New "fork State Institute for Basic Research in Developmental Disabilities

KRUUSE I. Rehabilitation Equipment KRUUSE. Rehabilitation Equipment. 3 rd Edition.

Pet Friendly Shelter Marion County, Florida. Jill Lancon, Animal Center Director

FALL Cat Corner...2 Dog Enrichment...3 We Have Rabbits!...4 How You Can Help...5

2010 Canadian Computing Competition Day 1, Question 1 Barking Dogs!

South Carolina. VETERINARIAN UPDATE SOUTH CAROLINA ASSOCIATION OF VETERINARIANS NEWSLETTER Advancing the Science and Art of Veterinary Medicine

Teach your dog to down

Contents. Introduction...3. Concept Webs: Topic/Main Idea and Details. Charts: Classifying. Sequence Webs: Sequence

KRUUSE I. Rehabilitation Equipment KRUUSE. Rehabilitation Equipment. 4 th Edition.

CAT SWARM OPTIMIZATION FOR SINGLE STAGE SUPPLY CHAIN DISTRIBUTION SYSTEM WITH FIXED CHARGES

RESTORING VETERANS THROUGH COMPANIONSHIP THE STUDY BETWEEN RURAL AND URBAN CONTEXT ARCHITECTURE THESIS JACOB HAACK

Effect of the genealogic line on milk production and prolificacy of the ewes from Synthetic Population Bulgarian Milk

by Jennifer Oxley and Billy Aronson

CHARTING THE LATE CRETACEOUS SEAS: MOSASAUR RICHNESS AND MORPHOLOGICAL DIVERSIFICATION

Solutions with Sika Systems. No more vibration

Winterfest is Back! CONTENTS. Inserted into this bulletin is the City s Popular Annual Financial Report for CONTENTS

Wild About Bears: A Game

Python 3 Turtle graphics. Lecture 24 COMPSCI111/111G SS 2017

Scratch Lesson Plan. Part One: Structure. Part Two: Movement

//////////////////////////////////////////////////////////////////101

Cheetah Math Superstars

Social Change 101. April 14, ASPCA. All Rights Reserved.

2016 UAH Antibiograms

~~~***~~~ A Book For Young Programmers On Scratch. ~~~***~~~

Table of Contents BIG CATS 3 SPORTS 15 AFRICA 51 INSECTS 27 HUMAN BODY 63 TOP FIVE 39 THE OCEAN 75 WEATHER 87

Course: Principles of AFNR. Unit Title: Sheep Selection TEKS: (C)(12)(D) Instructor: Ms. Hutchinson. Objectives:

A-FAVP.1 Foundations of Advanced Veterinary Practice

Vietnam - WSP Global Scaling up Handwashing Behavior Impact Evaluation, Baseline and Endline Surveys

S Fault Indicators. S.T.A.R. Type CR Faulted Circuit Indicator Installation Instructions. Contents PRODUCT INFORMATION

PIGEONETICS LAB PART 1

Games! June Seven Mathematical Games. HtRaMTC Paul Zeitz,

Writing Simple Procedures Drawing a Pentagon Copying a Procedure Commanding PenUp and PenDown Drawing a Broken Line...

Module 2: Beef Cattle. Judging Breeding Heifers

IN THE GENERAL COURT OF JUSTICE SUPERIOR COURT DIVISION FILE NOS. 08 CRS 55147, Defendant.

General Judging Standards & Course Design for UKI

Grosse Pointe Farms Foundation Continues to Enhance Community

Mark Your Calendars for Winterfest!

Sikafloor Solutions for Industrial, Commercial and Public Building Areas

Chapter VII Non-linear SSI analysis of Structure-Isolated footings -soil system

Design of Low Power and High Speed Carry Select Adder Using Brent Kung Adder

Lecture 1: Turtle Graphics. the turtle and the crane and the swallow observe the time of their coming; Jeremiah 8:7

A rapid survey of the herpetological fauna from Vaslui County (Romania) with the first record of the slow-worm (Anguis fragilis) in the region

Winterfest on the Hill

PROBLEM SOLVING JUNIOR CIRCLE 01/09/2011

Think Rabbit. Virtual Manual 2014

Design of High Speed Vedic Multiplier Using Carry Select Adder with Brent Kung Adder

Genetics: Punnett Squares Practice Packet Bio Honors

PYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s

SELECTED ASPECTS OF BURROWING OWL ECOLOGY AND BEHAVIOR

The Agility Coach Notebooks

FOUR PAWS. ROMANIA: OVERVIEW CONDITIONS OF PUBLIC DOG SHELTERS March-May 2014

Alien Life Form (ALF Lab)

Action Plan for North America. Sustainable Trade in Parrots

These small issues are easily addressed by small changes in wording, and should in no way delay publication of this first- rate paper.

4-H Explorer Cavy Project Record Book

INTRODUCTION TO ANIMAL AND VETERINARY SCIENCE CURRICULUM. Unit 1: Animals in Society/Global Perspective

CONNECTION TO LITERATURE

CS108L Computer Science for All Module 7: Algorithms

Differentiated Activities for Teaching Key

Bacteraemia in Maiduguri Metropolis, Nigeria: A 2005 to 2009 study of some causative pathogens and fluoroquinolones activities against them

B Handoko Daeng*, Analis Wisnu Wardhana**, Aris Widodo***, Hidayat Sujuti***, Karyono Mintaroem***, Edi Widjajanto***

Genetics and Probability

Another major risk is in cutting their hair at an early age because then your Pom pup will never grow their full adult coat.

Different versions of a single gene are called allleles, and one can be dominant over the other(s).

Fast Tracking to Save Lives: Simple to Systematic ASPCA. All Rights Reserved.

Mosquitoes: Infect all of the humans by sucking all of their available blood.

Graphics libraries, PCS Symbols, Animations and Clicker 5

Intestinal Apicomplexans

Inverter Multi Split System

Pedigrees: Understanding Retriever Pedigrees Part I

9-2 Probability and Punnett. Squares Probability and Punnett Squares. Slide 1 of 21. Copyright Pearson Prentice Hall

Event Kit. When Storytime is Playtime! New from #1 New York Times Bestseller Matthew Van Fleet

UKI Judging Review . Judging experience (Please include UKI, AKC, USDAA, CPE or other)

INTRODUCTORY ANIMAL SCIENCE

T a. Ruddy. Fawn. Abyssinian

Jumpers Judges Guide

Text Features: 24 Task Cards

of Entomology, University of California, Riverside, Riverside, CA 92521, USA of Hertfordshire, Hertfortshire AL109AB, United Kingdom

The Agility Coach Notebooks

MANAGING AVIARY SYSTEMS TO ACHIEVE OPTIMAL RESULTS. TOPICS:

LIFE HISTORY OF PLESIONIKA EDWARDSI (CRUSTACEA, DECAPODA, PANDALIDAE) AROUND THE CANARY ISLANDS, EASTERN CENTRAL ATLANTIC

Phylogeny Reconstruction

Transcription:

Game Programmig Big-Yu Che Natioal Taiwa Uiversity

Search o Blid search Breadth-First Search Depth-First Search o Heuristic search A* o Adversary search MiMax 2

Itroductio to Search o o Usig tree diagram (usually) to describe a search problem Search starts o Goal o Node i Goal ode g Successors o c 1, c 2, c 3 Depth o d = 0, 1, 2, Search problem Iput o o Descriptio of the iitial ad goal odes A procedure that produces the successors of a arbitrary ode Output o A legal sequece of odes startig with the iitial ode ad edig with the goal ode. i c 1 c 2 c 3 d = 1 g d = 2 d = 3 d = 4 3

Search Examples i Traditioal AI o Game playig Chess Backgammo o Fidig a path to goal The towers of Haoi Slidig tile puzzles o 8 puzzles o Simply fidig a goal -quees 4

Search Algorithm 1. Set L to be a list of the iitial odes. At ay give poit i time, L is a list of odes that have ot yet bee examied. 2. If L is empty, failed. Otherwise, pick a ode from L. 3. If is the goal ode, stop ad retur it ad the path from the iitial ode to. 4. Otherwise, remove from L ad add to L all of s childre, labelig each with its path from the iitial ode. 5. Retur to Step 2. 5

Depth-First Search o Always explorig the child of the most recetly expaded ode o Termial odes beig examied from left to right o If the ode has o childre, the procedure backs up a miimum amout before choosig aother ode to examie. 4 3 1 2 8 9 5 6 7 10 g 11 d = 1 d = 2 d = 3 d = 4 6

Depth-First Search o We stop the search whe we select the goal ode g. o Depth-first search ca be implemeted by pushig the childre of a give ode oto the frot of the list L i Step 4. of Search Algorithm. o Ad always choosig the first ode o L as the oe to expad. 7

Depth-First Search Algorithm 1. Set L to be a list of the iitial odes. 2. If L is empty, failed. Otherwise, pick a ode from L. 3. If is the goal ode, stop ad retur it ad the path from the iitial ode to. 4. Otherwise, remove from L ad add to the frot of L all of s childre, labelig each with its path from the iitial ode. 5. Retur to Step 2. 8

Breadth-First Search o The tree examied from top to dow, so every ode at depth d is examied before ay ode at depth d + 1. o We ca implemet breadth-first search by addig the ew odes to the ed of the 5 list L. 1 2 3 4 6 7 8 d = 1 d = 2 d = 3 9 10 11 g 12 d = 4 9

Breadth-First Search Algorithm 1. Set L to be a list of the iitial odes. 2. If L is empty, failed. Otherwise, pick a ode from L. 3. If is the goal ode, stop ad retur it ad the path from the iitial ode to. 4. Otherwise, remove from L ad add to the ed of L all of s childre, labelig each with its path from the iitial ode. 5. Retur to Step 2. 10

Heuristic Search o Neither depth-first or breadth-first search o Explorig the tree i aythig resemblig a optimal order. o Miimizig the cost to solve the problem. 1 3 2 d = 1 d = 2 d = 3 4 g d = 4 11

Heuristic Search o Whe we pickig a ode from the list L i Step 2. of Search Algorithm, what we will do is to remove steadily from the root ode toward the goal by always selectig a ode that is as close to the goal as possible. Estimated by distace ad miimizig the cost? o A*! 12

Adversary Search o Assumptios Two-perso games i which the players alterate moves. They are games of perfect iformatio, where the kowledge available to each player is the same. o Examples : Tic-tac-toe Checkers Chess Go Othello Backgammo o Imperfect iformatio Pokers Bridge 13

MiMax a max ply Nodes with the maximizer to move are square; odes with the miimizer to move are circles -1 e b c d f 1 g -1 h i -1 j k 1 l m o 1-1 1 1 mi max mi max mi Maximizer to achieve the Outcome of 1; miimizer to Achieve the outcome of -1 p q r -1 1-1 14

MiMax a 1 max -1 b c 1 d -1 mi -1-1 e f g 1 1 1 h i -1 j k 1 l m o 1-1 1 1 max mi max mi The maximizer wis! p q r -1 1-1 15

MiMax Idea 1. Expad the etire tree below. 2. Evaluate the termial odes as wis for the miimizer or maximizer. 3. Select a ulabelled ode all of whose childre have bee assiged values. If there is o such ode, retur the value assiged to the ode. 4. If the selected ode is oe at which the miimizer moves, assig it a value that is the miimum of the values of its childre. If it is a maximizig ode, assig it a value that is the maximum of the childre s values. Retur to Step 3. 16

MiMax Algorithm 1. Set L = { }, the uexpaded odes i the tree. 2. Let x be the 1st ode o L. If x = ad there is a value assiged to it, retur this value. 3. If x has bee assiged a value v x, let p be the paret of x ad v p the value curretly assiged to p. If p is a miimizig ode, set v p = mi(v p, v x ). If p is a maximizig ode, set v p = max(v p, v x ). Remove x from L ad retur to Step 2. 4. If x has ot bee assiged a value ad is a termial ode, assig it the value 1 or -1 depedig o whether it is a wi for the maximizer or miimizer respectively. Assig x the value 0 if the positio is a draw. Leave x o L ad retur to Step 2. 5. Otherwise, set v x to be if x is a maximizig ode ad + if x is a miimizig ode. Add the childre of x to the frot of L ad retur to Step 2. 17

MiMax o Some issues Draw Estimated value e() o e() = 1 : the ode is a wi for maximizer o e() = -1 : the ode is a wi for miimizer o e() = 0 : that is a draw o e() = -1 ~ 1 : the others Whe to decide stop the tree expadig further? 18

MiMax Algorithm 1. Set L = { }, the uexpaded odes i the tree. 2. Let x be the 1st ode o L. If x = ad there is a value assiged to it, retur this value. 3. If x has bee assiged a value v x, let p be the paret of x ad v p the value curretly assiged to p. If p is a miimizig ode, set v p = mi(v p, v x ). If p is a maximizig ode, set v p = max(v p, v x ). Remove x from L ad retur to Step 2. 4. If x has ot bee assiged a value ad is a termial ode, assig it the value 1 or -1 depedig o whether it is a wi for the maximizer or miimizer respectively. Assig x the value 0 if the positio is a draw. Leave x o L ad retur to Step 2. 5. Otherwise, set v x to be if x is a maximizig ode ad + if x is a miimizig ode. Add the childre of x to the frot of L ad retur to Step 2. 19

MiMax Algorithm (fial) 1. Set L = { }, the uexpaded odes i the tree. 2. Let x be the 1st ode o L. If x = ad there is a value assiged to it, retur this value. 3. If x has bee assiged a value v x, let p be the paret of x ad v p the value curretly assiged to p. If p is a miimizig ode, set v p = mi(v p, v x ). If p is a maximizig ode, set v p = max(v p, v x ). Remove x from L ad retur to Step 2. 4. If x has ot bee assiged a value ad either x is a termial ode or we have decided ot to expad the tree further, compute its value usig the evaluatio fuctio. Leave x o L ad retur to Step 2. 5. Otherwise, set v x to be if x is a maximizig ode ad + if x is a miimizig ode. Add the childre of x to the frot of L ad retur to Step 2. 20

Itroductio to Path Fidig o A commo situatio of game AI o Path plaig From start positio to the goal o Most popular techique A* (A Star) o 1968 o A search algorithm o Favorite teachig example : 15-pizzule o Algorithm that searches i a state space for the least costly path from start state to a goal state by examiig the eighborig states 21

Dijkstra vs. A* Without obstacle With obstacle Dijkstra A* 22

Dijkstra vs. A* o Dijkstra: compute the optimal solutio o Diskstra: search space much larger tha A* o A*: simple o A*: fast o A*: good result o A*: employ heuristic estimate to elimiate may paths with high costs -> speedup process to compute satisfactory shortest paths 23

A*: cost fuctios o Goal: compute a path from a start poit S to a goal poit G o Cost at poit : f() = g() + h() o g(): distace from the start poit S to the curret poit o h(): estimated distace from the curret poit to the goal poit G o f(): curret estimated cost for poit 24

A*: cost fuctios o o o o o o o The role of h() A major cost evaluatio fuctio of A* Guide the performace of A* d(): the actual distace betwee S ad G h() = 0 : A* is equivalet to Dijkstra algorithm h() <= d () : guaratee to compute the shortest path; the lower the value h(), the more ode A* expads h() = d () : follow the best path; ever expad aythig else; difficult to compute h() i this way! h() > d() : ot guaratee to compute a best path; but very fast h() >> g() : h() domiates -> A* becomes the Best First Search 25

A* Algorithm o Add START to OPEN list o while OPEN ot empty o get ode from OPEN that has the lowest f() o if is GOAL the retur path o move to CLOSED o for each ' = CaMove(, directio) o g(') = g() + 1 o calculate h(') o if ' i OPEN list ad ew ' is ot better, cotiue o if ' i CLOSED list ad ew ' is ot better, cotiue o remove ay ' from OPEN ad CLOSED o add as 's paret o add ' to OPEN o ed for o ed while o if we get to here, the there is No Solutio 26

Example Straight-lie distace to Bucharest Arad 366 Oradea Bucharest 0 71 Neamt Craiova 160 Dobreta 242 Zerid 87 Eforie 161 151 Fagaras 178 Iasi Arad Giurgiu 77 Hirsova 151 140 Sibiu 92 Fagaras 118 99 Iasi 226 80 Vaslui Lugoj 244 Rimicu Vilcea Mehadia 241 Neamt 234 Timisoara 111 97 211 142 Lugoj Pitesti Oradea 380 70 Hirsova Pitesti 98 146 98 Mehadia 85 Rimicu Vilcea 193 101 Urzicei Sibiu 253 138 86 Bucharest Timisoara 329 Dobreta 90 Urzicei 80 120 Craiova Eforie Vaslui 199 Giurgiu Zerid 374 30

A* Example Straight-lie distace to Bucharest Oradea 71 Neamt Zerid 87 151 Iasi Arad 0+366 140 Sibiu 92 Fagaras 118 99 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 Lugoj Pitesti 70 Hirsova 146 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 31

A* Example Straight-lie distace to Bucharest Oradea 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 140 Sibiu 92 Fagaras 118 99 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 32

A* Example Straight-lie distace to Bucharest Oradea 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 140 Sibiu 92 Fagaras 118 99 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 33

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 80 Vaslui 220+193 Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 34

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 80 Vaslui 220+193 Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 35

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 36

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 90 120 Craiova Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 37

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 450+0 90 120 Craiova Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 38

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 450+0 90 120 Craiova Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 39

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 450+0 90 120 Craiova 418+0 Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 40

A* Example Straight-lie distace to Bucharest Oradea 291+380 71 Neamt +374 Zerid 87 151 Iasi Arad 140+253 0+366 Sibiu 239+176 140 92 Fagaras 118 99 220+193 80 Vaslui Rimicu Vilcea Timisoara 111 97 211 142 118+329 Lugoj Pitesti 70 Hirsova 146 317+100 98 Mehadia 85 101 Urzicei 138 86 Bucharest Dobreta 450+0 90 120 Craiova 418+0 Eforie 366+160 Giurgiu Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimicu Vilcea 193 Sibiu 253 Timisoara 329 Urzicei 80 Vaslui 199 Zerid 374 41

A* Algorithm o State Locatio Neighborig states o Search space Related to terrai format Grids Triagles or Covex Polygos Poits of Visibility o Cost estimate o Path Typical A* path Straight path Smooth path o Hierarchical path fidig 42

Search Space & Neighborig States o Rectagular Grid Use grid ceter o Quadtree Use grid ceter o Triagles or Covex Polygos Use edge midpoit Use triagle ceter Triagles Rectagular Grid Quadtree 43

Search Space & Neighborig States o Poits of Visibility (POV) o Geeralized cyliders Use itersectios Poits of Visibility Geeralized Cyliders 44

Cost Estimate o Cost fuctio CostFromStart CostToGoal o Miimum cost Distace traveled Time of traveled Movemet poits expeded Fuel cosumed Pealties for passig through udesired area Bouses for passig through desired area o Estimate To goal distace 45

Result Path Typical A* Path Straight Path Smooth Path (Catmull-Rom Splie) 46

Hierarchical Path Fidig o Break the terrai for path fidig to several oes hierarchically Room-to-Room 3D layered terrai Terrai LOD o Pros Speedup the search Solve the problem of layered path fidig 48

Path Fidig Challeges o Movig Goal Do you eed to fid path each frame? o Movig Obstacles Predictio Scheme o Complexity of the Terrai Hierarchical path fidig o Good Path 49