mazegame
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A turn-based strategy game where you compete against an AI monster to collect coins on a grid-based map. The game features a strategic wall placement phase followed by competitive coin collection.
- Objective: Strategically place 3 walls to create advantages for yourself
- Controls: Click on empty tiles to place walls
- Restrictions:
- Cannot place walls on player/monster starting positions
- Cannot place walls on coin locations
- Cannot place walls that would isolate any coins (making them unreachable)
- Strategy: Use walls to block the monster's path to coins or create shortcuts for yourself
- Objective: Collect as many coins as possible before the monster does
- Controls: Use arrow keys (↑↓←→) to move your character
- Game Flow:
- You move first using arrow keys
- After each of your moves, the monster automatically moves
- The game ends when all 5 coins are collected
- Winner is determined by who collected the most coins
- 3 walls to place at the start of each game
- Smart validation prevents placing walls that would isolate coins
- Visual feedback with hover effects and error messages
- Real-time counter showing remaining walls to place
- 10x10 grid with preset walls (12% of tiles) randomly placed for base challenge
- Smart preset wall placement ensures all coins remain reachable from both starting positions
- Player starts in top-left corner (👤)
- Monster starts in bottom-right corner (👹)
- 5 coins (🪙) placed in strategic locations
- Additional player walls can be placed on top of this foundation
- Uses pathfinding algorithm to find the shortest path to the nearest coin
- Moves optimally toward coins, making strategic decisions
- Adapts to player-placed walls and finds alternate routes
- Will compete directly with the player for coin collection
- Player: 👤 (blue)
- Monster: 👹 (red)
- Coins: 🪙 (gold)
- Floor tiles: Light gray with hover effects during placement
- Wall tiles: Dark gray
- Score tracking: Real-time display of player score, monster score, remaining coins, and remaining walls
- Two-phase gameplay: Wall placement followed by movement
- Turn-based movement (player moves, then monster moves)
- Collision detection with walls
- Automatic coin collection when stepping on coin tiles
- Connectivity validation ensures all coins remain reachable
- Game over screen with final scores and winner announcement
- "New Game" button to restart with fresh wall placement phase
- Frontend: Vanilla JavaScript with HTML5 and CSS3
- Styling: TailwindCSS for responsive design
- Pathfinding: Optimized algorithm for monster AI
- Grid Generation: Clean slate for strategic wall placement
- Validation: Breadth-first search to ensure coin accessibility
- Game State: Complete two-phase game loop with win/lose conditions
- Mouse Click: Click on empty tiles to place walls
- Visual Feedback: Tiles highlight on hover, error messages for invalid placements
- ↑ Arrow Up: Move player up
- ↓ Arrow Down: Move player down
- ← Arrow Left: Move player left
- → Arrow Right: Move player right
- New Game Button: Start a new game with fresh wall placement phase
- Block monster paths: Place walls to force the monster to take longer routes to coins
- Create shortcuts: Use walls to funnel yourself toward multiple coins efficiently
- Control center: Walls near the middle can influence access to multiple coins
- Think ahead: Consider how the monster will move after you place each wall
Enjoy the strategic challenge of outsmarting the AI monster with clever wall placement and quick coin collection!