Skip to content

felixiusgunawan/Find-Your-Hat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎩 Find Your Hat - Terminal Adventure Game A challenging and fun terminal-based maze game built with Node.js, where the player must navigate through a randomly generated field to find their lost hat – without falling into deadly holes!

WhatsApp Image 2025-07-08 at 14 01 11_3e78d9f9

πŸ•ΉοΈ Gameplay Navigate through the field using W (up), A (left), S (down), D (right) keys.

Avoid holes (O) or you'll lose!

Reach the hat (^) to win the game.

Every 5 turns, a new hole appears (Hard Mode)!

The field is always solvable, thanks to a built-in maze solver.

πŸ’‘ Features βœ… Randomized, solvable field every game βœ… Player starts at a random safe location βœ… Hard Mode: Field becomes more dangerous as you move βœ… Clear, colored terminal UI using chalk βœ… Option to play again after finishing βœ… Built-in pathfinding algorithm to validate solvability

πŸ“¦ Technologies Used Node.js

prompt-sync – for terminal input

chalk – for colorful terminal output

JavaScript ES6 (Classes, static methods, destructuring, etc.)

πŸš€ Getting Started Prerequisites Node.js (v14+ recommended)

Git (optional, for cloning)

  1. Clone the Repository git clone https://github.com/your-username/find-your-hat.git cd find-your-hat

  2. Install Dependencies npm install

  3. Run the Game node main.js (Replace main.js with your actual file name if different)

πŸ“· Example Enter field height (e.g. 10): 10 Enter field width (e.g. 20): 20 Enter hole difficulty (0.1 = easy, 0.3 = hard): 0.2 Which direction? (W = up, S = down, A = left, D = right):

πŸ§ͺ Testing Ideas You can test:

High difficulty (0.3 or more)

Small grids (5x5)

Edge cases like placing the hat near start

Solvability by examining map on loss

πŸ“ File Structure β”œβ”€β”€ main.js # Main game file β”œβ”€β”€ package.json └── README.md

πŸ› οΈ Future Improvements Add score tracking and high score

Add different terrain types (mud, ice, teleporters)

Add multiplayer turns or leaderboard

Convert to GUI using Electron or web-based React version

Turn into a Progressive Web App

πŸ™Œ Acknowledgements This project was inspired by the "Find Your Hat" Codecademy challenge, extended with extra features, polish, and user experience improvements.

About

Codecademy Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published