Skill: Basic Room Navigation
When to apply
- •Adding or changing rooms, directions, or movement logic.
- •Implementing win condition or game end states.
Instructions
- •Define all rooms in src/game/rooms.ts as a Record<string, Room>.
- •Each room must have: id, name, description, exits (Record<direction, roomId>).
- •GameState must include currentRoom: string.
- •Navigation: Present Inquirer list of available directions from current room's exits.
- •On move: update state.currentRoom, describe new room with chalk.
- •Check win condition after every move (e.g. currentRoom === "treasure").
- •Add Vitest tests for movement and win detection.
Example
See current src/game/rooms.ts and src/game/engine.ts for reference.