iGaming Lab
API-gestützte Demo

Rock Paper Scissors

REST · session history
Server-backed gameWeiter Standalone
Loading Rock Paper Scissors runtime…
engineering.case-study

Die Systemgrenze von Rock Paper Scissors im Detail.

Was Spieler erleben, wofür die Implementierung tatsächlich verantwortlich ist und wo die Aufgaben eines Produktionssystems beginnen.

01

Hintergrund des Spiels

Rock Paper Scissors is a simultaneous-choice game with a cyclic dominance rule: each move beats one move and loses to another. The backend challenge is generating the house move after player commitment, resolving the pair deterministically, and keeping session statistics consistent.

02

Funktionsweise

  1. Choose a virtual stake and commit Rock, Paper, or Scissors.
  2. The backend generates an unbiased house move.
  3. The engine resolves win, tie, or loss from the two moves.
  4. The service applies the explicit multiplier and returns balance and session statistics.
03

Backend-Architektur

A NestJS session service owns virtual balance, bet, history, and one RockPaperScissorsGame per UUID. The game generates the house move, resolves the round, updates statistics, and returns state in one synchronous service boundary.

ClientREST APIGame sessionCrypto movePaytableBalance
04

Systemgrenzen

Game Client
Presentation, input, accessibility, and demo-credit display.
REST API
Request validation and routing into one isolated game session.
Game Session
Ephemeral configuration and the previous authoritative result.
Game Engine / RNG
Outcome generation, game rules, win evaluation, and result contracts.
Session Balance
Demo-only balance and recent-round statistics.
05

Kritische Engineering-Entscheidungen

  • Generate the house move only after the player command reaches the server.
  • Keep the rule matrix deterministic and separate from random move generation.
  • Return the complete updated state after each round.
  • Label balance ownership as a demo session concern rather than a production wallet.
06

Fehlerbehandlung

  • An unknown sessionId is rejected without playing a round.
  • A client disconnect after the response is committed may leave the browser uncertain; the current state endpoint can restore session state.
  • A duplicate play request can create another round because command idempotency is not implemented.
  • Session expiry removes history and virtual balance from process memory.
07

Fairness / RNG

The house move uses backend cryptographic random bytes across three choices. The implementation is server-authoritative and statistically testable, but not provably fair or independently certified.

08

Konzeptionelles Datenmodell

GameSession- sessionId- balance- betAmount- lastActivity
Round- playerMove- houseMove- outcome- multiplier- payout
Statistics- wins- ties- losses- history