1 CO2301 - Games Development 1 Week 11 Search Methods Gareth Bellaby.

Slides:



Advertisements
Similar presentations
Algorithm Design Techniques
Advertisements

AI Pathfinding Representing the Search Space
State Space Representation and Search
Part2 AI as Representation and Search
Branch & Bound Algorithms
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
1 Tree Searching Strategies Updated: 2010/12/27. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these.
CSE 380 – Computer Game Programming Pathfinding AI
CSC 423 ARTIFICIAL INTELLIGENCE
Graphs Graphs are the most general data structures we will study in this course. A graph is a more general version of connected nodes than the tree. Both.
1 Pertemuan 2 PROBLEMS, PROBLEM SPACES, AND SEARCH Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1/0.
Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Problem abstraction and symbolic.
Artificial Intelligence Lecture
Problem Solving and Search in AI Part I Search and Intelligence Search is one of the most powerful approaches to problem solving in AI Search is a universal.
State-Space Searches. State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Graphs. Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
AI – Week 8 AI + 2 Player Games Lee McCluskey, room 3/10
Using Search in Problem Solving
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Chapter 5.4 Artificial Intelligence: Pathfinding.
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
State-Space Searches.
Recursively Defined Sequences Lecture 35 Section 8.1 Wed, Mar 23, 2005.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
Chapter 5.4 Artificial Intelligence: Pathfinding.
1 Game AI Path Finding. A Common Situation of Game AI A Common Situation of Game AI Path Planning Path Planning –From a start position to a destination.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Artificial Intelligence LECTURE 3 ARTIFICIAL INTELLIGENCE LECTURES BY ENGR. QAZI ZIA 1.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
Computer Go : A Go player Rohit Gurjar CS365 Project Proposal, IIT Kanpur Guided By – Prof. Amitabha Mukerjee.
Lecture 6: Problem Solving Dr John Levine Algorithms and Complexity February 10th 2006.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Problems, Problem Spaces and Search
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Graphs. 2 Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Search exploring the consequences of possible actions.
Search exploring the consequences of possible actions.
Lecture 3: Uninformed Search
Outline Intro to Representation and Heuristic Search Machine Learning (Clustering) and My Research.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Solving Kriegspiel endings with brute force: the case of KR vs. K Paolo Ciancarini Gian Piero Favini University of Bologna.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
1 CO Games Development 1 Week 13 - Revision Lecture AI Revision Gareth Bellaby.
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Introduction to State Space Search
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
1 CO Games Development 1 Week 8 A* Gareth Bellaby.
State space search Represented by a four-tuple [N,A,S,GD], where: N is the problem space A is the set of arcs (or links) between nodes. These correspond.
CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play.
Recursively Defined Sequences Lecture 40 Section 8.1 Wed, Apr 11, 2007.
Aumm-e-hani munir Maria umer Rakhshanda batool Faiza.
Tower of Hanoi problem: Move the pile of rings from one peg to another
Knowledge Representation
Constraint Satisfaction Problems vs. Finite State Problems
Tower of Hanoi problem: Move the pile of rings from one peg to another
CSE (c) S. Tanimoto, 2001 Search-Introduction
Haskell Tips You can turn any function that takes two inputs into an infix operator: mod 7 3 is the same as 7 `mod` 3 takeWhile returns all initial.
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Knowledge Representation
CSE (c) S. Tanimoto, 2002 State-Space Search
State-Space Searches.
Graphs.
State-Space Searches.
CSE (c) S. Tanimoto, 2004 State-Space Search
Tower of Hanoi problem: Move the pile of rings from one peg to another
Recursively Defined Sequences
State-Space Searches.
Presentation transcript:

1 CO Games Development 1 Week 11 Search Methods Gareth Bellaby

2 Topics Search Methods in Traditional Games - Tower of Hanoi example Combinatorial Explosion Chess

3 Search Methods in Traditional Games - Tower of Hanoi example

4 Traditional Games The approach described in this lecture is not one that is used much within computer games. Useful for games such as Chess. I've called these "traditional" games for want of a better phrase. The approach may be applicable to certain problems in modern computer games.

5 Towers of Hanoi (1) A simple game played with three pegs and a pile of disks of different sizes. The pegs are stacked on a peg in order of size. The object is to stack the disks onto a new peg. Only one disk may be moved at a time. A disk can never be placed on top of a smaller disk.

6 Towers of Hanoi (2)

7 Lists The disks can be represented as numbers: the small disk is 1 the medium sized disk is 2 the large disk is 3. This will allow us to easily describe the rule about "A disk can never be placed on top of a smaller disk". A useful (and common) representation of a problem is the list structure. A empty list is given by: []

8 Lists The disks on a single peg can be represented as a list. One common convention is to use square brackets for a list. The elements of the list are separated by commands. A peg with the small disk on top, the medium sized disk in the middle and the large disk on the bottom would therefore be: [1, 2, 3] The state of all three pegs would be represented by a list of lists: [ [2,3], [1], [ ] ]

9 Towers of Hanoi (4) [1,2,3][ ][ ] / \ [2,3][1][ ][2,3][ ][1] | [3][1][2] [3][2][1]

10 Towers of Hanoi (5) [1,2,3][ ][ ] / \ [2,3][1][ ][2,3][ ][1] | | [3][1][2][3][2][1] | | [3][ ][1,2][3][1,2][ ] | | [ ][3][1,2][ ][1,2][3] | | [1][3][2][1][2][3] | [1][2,3][ ][1][ ][2,3] | | [ ][1,2,3][ ][ ][ ][1,2,3]

11 Search trees

12 Searches Search is a basic problem-solving technique. Grow a tree from the start position to the goal.

13 Trees Again... The Tower of Hanoi problem can be represented as a set of states. A new state is generated by applying a rule. The states form a tree structure. A route through the tree to a goal state represents a solution. Search is a basic problem-solving technique.

14 Search Trees A tree is: A representation of a problem A way to solve the problem using a search technique, e.g. breadth-first search, best-first search, etc.

15 Conceptional Search & Pathfinding Pathfinding searches a map. The map is just a representation. A Conceptional Search searches a problem space. The space is just a representation of states within the problem. Dijkstra's algorithm uses a graph. In other algorithms the nodes, linked together, can form a tree-like structure.

16 Rules Rules are used to generate new nodes. For example, in the pathfinding exercise you used a grid and rules to move north, south, east and west. For the Towers of Hanoi a good representation of the problem state is: [1,2,3][ ][ ] A rule would be "Can only remove the topmost disk" and, in this representation, this would be the leftmost number in the list.

17 Search A state space (or problem space) represents a problem. Indeed the full tree represents the whole of the problem in every possible permutation. A state space is a graph whose nodes correspond to problem situations. A given problem is a path in this graph.

18 Search Tree (Graph) The nodes, linked together, form a tree-like structure. The whole tree is described as the search state (or problem state) Lots of generate and search techniques have been developed.

19 Search Tree (Graph) Nodes correspond to situations, e.g. a node represents a move, or position, in a game. A link (or arc) between nodes represents a legitimate move, or action, according to the rules.

20 Search Tree (Graph) A specific problem is defined by: state space start node (root node) goal condition (may be more than one node)

21 Evaluation Function The Tower of Hanoi problem was represented using lists. Lists are a commonly used technique in AI for representing a problem state. Another common technique is to describe a problem using a number. A number is an evaluation of a state, e.g. a node (a move or position) in a game. Numbers are useful because they mean that states can be compared with one another.

22 Combinatorial Explosion

23 Combinatorial Explosion Combinatorial Explosion: A rapid increase in the amount of possible outcomes due to the large number of combinations. Towers of Hanoi is a simple problem, but most problems are far more complex. A directed search is used to overcome the problem of combinatorial explosion. A heuristic is used to guide the search and hopefully remove the need to evaluate every possible permutation of the problem.

24 Travelling Salesman (1) An example of combinatorial explosion. Plan the quickest route for a salesman visiting different cities. Initially appears a simple problem.

25 Travelling Salesman (2) nottingham leicester derby

26 Travelling Salesman (3) nottingham leicester derby sheffield

27 Chess

28 Chess Consider chess. How would you: Build a chess game? Represent a move? What are the rules? Create an evaluation function? Wwhat are the characteristics of the game of chess? The same approach as solving the Tower of Hanoi problem Each node of the tree represents one move (or position) in the game Each layer of the tree is all of the moves either Black or White could take that turn

29 Chess and Combinatorial Explosion Average number of moves in a single turn of chess is 35. The number of moves in an average game is around 50 for each player. Therefore, full evaluation of a game requires moves

30 Heuristics Heuristics can be used to guide search. non-heuristic: blind search heuristic: directed search Chess heuristic: put pawns into the center squares. Employ a search algorithm.

31 Chess 2-player game Perfect information Certain outcomes, e.g. success and failure clearly defined for the game and for a move. What about computer games?

32 Computer Games n-player games. This does not mean that there are necessarily lots of people playing the game but that lots of units or NPCs are moving at the same time (contrast to one piece moving in Chess or Draughts). Imperfect information - outcomes are unpredicatable. Success and failure may not be clearly defined for the game or an instance within the game (The player has cleared an area of enemies but how much life and ammo has been lost?).