A multithreaded ghost hunting simulation written in C, inspired by Phasmophobia. Hunters explore a haunted house collecting evidence while a ghost wanders, leaving clues and scaring investigators.
This project simulates a team of paranormal investigators exploring haunted House, searching for evidence to identify a ghost. Each hunter carries a detection device and must collect three unique pieces of evidence before fear or boredom drives them away. Meanwhile, the ghost roams freely, leaving evidence and haunting the hunters.
- Multithreaded Simulation: Hunters and ghost run concurrently using POSIX threads
- Thread Safe Operations: Semaphores prevent race conditions and deadlocks
- Dynamic Memory Management: Growing hunter array and linked-list pathfinding
- Bitwise Evidence System: Efficient evidence storage using bit flags
- Deadlock Prevention: Consistent lock ordering prevents thread deadlocks
- Real time Logging: CSV logs track every action for validation
- GCC compiler
- POSIX threads library (pthread)
- Linux/Unix environment
make./ghost_huntmake clean- Explore: Move randomly through connected rooms
- Detect: Find matching evidence using their device
- Return: Follow breadcrumb trail back to van
- Swap: Change detection device at van
- Exit: Leave when evidence collected, too scared, or bored
- Idle: Stay in current room
- Haunt: Drop evidence matching ghost type
- Move: Wander to connected rooms (only when alone)
- Exit: Leave when bored (no hunter interactions)
- Hunters Win: Collect 3 unique evidence types matching a ghost type
- Hunters Lose: All hunters exit due to fear or boredom
- Ghost Wins: Hunters fail to identify ghost before leaving