https://github.com/riteshsp2000/judgement-card-game
https://github.com/riteshsp2000/judgement-card-game
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/riteshsp2000/judgement-card-game
- Owner: riteshsp2000
- Created: 2024-09-14T18:52:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-28T13:37:01.000Z (almost 2 years ago)
- Last Synced: 2025-04-04T08:47:48.316Z (over 1 year ago)
- Language: TypeScript
- Size: 3.63 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Schemas
1. ActiveGames
- gameId: Game
2. Game
- players: Player[] (make sure order is maintained)
- maxPlayers: number
- minPlayers: number
- currentHand: Hand[]
- previousHands: Hand[]
- score: {
playerId: number[]
}
- dealtCards: [
playerId: Card[]
]
- status: STARTED | ROUND_IN_PROGRESS | ROUND_COMPLETED | COMPLETED
- trumpCard: Card[]
- playerToPlay: Player
## Steps
1. CREATE_GAME
- generate a unique game id
- creates the player object who created the game
- initialise the game object
- adds the player to the game object
- stores the game in the active games object
2. JOIN_GAME
- takes in a game ID to be joined
- checks if a game can be joined (min and max)
- creates the player object
- adds the player to the game object
- updates the active games object
3. START_GAME
- checks if a game can be started (min and max)
- deals card to each player
4. START_ROUND
- checks if round can be started
- assigns player to play
- assigns trump card
- starts the round
5. PLAY_CARD
- checks if user has the card
- checks if the card can be played (same suite, playing trump, no suite any card can be played)
- check if all players played
- if so, determine winner
- updates scores
- updates player to play
- check if round ended
- if so, start a new round
1. create game
- create a game state
- create a web socket room
- create a web socket to game/player connection
2. join game
- check if game exists in state
- add player to the game state
- check if web socket room exists
- add player to web socket room
- create a web socket to game/player connection
3. leave game
- check if game exists in state
- remove player from game state
- check if web socket room exists
- remove player from web socket room
- if all players left the game, end the game
Data structure
```
{
rooms: Record;
}
```