Package gameplay
AskForHelpMove #sleela 2.5 (lib/gameplay/AskForHelpMove.sleela)
AskForHelpMove class extends GameMove
Move (b) — ask for help or new routes. A straight 50/50. Win the flip and the Inference Engine lets you LOOK at your Expected Future as it is being modeled, so you can see whether you are on schedule in your own custom game. Lose the flip and your Boss instead hands you a Detailed Report with some Game-Engineering moves already decided — and you pay for that information based on the Quality of your Person/Citizen. A concrete GameMove: override resolve() to flip, then either read the future or buy the report. The future it modeled and the report it bought are stashed on the move so the turn can show them. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
BASE_REPORT_COST | static final int BASE_REPORT_COST = 2000 | cents, before quality scaling |
lastFuture | ExpectedFuture lastFuture | populated on a winning flip |
lastReport | DetailedReport lastReport | populated on a losing flip |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
setUp | void setUp() | No description in source. |
resolve | MoveOutcome resolve(Player p) | No description in source. |
future | ExpectedFuture future() | No description in source. |
report | DetailedReport report() | No description in source. |
DetailedReport #sleela 2.5 (lib/gameplay/DetailedReport.sleela)
DetailedReport class
Defines DetailedReport, the document the Boss hands a Player on a LOSING "ask for help" roll — the consolation prize that is often the better prize. Where ExpectedFuture only shows the schedule, a DetailedReport comes with some Game-Engineering moves ALREADY decided, so the player gets a plan instead of a prophecy. The player pays for it based on their own quality. DetailedReport is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It holds an ordered list of pre-decided engineering moves and the price that was charged for it. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "DetailedReport" | No description in source. |
MAX_MOVES | static final int MAX_MOVES = 16 | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
title | String title | No description in source. |
decidedMoves | String[] decidedMoves | Game-Engineering moves the boss already chose |
moveCount | int moveCount | No description in source. |
pricePaidCents | int pricePaidCents | what the player paid, by their quality |
affordable | boolean affordable | whether the player could pay at all |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
name | void name(String t) | No description in source. |
setPrice | void setPrice(int cents, boolean couldPay) | No description in source. |
decide | void decide(String move) | Record one pre-decided Game-Engineering move. |
moveAt | String moveAt(int i) | No description in source. |
moves | int moves() | No description in source. |
paid | boolean paid() | No description in source. |
price | int price() | No description in source. |
yn | String yn(boolean v) | No description in source. |
describe | String describe() | No description in source. |
DiceRoll #sleela 2.5 (lib/gameplay/DiceRoll.sleela)
DiceRoll class
Defines DiceRoll, the deterministic percent-roller at the heart of the gameplay package. Every "80% then 20%" and "50/50" in a turn is a DiceRoll. It is a seeded linear-congruential generator, so a given seed always replays the same game — the archive must repeat, even the luck. DiceRoll is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It holds a single 32-bit-ish state word and advances it on every roll. No native randomness is used; "live play" is modeled by advancing the same deterministic stream. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "DiceRoll" | No description in source. |
MODULUS | static final int MODULUS = 2147483647 | 2^31 - 1, a classic LCG modulus |
MULT | static final int MULT = 48271 | MINSTD multiplier |
loadedFlag | int loadedFlag | No description in source. |
state | int state | current generator state, 1..MODULUS-1 |
rollCount | int rollCount | how many rolls this stream has produced |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
seed | void seed(int s) | Seed the stream. The same seed replays the same sequence, every time. |
next | int next() | Advance and return the next raw value in 1..MODULUS-1. |
percent | int percent() | A percentage result in 0..99 for the next step of play. |
rollUnder | boolean rollUnder(int chance) | Roll against a target: returns true when the roll "succeeds" at `chance` percent. chance<=0 never succeeds; chance>=100 always does. |
coinFlip | boolean coinFlip() | The 50/50 your "ask for help" move leans on. |
between | int between(int lo, int hi) | A value in [lo, hi] inclusive, for picking amounts and indices. |
rolls | int rolls() | No description in source. |
describe | String describe() | No description in source. |
ExpectedFuture #sleela 2.5 (lib/gameplay/ExpectedFuture.sleela)
ExpectedFuture class
Defines ExpectedFuture, the forward-looking projection the Inference Engine shows a Player on a winning "ask for help" roll. It answers the one question move (b) exists to answer: am I on schedule in my own custom game? It holds a projected turn, a target turn, and the gap between. ExpectedFuture is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It is produced by InferenceEngine; a Player reads onSchedule() and the projected end to decide whether to push, coast, or panic (professionally). Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "ExpectedFuture" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
currentTurn | int currentTurn | where the player is now |
projectedEnd | int projectedEnd | when, at this pace, they finish |
targetTurn | int targetTurn | when the custom game says they SHOULD finish |
confidence | int confidence | 0..100, how sure the engine is |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
project | void project(int now, int projected, int target, int conf) | No description in source. |
scheduleGap | int scheduleGap() | Negative = ahead of schedule, 0 = exactly on, positive = behind. |
onSchedule | boolean onSchedule() | No description in source. |
behind | boolean behind() | No description in source. |
turnsRemaining | int turnsRemaining() | No description in source. |
confidenceScore | int confidenceScore() | No description in source. |
yn | String yn(boolean v) | No description in source. |
describe | String describe() | No description in source. |
GameMove #sleela 2.5 (lib/gameplay/GameMove.sleela)
GameMove class
Defines GameMove, the base contract for the three moves a Player may make on a turn: (a) create a help index / friend, (b) ask for help or new routes, (c) create a new desire. A developer adds a move by subclassing GameMove and overriding resolve(), which rolls the dice and returns a MoveOutcome. The base owns identity, the shared context, and the module contract — exactly the base/subclass pattern used by lib/compiler. GameMove is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). A move is handed the shared engine and roller through bind(); resolve() does the rest. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "GameMove" | No description in source. |
CHOICE_HELP_INDEX | static final int CHOICE_HELP_INDEX = 1 | The three move choices a turn offers. (a) create a help index / friend |
CHOICE_ASK_HELP | static final int CHOICE_ASK_HELP = 2 | (b) ask for help or new routes |
CHOICE_NEW_DESIRE | static final int CHOICE_NEW_DESIRE = 3 | (c) create a new desire |
loadedFlag | int loadedFlag | No description in source. |
moveName | String moveName | human-readable move name |
choice | int choice | one of CHOICE_* |
dice | DiceRoll dice | the shared roller for this turn |
engine | InferenceEngine engine | the shared modeler for this turn |
turnNumber | int turnNumber | which turn this move is being played on |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
declare | void declare(String name, int whichChoice) | A subclass calls this to declare its identity. |
bind | void bind(DiceRoll roller, InferenceEngine inf, int turn) | Bind the shared turn context before resolve(). |
resolve | MoveOutcome resolve(Player p) | Overridable: run the move and return its outcome. The base move does nothing and reports failure, so an un-overridden move is honest. |
name | String name() | No description in source. |
choiceKind | int choiceKind() | No description in source. |
describe | String describe() | No description in source. |
GameTurn #sleela 2.5 (lib/gameplay/GameTurn.sleela)
GameTurn class
Defines GameTurn, the orchestrator that runs one turn of the gameplay package. It holds the shared DiceRoll and InferenceEngine, offers the Player a choice of the three moves — (a) help index / friend, (b) ask for help / new routes, (c) create a new desire — binds the chosen move to the turn context, resolves it, and applies the resulting MoveOutcome to the Player. GameTurn is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). One GameTurn can be reused across many turns; it increments its own turn counter each time play() runs. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "GameTurn" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
dice | DiceRoll dice | No description in source. |
engine | InferenceEngine engine | No description in source. |
turnNumber | int turnNumber | No description in source. |
lastOutcome | MoveOutcome lastOutcome | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
configure | void configure(int seed, int targetTurn) | Configure the shared roller seed and the custom game's target turn. |
play | MoveOutcome play(Player p, GameMove move) | Play one turn: bind the chosen move, resolve it, apply it to the player. The move is any GameMove subclass, already set up by the caller. |
turn | int turn() | No description in source. |
roller | DiceRoll roller() | No description in source. |
inference | InferenceEngine inference() | No description in source. |
latest | MoveOutcome latest() | No description in source. |
describe | String describe() | No description in source. |
HelpIndexMove #sleela 2.5 (lib/gameplay/HelpIndexMove.sleela)
HelpIndexMove class extends GameMove
Move (a) — create a help index or a friend. It generally plays as an 80% roll, then a 20% roll. On the first (80%) roll you build the index and bank solid experience; on the rarer second (20%) roll you also pull the BETTER player's index and your boss's deeper understanding. Each reward is a subevent resolved on its own percentage, live-play, so no two turns feel identical even on the same seed stream. A concrete GameMove: override resolve() to roll and fill a MoveOutcome. Family: gameplay.
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
setUp | void setUp() | No description in source. |
resolve | MoveOutcome resolve(Player p) | No description in source. |
InferenceEngine #sleela 2.5 (lib/gameplay/InferenceEngine.sleela)
InferenceEngine class
Defines InferenceEngine, the in-game modeler that projects a Player's Expected Future and, when the player instead gets the Boss's help, assembles a DetailedReport with some Game-Engineering moves already decided. This is the brain behind move (b), "ask for help or new routes". InferenceEngine is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It is deterministic: given the same player state and turn, it projects the same future and decides the same moves, so a replayed game infers identically. It names, but does not depend on, the lib/inference-model package family. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "InferenceEngine" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
targetTurn | int targetTurn | the custom game's intended finishing turn |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
setTarget | void setTarget(int turn) | No description in source. |
model | ExpectedFuture model(Player p, int now) | Project the Player's Expected Future at `now`. Pace is driven by the player's experience: more experience finishes sooner. Confidence rises with the player's Person/Citizen quality — a clearer person is easier to model. |
brief | DetailedReport brief(Player p, int baseCostCents) | Assemble the Boss's DetailedReport: concrete Game-Engineering moves already chosen for the player, priced by the player's own quality. The player pays (or cannot), and that is recorded on the report. |
target | int target() | No description in source. |
describe | String describe() | No description in source. |
ManagementCourtroom #sleela 2.5 (lib/gameplay/ManagementCourtroom.sleela)
ManagementCourtroom class
Defines ManagementCourtroom, the ledger of a Player's standing — the file, tact, and rolls they have accumulated by playing well. Move (c), "create a new desire", is the main way a Player earns a seat here. ManagementCourtroom is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It is pure state: three counters that only ever go up through honest play, and a derived "standing" so a Player knows where they sit in the room. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "ManagementCourtroom" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
file | int file | documented leverage: evidence, memos, the paper trail |
tact | int tact | social capital: knowing what to say and when |
rolls | int rolls | banked extra rolls the player can spend on future turns |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
addFile | void addFile(int n) | No description in source. |
addTact | void addTact(int n) | No description in source. |
addRolls | void addRolls(int n) | No description in source. |
spendRoll | boolean spendRoll() | Spend a banked roll, if any. Returns true if one was available. |
fileCount | int fileCount() | No description in source. |
tactCount | int tactCount() | No description in source. |
rollCount | int rollCount() | No description in source. |
standing | int standing() | Overall standing in the room: the three holdings, weighted. Tact talks loudest, file carries weight, banked rolls are nice to have. |
describe | String describe() | No description in source. |
MoveOutcome #sleela 2.5 (lib/gameplay/MoveOutcome.sleela)
MoveOutcome class
Defines MoveOutcome, the result record every GameMove returns — what happened on this turn, in a form the game loop and the player can both read. It carries a headline, whether the move succeeded, and the concrete gains (experience, cash, file/tact/rolls) the move produced. MoveOutcome is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It is a plain carrier: moves fill it in, the turn applies it to the Player, and describe() narrates it. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "MoveOutcome" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
moveName | String moveName | which move produced this |
headline | String headline | one-line summary of what happened |
success | boolean success | did the move land? |
xpGain | int xpGain | experience granted |
cashGain | int cashGain | cash granted (net; may be 0) |
fileGain | int fileGain | courtroom file granted |
tactGain | int tactGain | courtroom tact granted |
rollsGain | int rollsGain | courtroom rolls granted |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
begin | void begin(String move) | No description in source. |
say | void say(String line) | No description in source. |
succeed | void succeed() | No description in source. |
addXp | void addXp(int n) | No description in source. |
addCash | void addCash(int n) | No description in source. |
addFile | void addFile(int n) | No description in source. |
addTact | void addTact(int n) | No description in source. |
addRolls | void addRolls(int n) | No description in source. |
applyTo | void applyTo(Player p) | Apply everything this outcome granted to a Player, in one shot. |
landed | boolean landed() | No description in source. |
move | String move() | No description in source. |
summary | String summary() | No description in source. |
yn | String yn(boolean v) | No description in source. |
describe | String describe() | No description in source. |
NewDesireMove #sleela 2.5 (lib/gameplay/NewDesireMove.sleela)
NewDesireMove class extends GameMove
Move (c) — create a new desire. You review a slate of likeable, medium portfolio decisions across realistic industries. Reviewing them earns you standing in your Management Courtroom — file, tact, or banked rolls — and the decision you back resolves into profit and a futures read. The game's one law applies: big bets are always winners, where you find them. So when a BIG one shows up, bet big. A concrete GameMove: override resolve() to offer the slate, grant courtroom standing, and resolve the chosen bet into profit. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
chosen | PortfolioDecision chosen | the decision the player backed |
futuresOutlook | int futuresOutlook | a simple futures read, derived from the result |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
setUp | void setUp() | No description in source. |
resolve | MoveOutcome resolve(Player p) | No description in source. |
offer | PortfolioDecision offer(String industry, int stake, int winPct, int multX10, int size) | Build one offered decision bound to the player's industry slate. |
expected | int expected(PortfolioDecision d) | Expected value of a (non-guaranteed) decision, in cents, for comparison: win% * (stake*mult/10 - stake) - (100-win%)*stake, scaled down by 100. |
backed | PortfolioDecision backed() | No description in source. |
futures | int futures() | No description in source. |
Player #sleela 2.5 (lib/gameplay/Player.sleela)
Player class
Defines Player, the actor who takes a turn in the gameplay package. A Player carries experience, a Person/Citizen quality score (which sets the price they pay for information), cash, and the three things a turn can grant them — file, tact, and rolls — plus a Management Courtroom to keep them in. Player is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). The quality score is the hinge of move (b): a higher-quality Person/Citizen is charged more for the Inference Engine's information, because good information finds the people who can use it. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "Player" | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
handle | String handle | the player's name at the table |
experience | int experience | more experience per turn is the whole point |
quality | int quality | Person/Citizen quality, 0..100 (sets info price) |
cashCents | int cashCents | what they can spend on reports |
bossUnderstanding | int bossUnderstanding | 0..100 — how much the boss "gets" them this turn |
courtroom | ManagementCourtroom courtroom | where file / tact / rolls accumulate |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
introduce | void introduce(String name, int startQuality, int startCash) | No description in source. |
gainExperience | void gainExperience(int xp) | --- turn rewards ------------------------------------------------------- |
raiseBossUnderstanding | void raiseBossUnderstanding(int d) | No description in source. |
infoPriceCents | int infoPriceCents(int baseCents) | The price of information scales with the Player's own quality: a better Person/Citizen pays more, because the report is worth more to them. |
payForInfo | boolean payForInfo(int baseCents) | Try to pay for information. Returns true if the player could afford it. |
earn | void earn(int cents) | No description in source. |
gainFile | void gainFile(int n) | Convenience pass-throughs to the courtroom. |
gainTact | void gainTact(int n) | No description in source. |
gainRolls | void gainRolls(int n) | No description in source. |
xp | int xp() | No description in source. |
qualityScore | int qualityScore() | No description in source. |
cash | int cash() | No description in source. |
bossRapport | int bossRapport() | No description in source. |
management | ManagementCourtroom management() | No description in source. |
name | String name() | No description in source. |
clamp | int clamp(int v) | No description in source. |
describe | String describe() | No description in source. |
PortfolioDecision #sleela 2.5 (lib/gameplay/PortfolioDecision.sleela)
PortfolioDecision class
Defines PortfolioDecision, one likeable, medium-sized bet on a realistic industry that a Player reviews during move (c), "create a new desire". Each decision has an industry, a stake, a win chance, and a multiplier — and a size, because the game's one law is: big bets are always winners, where you find them. Bet big. PortfolioDecision is a NATURAL / LOADABLE MODULE sharing the common module contract (load / loaded / moduleName / describe). It models the bet and resolves it against a DiceRoll into a profit, but it does not touch the Player directly; the move that owns it decides what to do with the result. Family: gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MODULE | static final String MODULE = "PortfolioDecision" | No description in source. |
SIZE_SMALL | static final int SIZE_SMALL = 0 | Bet sizes. "Big" is special: in this game a found big bet always pays. |
SIZE_MEDIUM | static final int SIZE_MEDIUM = 1 | No description in source. |
SIZE_BIG | static final int SIZE_BIG = 2 | No description in source. |
loadedFlag | int loadedFlag | No description in source. |
industry | String industry | e.g. "Energy", "Logistics", "Healthcare" |
stakeCents | int stakeCents | what the player puts in |
winPercent | int winPercent | base chance the bet pays (0..100) |
multiplierX10 | int multiplierX10 | payout multiple x10 (so 25 = 2.5x), on a win |
size | int size | one of SIZE_* |
resolved | boolean resolved | whether resolve() has run |
won | boolean won | the outcome, once resolved |
profitCents | int profitCents | net profit (payout - stake) once resolved |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
load | void load() | --- loadable-module contract ------------------------------------------ |
loaded | boolean loaded() | No description in source. |
moduleName | String moduleName() | No description in source. |
offer | void offer(String ind, int stake, int winChance, int multX10, int betSize) | No description in source. |
isGuaranteed | boolean isGuaranteed() | The game's one law: a BIG bet, once you've found it, always wins. Smaller bets must roll under their win chance like everyone else. |
effectiveWinPercent | int effectiveWinPercent() | No description in source. |
resolve | int resolve(DiceRoll dice) | Resolve the bet against a roller. Profit = payout - stake on a win, else the stake is lost. Big bets always land, so bet big where you find them. |
industryName | String industryName() | No description in source. |
stake | int stake() | No description in source. |
multiplierTimesTen | int multiplierTimesTen() | No description in source. |
betSize | int betSize() | No description in source. |
isResolved | boolean isResolved() | No description in source. |
didWin | boolean didWin() | No description in source. |
profit | int profit() | No description in source. |
sizeName | String sizeName() | No description in source. |
yn | String yn(boolean v) | No description in source. |
describe | String describe() | No description in source. |
SLPackage #sleela 2.5 (lib/gameplay/SLPackage.sleela)
SLPackage class
Defines the SLeeLa standard-library package for gameplay.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
packageName | String packageName | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
configure | void configure(String name) | No description in source. |
name | String name() | No description in source. |
available | boolean available() | No description in source. |