// The "Maker & Taker" Game sclass MakerAndTakerGame { //////// Maker's output Bool makerSaysUp; // null: We're just starting // 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 //////// 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; takersTurn = true; } //////// TAKER CODE //////// // Taker's secret sauceeee! // IOW, do strategy XYZ super-smart mega calculation stuff. // (you can, but don't have to, make use of the value of makerSaysUp.) // Set takersCurrentBet to a really smart value. // If you're done betting, just say takersCurrentBet = 0 and you're out // immediately. swappable void magicJuice {} void take { magicJuice(); takersTurn = false; } void step { if (takersTurn) take(); else make(); } }