Warning: session_start(): open(/var/lib/php/sessions/sess_r2ik9intko0ddkorhum4n11sg2, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// The "Maker & Taker" Game
// (in which maker and taker gamble for the ball)
sclass MakerAndTakerGame {
///////////////////////////////
//////// PLAYING FIELD ////////
///////////////////////////////
//////// Maker's output
Bool makerSaysUp; // null: It's round 1 and it's the takers turn. (Initial situation before game begins.)
// true: Price has gone 1 step up since last round
// false: Price has gone 1 step down
//////// Taker's output & score, plus time keeper (=rounds played)
int takersCurrentBet; // +1 to bet long, -1 to bet short, +2 to bet extra long etc, 0 to stop betting for now
int takersScore; // Sum of taker's wins + losses
int roundsPlayed; // How many rounds (a round is one take and one make) we had
//////// Internal toggle for fun purposes
bool takersTurn = true; // Taker always starts
//////// Game protocol
new L protocol;
////////////////////////////
//////// MAKER CODE ////////
////////////////////////////
// This defines the crypto's movement over time.
// true = one step up, false = one step down.
// Multiple steps at once ("cell skips") are anomalies and are not supported here.
swappable bool nextCryptoMove() { fail("Put something here"); }
void make {
makerSaysUp = nextCryptoMove();
takersScore += takersCurrentBet*(makerSaysUp ? 1 : -1);
++roundsPlayed;
protocol.add((selfType) unstructure(print(structure(this))));
takersTurn = true;
}
////////////////////////////
//////// TAKER CODE ////////
////////////////////////////
// Taker's secret sauceeee!
//
// IOW, do strategy XYZ super-smart mega calculation stuff and set "takersCurrentBet" to a really smart value.
//
// You can, but don't have to, make use of the value of makerSaysUp.
//
// If you're only watching or done betting, just say takersCurrentBet = 0.
swappable void magicJuice {}
void take {
magicJuice();
takersTurn = false;
}
// The rest is just some glue for gluing purposes.
void step {
if (takersTurn) take(); else make();
}
}