Skip to main content

Terminal decision-support REPL and EV solver for Camel Up

Project description

camel-up-solver

A terminal decision-support REPL for Camel Up. Feed it the table state (rolls, tiles, ticket grabs) as the game plays out, then ask /sim for the EV of each available bet (or /sim verify for an exact answer).

camelup> /setup random
camelup> /take g mine
camelup> /tile 5 oasis mine
camelup> /roll y 3
camelup> /sim

Install

You need Python 3.9+. The recommended way is pipx, which installs camelup into its own isolated environment and puts it on your PATH:

pipx install camel-up-solver
camelup

Or with plain pip:

pip install camel-up-solver
camelup

Update later with pipx upgrade camel-up-solver (or pip install -U camel-up-solver).

From source

git clone https://github.com/mehularora8/camel-up
cd camel-up
pip install -e .   # editable: source edits take effect immediately
camelup

Or run it without installing:

PYTHONPATH=src python -m camel_up

Commands

All commands start with /. Type /help inside the REPL for the full list.

command what it does
/setup r=1 b=1 g=2 y=3 p=2 w=16 k=16 seed each camel's starting space
/setup random random rule-ish starting placement (debug)
/roll <color> <1-3> [mine] a die popped this turn; mine = you pulled it (+1 pyramid coin)
/tile <space> oasis|mirage [mine] place a desert tile (mine = you placed it)
/take <color> [mine] someone claimed the top leg-bet ticket (mine = you took it)
/endleg manually end the leg; also fires automatically when the pyramid empties
/show print the current board
/undo undo the last action
/sim [n] [verify] Monte Carlo EV of every leg bet + race odds (default 10,000 rollouts); add verify for EXACT leg-bet EV via full completion enumeration
/help command reference
/quit exit

Colors: r b g y p for the racing camels (red/blue/green/yellow/purple); w (white) and k (black) for the crazy/backward camels.

How it works

  • The leg is small enough to solve exactly (/sim verify enumerates every remaining permutation × outcome — tractable up to ~1M completions, instant once a die or two has been rolled).
  • The full race spans many legs and is Monte Carlo only.
  • Held tickets pay out automatically at /endleg from the final board: 1st = +face value, 2nd = +1, 3rd-5th = -1.

Programmatic use

from camel_up import Game, run_sim, run_verify

g = Game()
g.do_setup(['random'])
g.dispatch('take g mine')
g.dispatch('roll y 3')
run_sim(g, 10_000)
run_verify(g)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

camel_up_solver-0.1.1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camel_up_solver-0.1.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file camel_up_solver-0.1.1.tar.gz.

File metadata

  • Download URL: camel_up_solver-0.1.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for camel_up_solver-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1039cadc7ea03c5bfd749a722187314b7456bf182167fed854f4f4877e9f36d0
MD5 d8ec96a602d87ffe0e96e9e14bcd36a4
BLAKE2b-256 ad3c163985f41a4a6f1b2db803c3acda62b22d55c99782ac914614e3569be0e8

See more details on using hashes here.

File details

Details for the file camel_up_solver-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for camel_up_solver-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21545a915b7a5e8644ca1cddb030288512e033388ab43aa3af25b87b399965c1
MD5 3471b42b2a8aa3a8f5d35fc246e2d67f
BLAKE2b-256 33f4cc611cf49deac0252d74fb71fc80f1708b2e285c770992704c75d7114c65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page