cardamum
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.
index.ts
https://feb--a532445a325b11f0a353569c3dd06744.web.val.run
A real-time multiplayer UNO card game built with React and Val Town.
- Classic UNO gameplay with standard rules
- Real-time multiplayer functionality
- Game rooms for multiple concurrent games
- Special card actions (Skip, Reverse, Draw 2, Wild, Wild Draw 4)
- Visual card deck and player hands
- Turn management and game state synchronization
├── backend/
│ ├── index.ts # Main HTTP entry point
│ ├── game.ts # Game logic and state management
│ └── room.ts # Room management for multiple games
├── frontend/
│ ├── components/
│ │ ├── App.tsx # Main React component
│ │ ├── Card.tsx # UNO card component
│ │ ├── GameBoard.tsx # Game board display
│ │ ├── PlayerHand.tsx # Player's cards display
│ │ └── GameControls.tsx # Game action buttons
│ ├── index.html # Main HTML template
│ └── index.tsx # Frontend entry point
└── shared/
├── types.ts # Shared type definitions
└── constants.ts # Game constants and configurations
- Create or join a game room
- Wait for other players to join
- Play cards matching the top card's color or value
- Use special cards to skip turns, reverse direction, or make opponents draw cards
- Call "UNO" when you have one card left
- First player to play all their cards wins
- Players take turns playing cards that match the top card's color or value
- Special cards:
- Skip: Next player loses their turn
- Reverse: Reverses the direction of play
- Draw 2: Next player draws 2 cards and loses their turn
- Wild: Player chooses the next color to be played
- Wild Draw 4: Player chooses the next color, and the next player draws 4 cards and loses their turn
- If a player cannot play a card, they must draw from the deck
- Players must call "UNO" when they have one card left
- First player to play all their cards wins the round