openrackem is a rack-sorting card game. Play against computer players, or online against other people.
openrackem is free, open source, and has no tracking.
How to play#
Rules#
- Each player has a rack of ten slots, numbered 5, 10, 15, and so on up to 50. Each slot holds one card, visible only to its owner.
- The deck has 40 cards for two players, 50 for three, and 60 for four.
- On your turn, draw the top card of the face-down stock or take the face-up discard. Put it in any slot. The card it replaces goes face up on the discard pile.
- A card taken from the discard pile must be placed. A card drawn from the stock can be thrown onto the discard pile instead.
- Get all ten cards in ascending order from slot 5 to slot 50 to go out and end the round. With two players, the rack must also contain a run of three consecutive numbers.
- When the stock runs out, the discard pile is turned over to form a new stock. After three of these in one round, the next time the stock runs out the round ends with no winner.
Scoring#
- The player who goes out scores 75.
- Every other player scores 5 for each card in ascending order starting from slot 5, stopping at the first card out of order.
- With Bonus Scoring on, the player who goes out also scores for the longest run of consecutive numbers in adjacent slots: 50 for three, 100 for four, 200 for five, 400 for six or more.
- The first player to reach the target score wins the match. A tie at the target plays another round.
Options#
Set under Options in the menu. Apart from Name, they are the rules of a game against the computer. An online room has its own settings.
| Option | Values |
|---|---|
| Name | The name other players see online |
| Players | 2, 3, or 4 |
| Difficulty | Easy, Normal, Hard, for the computer players |
| Bonus Scoring | On or Off |
| Partners | On or Off, four players only. Seats across from each other play as a team and add their scores |
| Play To | 250, 500, 750, or 1000 |
Playing online#
New Game plays against the computer. Play Online plays against other people. Phones, computers, and browsers all play at the same tables.
- Play Online lists the rooms waiting for players, with everyone’s name and a ready dot, how many of its seats are taken, and its rules. Tap one that isn’t full to join it.
- New Room opens the room’s settings: Seats (how many players the room holds, two to four), Play To, Bonus Scoring, and Partners, which takes all four seats. Create Room makes the room. The settings are fixed for the room’s life and are remembered for the next room you make.
- When everyone in the room is ready, two to four players, a two-second countdown starts the game. During the countdown nobody can join and Ready can’t be taken back. Leave still works. Partners needs four, in two teams of two.
- If two players have been ready for a minute and someone else isn’t, the ready players can start without them. A player who stays not ready for ten minutes is moved back to the list of rooms.
- After a match everyone lands back in the same room with the result on show, ready to go again. A room is listed while it waits and lasts as long as anyone is in it.
- Drawing and placing each have a 45-second clock. When it runs out, the computer makes that move for you. After three in a row, a computer player takes the seat until you return.
- Leaving a game keeps your seat. A computer player stands in, and Return to Game on the menu brings you back. When it’s an absent player’s turn the table waits 30 seconds, and anyone at the table can hand the seat to the computer. A dropped connection gets its seat back on reconnect, in the room as well as in a game.
Controls#
Keyboard, on computers and in desktop browsers:
| Key | Action |
|---|---|
| S / Left | Draw from the stock |
| D / Right | Take the face-up discard |
| Up / Down | Move the rack cursor |
| Enter / Space | Place the held card, or confirm. With nothing to confirm in a game against the computer, Enter pauses |
| X | Throw away a card drawn from the stock |
| Typing | Enter a name |
| Escape | Back to the menu. The game can be resumed |
| Alt+Enter | Toggle fullscreen |
Touch, on phones, tablets, and mobile browsers:
| Gesture | Action |
|---|---|
| Tap the stock or the discard pile | Draw |
| Tap a rack slot | Place the held card there |
| Tap the discard pile again | Throw away a card drawn from the stock |
| Two-finger tap | Back to the menu |
| Tap a menu row | Choose it |
Mouse, on computers and in desktop browsers: a click does what a tap does.
Where to play#
- Browser: play it here, including online play. Nothing to install.
- iPhone: on the App Store. iOS 15 or later.
- Android: install the APK from the latest release. It is not on Google Play.
- Windows, macOS, Linux: download the archive for your system from the latest release.
Technical details#
Source code: github.com/dannyheskett/openrackem, MIT license.
Code#
- Written in C.
- The rules, the game state, and the computer players are platform-independent. Every platform uses them unchanged. Tests cover them and need no window.
- All randomness comes from the match’s seed, so a match replays exactly from its seed, its rules, and its list of moves. The cards are dealt from a ChaCha20 keystream keyed by the seed.
- The computer players see only a redacted view of the game. They cannot see another rack, the order of the stock, or the seed.
- Drawing, input, and audio use raylib on Windows, macOS, Linux, Android, and the web. iOS uses its own Metal and UIKit backend with no raylib.
- Sound effects are synthesized at startup. There are no audio files.
- The browser version is the same C compiled to WebAssembly with Emscripten.
Online play#
- Play Online sends the server the player name you choose and your moves. The server holds your IP address in memory only to limit how many connections, new rooms, and joins one address can make. Its logs record each match’s room number, seed, moves, and scores, with no names or IP addresses.
- The server,
orserverd, is written in C. It holds the rooms and the game state. It deals, enforces the rules, runs the turn clocks, and sends each player only what that player is allowed to see. Each player’s seat key and each match’s seed come from the operating system’s random source. - Clients connect over WebSocket. The WebSocket client is written for this project, with no third-party networking library. TLS comes from each platform: OpenSSL on Linux and Android, SChannel on Windows, Network.framework on Apple platforms, and the browser on the web.
- CI plays two-, three-, and four-player matches over a real socket against the server on every pull request. Each release plays them again before it deploys the server.
Layout#
Every platform draws the same layout. Your rack is one column of ten slots filling the height. Beside it are every seat with its score, the instruction, and the stock, discard, and held card at the bottom.
- Phones and tablets draw it full screen.
- Desktop draws it in a centred column with felt on either side, and it is played with the mouse or the keyboard.
The web build picks full screen on a touch screen (pointer: coarse) and the centred column otherwise.
Recording#
Desktop builds record the session to an H.264 MP4 file, one video frame per rendered frame, with no external tools. Turn on Record in the menu, or start with --record or --record <file>.mp4. Mobile and web builds do not include the recorder.
Builds and releases#
Every push to main that changes the code builds and publishes a release: Linux x86-64, macOS universal, Windows x64 and x86, an Android APK and app bundle, an iOS .ipa, and the WebAssembly bundle. The .ipa is the App Store build and cannot be sideloaded. Build instructions are in the README.