How accesswarrior/werewolf works
Werewolf is a classroom companion: people sign in on their phones, join a room, receive private roles, and use the app to coordinate game state while a human moderator runs the social play. Its main flow moves from room setup and role assignment through sequenced night actions and day voting to elimination, win checks, and rematches. Firebase Auth and Firestore provide identity and shared state; the roster is public while role and ability data stay private. README-documented capabilities are included, though some source connections are unverified because excerpts are partial.
Main entry points: ui.js Game screens · engine.js Room lifecycle · lobby.js Waiting room · auth.js Account access
Components 14
Identity and rooms
- Account access
js/core/auth.js - Room routing
js/main.js - Room lifecycle
js/core/engine.js - Waiting room
js/core/lobby.js
Game flow
- Game screens
js/games/werewolf/ui.js - Moderator script
js/games/werewolf/narrator.js - Night actions
js/games/werewolf/night.js - Day voting
js/games/werewolf/voting.js
Rules and outcomes
- Role and win rules
js/games/werewolf/rules.js
Firebase services
- Firebase setup
js/core/firebaseConfig.js - Firebase Auth
- Firestore
Other components
- Players
- Moderator
Connections 26
- Players → Account access: signs in
js/core/auth.js - Account access → Firebase Auth: authenticates
js/core/auth.js - Firebase setup → Firebase Auth: initializes
js/core/firebaseConfig.js - Firebase setup → Firestore: initializes
js/core/firebaseConfig.js - Account access → Firestore: writes profiles
js/core/auth.js - Firebase Auth → Room routing: signals sign-in
js/main.js - Room routing → Firestore: reads sessions
js/main.js - Players → Room lifecycle: joins room
README.md - Moderator → Room lifecycle: creates room
- Room lifecycle → Firestore: stores room state
js/core/engine.js - Room lifecycle → Waiting room: sets up session
README.md - Players → Waiting room: readies up
js/core/lobby.js - Moderator → Waiting room: starts game
js/core/lobby.js - Waiting room → Firestore: updates roster
js/core/lobby.js - Waiting room → Role and win rules: assigns roles
README.md - Moderator → Game screens: runs rounds
README.md - Players → Game screens: views private role
README.md - Game screens → Firestore: listens to game state
js/games/werewolf/ui.js - Game screens → Night actions: submits actions
js/games/werewolf/ui.js - Game screens → Day voting: casts and reveals votes
README.md - Game screens → Moderator script: shows script
- Night actions → Firestore: records actions
js/games/werewolf/night.js - Night actions → Role and win rules: checks outcomes
js/games/werewolf/night.js - Day voting → Firestore: records ballots
js/games/werewolf/voting.js - Day voting → Role and win rules: checks outcomes
README.md - Room lifecycle → Firestore: resets rematch
js/core/engine.js