0% found this document useful (0 votes)
4 views13 pages

UNIT 7 Game Playing Overview and Example Domain

The document provides an overview of game playing in AI, focusing on the Blocks World as a classic planning problem and the components of a planning system. It discusses various planning techniques, including hierarchical planning, nonlinear planning, and reactive systems, highlighting their importance in AI for intelligent decision-making and handling complex environments. Additionally, it outlines the roles of goal states, action generators, and evaluation functions in game AI, along with examples and advantages of each planning approach.

Uploaded by

bushrapatel9704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

UNIT 7 Game Playing Overview and Example Domain

The document provides an overview of game playing in AI, focusing on the Blocks World as a classic planning problem and the components of a planning system. It discusses various planning techniques, including hierarchical planning, nonlinear planning, and reactive systems, highlighting their importance in AI for intelligent decision-making and handling complex environments. Additionally, it outlines the roles of goal states, action generators, and evaluation functions in game AI, along with examples and advantages of each planning approach.

Uploaded by

bushrapatel9704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Unit 7: Game Playing: Overview

Topic: The Blocks World in AI (e.g. game of 3 glass, in


which has ball)

The Blocks World is a classic planning problem in artificial intelligence. It


provides a simple and intuitive domain to test and demonstrate various planning
techniques.

Scenario

 The world consists of:


o A table
o A set of blocks (usually labeled A, B, C, etc.)
o A robot arm that can manipulate the blocks
 Each block can either be on the table, on another block, or held by the
robot arm.

Typical Assumptions

 Only one block can be moved at a time.


 A block can only be moved if there is nothing on top of it.
 The robot arm can hold only one block at a time.
 Blocks can be stacked or placed on the table.

Initial State & Goal State

 The problem is defined by:


o An initial state: the current arrangement of the blocks
o A goal state: the desired arrangement
 The planner must find a sequence of actions to reach the goal from the
initial state.

Actions (Operators)

Each action has preconditions and effects:

1. Pickup(block)
o Preconditions: block is clear, block is on the table, arm is empty
o Effects: block is held; block is no longer on table
2. Putdown(block)
o Preconditions: arm is holding block
o Effects: block is on table, block is clear, arm is empty
3. Stack (block1, block2)
o Preconditions: block1 is held, block2 is clear
o Effects: block1 is on block2, block1 is clear, arm is empty
4. Unstack (block1, block2)
o Preconditions: block1 is on block2, block1 is clear, arm is empty
o Effects: block1 is held, block2 is clear

Why It’s Important

 Simple to understand but reveals complex planning issues like:


o Sub goal interactions (e.g., achieving one goal undoes another)
o Nonlinear planning (not all steps must be in strict sequence)
o Goal ordering (figuring out the best order to achieve goals)
o State representation and action preconditions/effects

Use in AI

 Used in:
o STRIPS (Stanford Research Institute Problem Solver) planning
systems
o Goal Stack Planning
o Hierarchical Task Networks (HTN)
o Partial-order planners
 Serves as a benchmark for comparing planning algorithms.

Example Problem

Initial State:

 A is on B
 B is on the table
 C is on the table
 Arm is empty

Goal State:

 C is on A
 A is on B
 B is on the table

So, answer: A planner would have to:

1. Unstack A from B
2. Put A on the table
3. Stack C on A

Topic: components of planning system in game playing in


ai (e.g. level type any game)
1. State Representation

 Describes the current configuration of the game.


 Includes:
o Positions of pieces (in chess, tic-tac-toe, etc.)
o Whose turn it is
o Any relevant game-specific data (score, remaining time, etc.)
 Important for evaluating future actions.

2. Action Generator (Move Generator)

 Lists all legal moves (actions) available from the current state.
 Must obey the rules of the game.
 Example: In chess, this would generate all possible valid moves for a
player.

3. Transition Model (Successor Function)

 Defines how the state changes when an action is performed.


 Applies a move and returns the resulting new game state.
 Essential for simulating future moves (used in MiniMax, etc.).

4. Goal Test / Terminal State Checker

 Determines whether the game has reached a winning, losing, or draw


condition.
 Helps stop the search at terminal nodes in the game tree.

5. Evaluation Function (Heuristic Function)

 Estimates how desirable a non-terminal state is.


 Used when it's impractical to search all the way to the end of the game.
 Example:
o In chess: material balance + positional advantages
o In tic-tac-toe: number of winning lines open

6. Search/Planning Algorithm
 Chooses the best move by searching through future states.
 Examples:
o MiniMax
o Alpha-Beta pruning
o Monte Carlo Tree Search
o Iterative Deepening
 Tries to maximize the player’s advantage while minimizing the
opponent’s.

7. Time Management (Optional but Important)

 Especially in real-time games or games with a time limit.


 Allocates time for move computation using:
o Iterative deepening
o Time-based cutoffs
o Adaptive depth search

8. Memory / Transposition Table (Optional Enhancement)

 Stores previously visited states to avoid re-evaluation.


 Speeds up search by recognizing duplicate states (e.g., in chess, many
move sequences can result in the same board).

Summary Table:
Topic: Goal State in Planning (AI)
What is a Goal State?

 A goal state is the desired outcome or configuration that an AI agent


aims to achieve.
 It represents the end condition of a successful plan.

In Simple Terms:

The goal state is like the finish line in a race — it's where you want to end up.

Example 1: Blocks World

 Initial State: A is on B, B is on the table, C is on the table


 Goal State: C is on A, A is on B, B is on the table

Here, the planner must find a series of actions to transform the initial state into
the goal state.

Example 2: Game Playing (like Chess)

 Goal State for a player could be:


o Checkmating the opponent (in chess)
o Aligning 3 Xs or Os (in tic-tac-toe)
o Reaching a specific score or condition

Types of Goal States

1. Explicit Goal State


o Clearly defined final arrangement.
o Example: "Block A must be on Block B."
2. Partial Goal State
o Only some parts of the world need to be in a specific configuration.
o Example: "Block A must be on the table" (no mention of other
blocks).
3. Goal Test (Function)
o A Boolean function that returns true if the current state satisfies
the goal.
o Example: is goal(state) → returns True if checkmate is achieved.
Importance in Planning

Planning in game playing is a fundamental aspect of Artificial Intelligence


(AI) because it enables an agent (like a player or computer-controlled
character) to make intelligent decisions over time.

Planning in AI game playing is crucial for:

 Intelligent decision-making,
 Long-term strategy,
 Handling complex, dynamic environments,
 Creating believable and capable opponents.

How AI Uses Goal States

 In search algorithms: used to stop the search when the goal is reached.
 In heuristics: used to measure how "far" a current state is from the goal.
 In constraint satisfaction: used to define what conditions must hold.

Topic: nonlinear planning using constraints


posting in ai
What is Nonlinear Planning?

 Nonlinear Planning (also called partial-order planning) allows actions


to be partially ordered, not strictly sequential.
 It enables the planner to identify independent actions that can happen in
any order or even in parallel.
 Based on the principle of least commitment: don’t decide the order of
actions unless absolutely necessary.

What is Constraint Posting?

 In constraint-based planning, the planner posts constraints instead of


generating full action sequences.
 Constraints define relationships between actions:
o Ordering constraints (A before B)
o Causal links (A produces a condition required by B)
o Threats (some action may interfere with a causal link)
Core Concepts
Term Description
Action Has preconditions and effects
Causal Link A →p→ B (Action A provides p, which B needs)
Ordering
A < B (A must happen before B)
Constraint
An action C might destroy the condition p between A and
Threat
B
Threat Resolution Handle threats by promotion or demotion

Planning Process (Partial-Order Planning with Constraint Posting)

1. Initialize Plan:
o Add a Start and Finish action.
o Start: has initial conditions
o Finish: has goal conditions
2. Identify Open Preconditions:
o Preconditions of actions that are not yet supported.
3. Post Causal Links:
o Choose an action that achieves the precondition.
o Create a causal link: Achiever →p→ Needer
4. Add Ordering Constraints:
o Ensure the achiever happens before the needer.
5. Check for Threats:
o If any action might delete p between A and B, resolve it:
 Promotion: place the threat after B
 Demotion: place the threat before A
6. Repeat until:
o All preconditions are satisfied
o No threats remain
o The plan is consistent and complete

Example (Simplified)

Goal: Stack A on B, B on C

Steps:

 Add actions:
o Stack(A, B)
o Stack(B, C)
 Post causal links:
o Clear(B) → Stack(A, B)
o Clear(C) → Stack(B, C)
 Add ordering constraints based on dependencies.
 Check for any actions that interfere with these links and resolve.

Advantages

 Flexibility: Only imposes necessary ordering.


 Parallelism: Actions that don’t interfere can be performed in parallel.
 Scalability: More efficient for large and complex domains.
 Modularity: Easy to modify by adding or adjusting constraints.

Used In

 POP (Partial Order Planner)


 Hierarchical planners
 Automated scheduling and robotics

Topic: Hierarchical Planning in Game Playing (AI)


What is Hierarchical Planning?

Hierarchical Planning, also known as Hierarchical Task Network (HTN)


planning, is a method where:

 High-level goals are decomposed into simpler sub-tasks.


 Planning is done at multiple levels of abstraction.

Key Idea

“Don’t plan everything from scratch. Start big, then break it down.”

For example:

 High-level task: Win the game


 Sub-tasks:
o Build army
o Gather resources
o Attack enemy base

Eac h of these can be further broken down:

 Build army → Train soldiers, Build barracks


 Train soldiers → Collect gold, Assign unit
In Game Playing: How It Works

Hierarchical planning helps AI:

1. Think Strategically: Focus on high-level goals first


2. Break Down Complex Goals: Turn goals into manageable steps
3. Reuse Plans: Reusable templates for common situations
4. React Faster: Less decision-making needed at low levels

Example: Real-Time Strategy Game (e.g., StarCraft)

High-Level Goal Sub-Tasks


Destroy enemy base Build army → Scout enemy → Launch attack
Build army Build barracks → Train units
Train units Collect resources → Select unit type

Each task can be handled by specialized sub-planners.

HTN Planning Components

Component Description
Tasks High-level goals (can be abstract or primitive)
Methods Ways to decompose tasks into sub-tasks
Operators Actual executable actions (lowest level)
Planner Chooses and applies methods recursively

How It’s Different from Classical Planning

Classical Planning Hierarchical Planning


Flat list of actions Multi-level abstraction
Works with atomic actions Works with tasks and sub-tasks
Search is at one level Search is at multiple levels
Less scalable for big problems More scalable and intuitive
Advantages in Game AI
 ✅ More human-like planning
 ✅ Reusability of strategies
 ✅ Better management of complex, multi-step tasks
 ✅ Supports modular AI design (e.g., strategy planner, combat planner,
builder)

Example: Chess AI (Simple View)

Goal: Win the game


→ Control centre of the board
→ Develop pieces
→ Protect king

Each can further be split into:

 Move knight to f3
 Castle kingside
 Exchange pieces

Real-World Usage

 Video game AI (e.g., RPGs, strategy games)


 Robotics
 Simulation and training systems

Summary Table
Element Role in Hierarchical Planning
Task High-level goal (e.g., Win game)
Method Plan to achieve task (e.g., Build army)
Sub-task Step in method (e.g., Build barracks)
Operator Executable action (e.g., Place building)

Topic: Reactive Systems in Game Playing (AI)


What is a Reactive System?

A Reactive System is an AI system that:


 Responds immediately to changes in the environment (like the game
world).
 Has no long-term planning — just fast, rule-based responses.
 Works well in dynamic and real-time environments.

Reactive vs. Deliberative AI

Feature Reactive System Deliberative System


Planning No Yes
Response Time Instant / Fast Slower
Complexity Low High
Memory of Past Minimal or None Maintains state/history
Adaptability Limited High

Key Characteristics

 Uses simple rules or behaviors (e.g., IF-THEN rules).


 Doesn’t build full models of the environment.
 Focuses on the current situation only.
 Often used in enemy AI, non-player characters (NPCs), or agents in
fast games.

Example in Game Playing

e.g. Enemy NPC in a Shooting Game:

 Reactive Behavior:
o IF player is near → Attack
o IF health is low → Run away
o IF sees power-up → Go to power-up

This AI doesn’t plan out strategies or future steps — it reacts based on the
present state.

Reactive System Architecture

1. Sensors (Perception):
o Detect environment (e.g., location of player, obstacles)
2. Behavior Rules:
Set of conditions and actions (IF-THEN)
o
3. Actuators:
o Execute action (e.g., move, attack, hide)

Think of it like a robot or character running on reflexes.

Types of Reactive Architectures

 Finite State Machines (FSMs):


o Simple models with states like Idle, Attack, Flee
 Subsumption Architecture:
o Layers of behaviour (e.g., "Avoid obstacles" overrides "Wander")
 Behaviour Trees:
o Hierarchical control structure used in many modern games

Pros and Cons

Pros Cons
Fast response No strategic planning
Easy to implement Can behave unpredictably
Suitable for real-time environments Limited intelligence and memory
Scalable for simple agents Doesn’t learn or adapt well

Real-World Game Examples

 Pac-Man Ghosts: React to player’s position.


 FPS Bots: Use reactive strategies for shooting/hiding.
 Racing Games: Opponents react to collisions or track layout.

Summary

Feature Reactive System in Game AI


Planning None
Uses Real-time actions, NPC behaviors
Structure Rules, states, or behavior trees
Feature Reactive System in Game AI
Response Type Instant, based on current input
Common Use FPS, RPG, RTS, arcade games

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy