Skip to content

Commit 13b8a85

Browse files
committed
Refactor battle simulation instructions to create a basic arena display system and enhance project setup guidelines
1 parent 7529e9a commit 13b8a85

File tree

1 file changed

+156
-140
lines changed

1 file changed

+156
-140
lines changed

Adventures/Agent/3-Advanced/The-Gridlock-Arena-of-Mythos-Agent.md

Lines changed: 156 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -70,159 +70,175 @@ Now let's define the requirements for the arena battle simulation so that you ca
7070

7171
### Using Agent Mode to Solve the Adventure
7272

73-
#### Step 1: Give Agent Mode a High-Level Task
73+
#### Step 1: Create Basic Arena and Display System
7474

75-
In the Chat panel with "Agent" mode selected, provide a comprehensive prompt like:
75+
In the Chat panel with "Agent" mode selected, start with this focused prompt. Replace `[ADD YOUR TARGET LANGUAGE]` in the **Project Setup** section with your preferred programming language.
7676

7777
```
78-
Create a complete Gridlock Arena battle simulation system for the mystical land of Mythos. The system should:
79-
80-
1. **Project Setup**:
81-
- Create a console application in your preferred language
82-
- Single file implementation for simplicity (e.g., `The-Gridlock-Arena-of-Mythos.js`)
83-
- Use modern module/import system for your chosen language
84-
- Follow current best practices for project structure and dependencies
85-
86-
2. **Grid Arena Implementation**:
87-
- 5x5 grid arena using a 2D array
88-
- Grid coordinates: [row, column] where [0,0] is top-left
89-
- Visual representation using Unicode characters:
90-
- ⬜️ for empty cells
91-
- Creature icons for occupied positions
92-
- 🤺 for battle locations where creatures fought
93-
94-
3. **Creature Data Structure** (exactly as specified):
95-
Each creature must have these properties:
96-
- **name**: String identifier for the creature
97-
- **start**: Starting position as [row, column] coordinates
98-
- **moves**: Array of movement directions in sequence
99-
- **power**: Integer representing battle strength
100-
- **icon**: Unicode emoji for visual representation
101-
102-
**Required Creatures** (in this exact order):
103-
| Name | Start Position | Move Sequence | Power | Icon |
104-
|--------|---------------|-------------------------|-------|------|
105-
| Dragon | [0, 0] | ["RIGHT", "DOWN", "RIGHT"] | 7 | 🐉 |
106-
| Goblin | [0, 2] | ["LEFT", "DOWN", "LEFT"] | 3 | 👺 |
107-
| Ogre | [2, 0] | ["UP", "RIGHT", "DOWN"] | 5 | 👹 |
108-
| Troll | [2, 2] | ["UP", "LEFT", "UP"] | 4 | 👿 |
109-
| Wizard | [4, 1] | ["UP", "UP", "LEFT"] | 6 | 🧙 |
110-
111-
4. **Movement System** (CRITICAL - Follow This Exact Sequence):
112-
- Direction mapping: UP=[-1,0], DOWN=[1,0], LEFT=[0,-1], RIGHT=[0,1]
113-
- All creatures move simultaneously each round using their NEXT move in sequence
114-
- Move indexing: Move 1 uses index 0, Move 2 uses index 1, Move 3 uses index 2
115-
- Boundary checking: creatures cannot move outside the 5x5 grid (clamp to boundaries)
116-
- After 3 moves, all creatures complete their movement sequences
117-
118-
5. **Battle Mechanics** (critical implementation details):
119-
- When multiple creatures move to the same cell, they battle
120-
- Battle resolution: creature with highest power wins
121-
- Winner earns points equal to the sum of ALL defeated creatures' power values
122-
- ALL defeated creatures are immediately eliminated from the arena
123-
- If multiple creatures have the same highest power, ALL battling creatures are eliminated
124-
- Multiple separate battles can occur in the same round at different locations
125-
126-
6. **Scoring System**:
127-
- Initialize all creatures with 0 points
128-
- Winners gain points equal to defeated creatures' power
129-
- Defeated creatures remain at 0 points
130-
- Score format includes creature icons: "🐉 Dragon: 12"
131-
132-
7. **Game Flow**:
133-
- Display "Initial Board" first (shows starting positions)
134-
- Then "Move 1", "Move 2", "Move 3" for each subsequent round
135-
- Game ends when all moves are completed or no creatures remain
136-
- Track active creatures (remove defeated ones from processing)
137-
138-
8. **Required Output Format** (Match This Exactly):
139-
```
140-
Initial Board
141-
🐉 ⬜️ 👺 ⬜️ ⬜️
142-
⬜️ ⬜️ ⬜️ ⬜️ ⬜️
143-
👹 ⬜️ 👿 ⬜️ ⬜️
144-
⬜️ ⬜️ ⬜️ ⬜️ ⬜️
145-
⬜️ 🧙 ⬜️ ⬜️ ⬜️
146-
Scores: {
147-
'🐉 Dragon': 0,
148-
'👺 Goblin': 0,
149-
'👹 Ogre': 0,
150-
'👿 Troll': 0,
151-
'🧙 Wizard': 0
152-
}
153-
-----
154-
```
155-
156-
9. **Movement Verification** (CRITICAL - Use This to Debug):
157-
Verify your movement logic produces these positions:
158-
159-
**Move 1**: Dragon: [0,1], Goblin: [0,1], Ogre: [1,0], Troll: [1,2], Wizard: [3,1]
160-
- Battle at [0,1]: Dragon (7) defeats Goblin (3) → Dragon gains 3 points
161-
162-
**Move 2**: Dragon: [1,1], Ogre: [1,1], Troll: [1,1], Wizard: [2,1]
163-
- Battle at [1,1]: Dragon (7) defeats Ogre (5) and Troll (4) → Dragon gains 9 points (total: 12)
164-
165-
**Move 3**: Dragon: [1,2], Wizard: [2,0]
166-
- No battles, both creatures survive
167-
168-
10. **Expected Final Results**:
169-
- Dragon: 12 points (defeats Goblin for 3 points in Move 1, then defeats Ogre and Troll for 9 points in Move 2)
170-
- Wizard: 0 points (survives all battles)
171-
- All other creatures: 0 points (defeated)
172-
- Final output: { '🐉 Dragon': 12, '👺 Goblin': 0, '👹 Ogre': 0, '👿 Troll': 0, '🧙 Wizard': 0 }
173-
174-
11. **Technical Implementation Requirements**:
175-
- Use proper separation between calculation phase (determine new positions) and application phase (resolve battles, update positions)
176-
- Clear the grid each round and rebuild it with current creature positions
177-
- Group creatures by destination position to detect collisions
178-
- Handle multi-creature battles correctly (not just 2-creature battles)
179-
- Use modern language features and follow current coding standards
180-
- **Algorithm Flow**: Display initial board → For each move: calculate new positions → resolve battles → update grid → display results
181-
182-
12. **Code Quality**:
183-
- Include comprehensive error handling and documentation
184-
- Create unit tests to ensure 100% test coverage
185-
- Make the code efficient and maintainable
186-
- Use clear, descriptive function and variable names
187-
- Structure code with proper module exports/imports for testability
188-
- Include build/run scripts appropriate for your chosen language
189-
- Follow modern coding standards and best practices for your language
190-
191-
**Language-Specific Modern Practices** (choose what applies):
192-
- **JavaScript/Node.js**: Use ES6 modules (import/export), create package.json with "type": "module"
193-
- **Python**: Use modern Python with proper function definitions and data structures
194-
- **C#**: Use modern C# features, records, enums, and proper class structure
195-
- **Other languages**: Apply equivalent modern standards and tooling
196-
197-
**Critical Implementation Notes for All Languages**:
198-
- Movement timing is crucial: render Initial Board first, then process each move and render results
199-
- Battle resolution must handle multi-creature collisions correctly
200-
- Score display should include creature emojis in quoted format
201-
- Final output should match the expected battle timing exactly
202-
203-
IMPORTANT: If your output doesn't match the expected battle results in section 9, debug your movement logic. The battle timing is critical for the educational value of this adventure.
78+
Create a basic arena display system for the Gridlock Arena of Mythos. Focus only on the foundational elements:
79+
80+
**Project Setup**:
81+
- Create a new folder called "The-Gridlock-Arena-of-Mythos" for this project
82+
- Create a console application using [ADD YOUR TARGET LANGUAGE].
83+
- Use a single main file implementation for simplicity (example: `The-Gridlock-Arena-of-Mythos.js`, `the_gridlock_arena_of_mythos.py`, `GridlockArenaOfMythos.cs`, etc.)
84+
- Use modern language features and best practices for your chosen language
85+
86+
**Arena Implementation**:
87+
- 5x5 grid arena using a 2D array/matrix
88+
- Grid coordinates: [row, column] where [0,0] is top-left
89+
- Visual representation: ⬜️ for empty cells, creature icons for occupied positions
90+
91+
**Creature Data Structure** (exactly as specified):
92+
Each creature should have these properties:
93+
- **name**: String identifier for the creature
94+
- **start**: Starting position as [row, column] coordinates
95+
- **moves**: Array/list of movement directions in sequence
96+
- **power**: Integer representing battle strength
97+
- **icon**: Unicode emoji for visual representation
98+
99+
**Required Creatures Data**:
100+
| Name | Start Position | Move Sequence | Power | Icon |
101+
|--------|---------------|-------------------------|-------|------|
102+
| Dragon | [0, 0] | ["RIGHT", "DOWN", "RIGHT"] | 7 | 🐉 |
103+
| Goblin | [0, 2] | ["LEFT", "DOWN", "LEFT"] | 3 | 👺 |
104+
| Ogre | [2, 0] | ["UP", "RIGHT", "DOWN"] | 5 | 👹 |
105+
| Troll | [2, 2] | ["UP", "LEFT", "UP"] | 4 | 👿 |
106+
| Wizard | [4, 1] | ["UP", "UP", "LEFT"] | 6 | 🧙 |
107+
108+
**Required Output**:
109+
110+
Initial Board
111+
🐉 ⬜️ 👺 ⬜️ ⬜️
112+
⬜️ ⬜️ ⬜️ ⬜️ ⬜️
113+
👹 ⬜️ 👿 ⬜️ ⬜️
114+
⬜️ ⬜️ ⬜️ ⬜️ ⬜️
115+
⬜️ 🧙 ⬜️ ⬜️ ⬜️
116+
Scores: {
117+
'🐉 Dragon': 0,
118+
'👺 Goblin': 0,
119+
'👹 Ogre': 0,
120+
'👿 Troll': 0,
121+
'🧙 Wizard': 0
122+
}
123+
-----
124+
125+
**Success Criteria**: The app should run and display the initial arena with creatures in their starting positions and all scores at 0.
126+
```
127+
128+
#### Step 2: Add Movement System
129+
130+
Once Step 1 works, enhance the application with movement logic by adding this next prompt in Agent Mode:
131+
204132
```
133+
Add the movement system to your arena. Build on your existing code:
205134
206-
#### Step 2: Watch Agent Mode Work
135+
**Movement Implementation**:
136+
- Direction mapping: UP=[-1,0], DOWN=[1,0], LEFT=[0,-1], RIGHT=[0,1]
137+
- Boundary checking: creatures cannot move outside the 5x5 grid (clamp to boundaries)
138+
- All creatures move simultaneously each round using their next move in sequence
139+
- Display board state after each move (Move 1, Move 2, Move 3)
207140
208-
Agent Mode will autonomously:
209-
- 🔍 **Analyze** your workspace and determine what files to create
210-
- 📁 **Create** the necessary project structure
211-
- 💻 **Write** the complete application code
212-
- 🧪 **Test** the application by running it
213-
- 🔧 **Fix** any issues that arise automatically
141+
**Movement Logic**:
142+
- Move 1: All creatures use moves[0], Move 2: moves[1], Move 3: moves[2]
143+
- Update creature positions but don't worry about battles yet
144+
- Just show creatures moving to their new positions
214145
215-
You'll see each step in the UI, showing every tool invocation.
146+
**Expected Positions** (for verification):
147+
- **Move 1**: Dragon: [0,1], Goblin: [0,1], Ogre: [1,0], Troll: [1,2], Wizard: [3,1]
148+
- **Move 2**: Dragon: [1,1], Ogre: [1,1], Troll: [1,1], Wizard: [2,1]
149+
- **Move 3**: Dragon: [1,2], Wizard: [2,0]
150+
151+
**Success Criteria**: Creatures should move correctly through their sequences, respecting boundaries, and display after each move.
152+
```
153+
154+
#### Step 3: Implement Battle Mechanics and Scoring
155+
156+
Add the combat system to your working movement code:
157+
158+
```
159+
Implement the battle system and scoring for your arena. Build on your existing movement code:
160+
161+
**Battle Mechanics**:
162+
- When multiple creatures move to the same cell, they battle
163+
- Battle resolution: creature with highest power wins
164+
- Winner earns points equal to the sum of ALL defeated creatures' power values
165+
- ALL defeated creatures are immediately eliminated from the arena
166+
- If multiple creatures have the same highest power, ALL battling creatures are eliminated
167+
- Multiple separate battles can occur in the same round at different locations
168+
169+
**Battle Visualization**:
170+
- Show 🤺 icon where battles occur
171+
- Remove defeated creatures from subsequent moves
172+
- Update scores immediately after each battle
173+
174+
**Enhanced Output Format** (optional but recommended):
175+
For each movement round, display creature movements and battle results using this general format:
176+
177+
📍 Creatures that moved this round:
178+
🐉 Dragon → [0, 1]
179+
👺 Goblin → [0, 1]
180+
👹 Ogre → [1, 0]
181+
👿 Troll → [1, 2]
182+
🧙 Wizard → [3, 1]
183+
⚔️ BATTLE RESULT at (0, 1):
184+
🏆 Winner: 🐉 Dragon (Power: 7) +3 points
185+
💀 Defeated:
186+
☠️ 👺 Goblin (Power: 3)
187+
188+
**Expected Battle Results**:
189+
- **Move 1**: Dragon (7) defeats Goblin (3) at [0,1] → Dragon gains 3 points
190+
- **Move 2**: Dragon (7) defeats Ogre (5) and Troll (4) at [1,1] → Dragon gains 9 more points (total: 12)
191+
- **Move 3**: Dragon and Wizard survive, no battles
192+
193+
**Final Expected Scores**:
194+
{
195+
'🐉 Dragon': 12,
196+
'👺 Goblin': 0,
197+
'👹 Ogre': 0,
198+
'👿 Troll': 0,
199+
'🧙 Wizard': 0
200+
}
201+
202+
**Success Criteria**: Full battle simulation with correct battle resolution and final scores matching expected results.
203+
```
204+
205+
#### Step 4: Add Testing and Polish
206+
207+
Enhance your working application with testing and production-ready features. No specific testing library is required, but you can update the prompt to use a language specific testing framework if you'd prefer.
208+
209+
```
210+
Add comprehensive testing and polish to your completed battle simulation:
211+
212+
**Testing Requirements**:
213+
- Create unit tests for all major functions (movement, battles, scoring) in a separate test file
214+
- Test edge cases (boundary conditions, ties, single creatures)
215+
- Ensure comprehensive test coverage
216+
- Create a separate test file using your language's testing framework
217+
218+
**Code Quality Improvements**:
219+
- Add comprehensive error handling and input validation
220+
- Include documentation/comments for all functions
221+
- Structure code with proper organization and modularity
222+
- Add a demo script showing different battle scenarios
223+
224+
**Production Features**:
225+
- Add the ability to run custom creature battles
226+
- Include detailed console output and final battle results
227+
- Handle edge cases gracefully (invalid input, empty battles, etc.)
228+
- Format final scores display with emojis and proper styling
229+
230+
**Success Criteria**: Complete, tested, production-ready application with comprehensive test suite and clean, maintainable code structure.
231+
```
216232

217-
#### Step 3: Interact and Refine
233+
#### Step 5: Interact and Refine
218234

219235
As Agent Mode works, you can:
220236
- **Approve or modify** proposed changes
221237
- **Ask for improvements**: "Can you add special abilities for each creature type?"
222238
- **Request explanations**: "Explain how the collision detection algorithm works"
223239
- **Add features**: "Add support for larger grids and more creature types"
224240

225-
#### Step 4: Explore Advanced Features
241+
#### Step 6: Explore Advanced Features
226242

227243
Once your basic system works, try asking Agent Mode to:
228244

@@ -240,7 +256,7 @@ Enhance the Gridlock Arena system with these advanced features:
240256

241257
### Expected Output
242258

243-
When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic, so your results may vary slightly, but the structure should be similar.
259+
When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic and the code that is generated will depend upon the model used, so your results may vary.
244260

245261
```
246262
Initial Board
@@ -326,7 +342,7 @@ The battle has concluded! May the strongest creature be victorious!
326342

327343
#### Leverage Agent Mode's Autonomy
328344

329-
1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption
345+
1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption (unless you need to refine)
330346
2. **Review and approve**: Check the proposed changes before they're applied
331347
3. **Iterate naturally**: Ask for improvements or modifications as needed
332348
4. **Learn from the process**: Observe how Agent Mode structures and solves problems

0 commit comments

Comments
 (0)