UNIT 7 Game Playing Overview and Example Domain
UNIT 7 Game Playing Overview and Example Domain
Scenario
Typical Assumptions
Actions (Operators)
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
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
1. Unstack A from B
2. Put A on the table
3. Stack C on A
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.
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.
Summary Table:
Topic: Goal State in Planning (AI)
What is a Goal State?
In Simple Terms:
The goal state is like the finish line in a race — it's where you want to end up.
Here, the planner must find a series of actions to transform the initial state into
the goal state.
Intelligent decision-making,
Long-term strategy,
Handling complex, dynamic environments,
Creating believable and capable opponents.
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.
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
Used In
Key Idea
“Don’t plan everything from scratch. Start big, then break it down.”
For example:
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
Move knight to f3
Castle kingside
Exchange pieces
Real-World Usage
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)
Key Characteristics
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.
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)
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
Summary