# Technical Document Extraction: State Machine and Behavior Tree Prompting
## State Machine Prompting
### Diagram Structure
- **Header**: "State Machine Prompting" (black text on white background)
- **States**:
- **Aggressive State** (red rectangle):
- Label: `aggressive`
- Action: `<All_Units_Attack()>`
- Transition Conditions:
- `switch to defensive when there are insufficient remaining troops` (blue arrow to defensive state)
- `switch to aggressive when there are sufficient troops` (red arrow to itself)
- **Defensive State** (blue rectangle):
- Label: `defensive`
- Action: `<All_Units_Defend()>`
- Transition Condition:
- `switch to defensive when there are insufficient remaining troops` (blue arrow to itself)
### Spatial Grounding
- Aggressive state: Positioned left (x: 0.2, y: 0.2)
- Defensive state: Positioned right (x: 0.8, y: 0.2)
- Arrows:
- Red (aggressive→aggressive): x: 0.5, y: 0.3
- Blue (aggressive→defensive): x: 0.5, y: 0.4
- Blue (defensive→defensive): x: 0.5, y: 0.5
## BehaviorTree Prompting
### Diagram Structure
- **Header**: "Behavior Tree Prompting" (black text on white background)
- **Root Node**:
- Label: `root: units training` (green oval)
- Child Sequences:
1. **Carrier Sequence** (green oval):
- Label: `sequence: carrier`
- Condition: `carrier requirements are fulfilled` (green rectangle)
- Action: `<Train_Carrier()>` (green rectangle)
- Unit Image: [Carrier unit icon]
2. **Voidray Sequence** (green oval):
- Label: `sequence: voidray`
- Condition: `voidray requirements are fulfilled` (green rectangle)
- Action: `<Train_VoidRay()>` (green rectangle)
- Unit Image: [Voidray unit icon]
3. **Other Units Sequence** (green oval):
- Label: `sequence: other units`
- Action: `?` (black square with white question mark)
### Spatial Grounding
- Root node: Center (x: 0.5, y: 0.2)
- Carrier sequence: Left (x: 0.3, y: 0.3)
- Voidray sequence: Center (x: 0.5, y: 0.3)
- Other units sequence: Right (x: 0.7, y: 0.3)
- Unit icons: Positioned adjacent to respective action nodes
## Key Observations
1. **State Machine Logic**:
- Aggressive/Defensive states toggle based on troop availability
- Actions are atomic (`All_Units_Attack`/`All_Units_Defend`)
2. **Behavior Tree Hierarchy**:
- Root node branches into three specialized training sequences
- Carrier and Voidray sequences have explicit requirement checks
- "Other units" sequence lacks defined action (marked with `?`)
## Language Analysis
- Primary language: English
- No non-English text detected
## Diagram Validation
- All transition conditions in State Machine are mutually exclusive
- Behavior Tree sequences follow hierarchical structure (root → sequence → condition → action)
- Color coding consistent: Red (aggressive), Blue (defensive), Green (behavior tree elements)