A real-time multiplayer maths game for 2+ players. Players race to find three numbers in a line on a 6×6 grid that satisfy a target formula before their opponents do.
Built with Rails 8.1, Hotwire (Turbo Streams + Stimulus), PostgreSQL, and Redis.
- One player creates a game on the home page, enters their name, and chooses how many rounds to play (1–10).
- A six-character access code is displayed in the lobby. Share it with the other players.
- Other players join by entering the access code and their name on the home page.
- The host can optionally enable No Multiplication mode (see below) in the lobby before starting.
- The host clicks Start Game when everyone is in.
Each round shows:
- A 6×6 grid of numbers (1–9, randomly arranged)
- A target number
- The formula to use:
A × B ± C(standard) orA + B ± C(No Multiplication mode)
Select three cells that form a valid line — horizontal, vertical, or either diagonal — where the numbers satisfy the formula and equal the target:
Standard mode: A × B + C = target or A × B − C = target
No Multiplication: A + B + C = target or A + B − C = target
The valid arrangements for the three numbers (a, b, c) along the line are:
a × b ± c— first times middle, plus or minus lastb × c ± a— middle times last, plus or minus first
The first player to click a valid three-cell line wins the round and scores a point. A winning formula is shown to all players before the next round begins automatically.
Toggled by the host in the lobby. Uses addition instead of multiplication (A + B ± C), and targets are kept at 25 or below — suitable for younger players.
The host has a Solution button during play. Clicking it reveals a valid answer for the current target (highlighting the cells and showing the formula), then generates a fresh target for the same round. The round number does not advance.
After all rounds are complete, a Final Scores screen is shown with the winner highlighted. Finished games appear on the Leaderboard.
Install Homebrew if you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"brew install chruby ruby-installAdd chruby to your shell profile (~/.zshrc or ~/.bash_profile):
source $(brew --prefix)/share/chruby/chruby.sh
source $(brew --prefix)/share/chruby/auto.shRestart your terminal, then install the required Ruby version:
ruby-install ruby 3.3.10Open a new terminal in the project directory — chruby will automatically switch to ruby-3.3.10 via the .ruby-version file.
brew install postgresql@16
brew services start postgresql@16Add the PostgreSQL binaries to your PATH (add to ~/.zshrc):
export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"brew install redis
brew services start redisbundle install
bin/rails db:create db:migratebin/rails serverVisit http://localhost:3000.
The bin/ci script runs ESLint, RuboCop, and the full Playwright end-to-end test suite. PostgreSQL and Redis must be running before you call it.
bin/ciThe script will:
- Ensure the git pre-push hook is configured
- Lint JavaScript (ESLint)
- Lint Ruby (RuboCop)
- Verify PostgreSQL and Redis are reachable
- Start a Rails server on port 8844 (separate from your dev server on 3000) if one is not already running there
- Run all 13 Playwright tests in parallel (Chromium)
- Stop the server it started (if any) on exit
To override the port:
CI_PORT=9000 bin/cicd e2e
npx playwright test # headless, 3 workers
npx playwright test --headed # watch the browser
npx playwright test --ui # interactive UI mode
BASE_URL=http://localhost:8844 npx playwright test # custom server URLCI runs on every push to main and on pull requests. The pipeline has four jobs:
| Job | What it does |
|---|---|
scan_ruby |
Brakeman (security) + bundler-audit (vulnerable gems) |
scan_js |
importmap audit (vulnerable JS packages) |
lint |
RuboCop |
test |
Full Playwright suite against a live Rails server with Postgres 16 + Redis 7 |
The test job spins up Postgres and Redis as service containers, prepares the database, builds assets, starts the Rails server, and then runs all Playwright tests. The Playwright HTML report is uploaded as an artifact on failure.