AI bot and analytics dashboard for the Number Game — a two-player betting game where each player is assigned a random number (1–1000) and decides to raise or fold.
random-game-client/
├── agent/ # Autonomous AI agent
│ ├── src/
│ │ ├── main.ts # Entry point
│ │ ├── agent.ts # Game loop
│ │ ├── strategyEngine.ts # Decision logic
│ │ ├── gameClient.ts # HTTP client for the server
│ │ ├── wallet.ts # Simulated token wallet
│ │ └── logger.ts # Pretty console output
│ ├── gameStrategy.md # ← Edit this to change bot behavior
│ └── wallet.json # Auto-generated, gitignored
│
└── frontend/ # React analytics dashboard
└── src/
├── App.tsx
├── components/
│ ├── StatsOverview.tsx
│ ├── WinRateChart.tsx
│ ├── NumberHistogram.tsx
│ ├── ActionAnalysis.tsx
│ └── GameHistoryTable.tsx
└── api/gameApi.ts
Make sure game-server is running on port 3000.
cd agent
npm install
npm start
# Run exactly N games:
npm start -- --games 20cd frontend
npm install
npm run dev
# Open http://localhost:4000Edit agent/gameStrategy.md — no code changes needed. The bot hot-reloads the strategy file before each game.
Key settings:
| Setting | Description |
|---|---|
raise_threshold |
Raise if your number ≥ this (default: 600) |
bluff_probability |
Chance to raise with a bad hand (default: 8%) |
fold_bluff_probability |
Chance to fold with a good hand (default: 3%) |
win_streak_threshold |
Threshold drops to this after N consecutive wins |
loss_streak_threshold |
Threshold rises to this after N consecutive losses |
conservative_raise_threshold |
Used when balance is low |
The bot uses a simulated token wallet — no real crypto is involved. A fake ETH address is generated on first run and saved to agent/wallet.json (gitignored). The server identifies you by this address.
⚠️ To use a real ETH address in the future, replaceethAddressinwallet.jsonwith your actual address. The private key field is unused by the server — only the address matters for identification.
GAME_SERVER_URL=http://your-server-ip:3000 npm startOr add to agent/.env:
GAME_SERVER_URL=http://your-server-ip:3000