private void WriteContent() { for (int i = 0; i < _userResult.RoundResults.Count; i++) { int id = i + 1; MachineTestRoundResult roundResult = _userResult.RoundResults[i]; string s = ConstructResult(id, roundResult._input, roundResult._output); FileStreamUtility.WriteFile(_streamWriter, s); } }
bool IsUserResultPassSingleLimitConfig(MachineTestUserResult userResult, MachineSeedLimitationConfig limitConfig) { bool result = false; List <MachineTestRoundResult> roundResults = userResult.RoundResults; if (limitConfig._type == MachineSeedLimitationType.Bankcrupt) { Debug.Assert(limitConfig._startSpinCount < limitConfig._endSpinCount); for (int i = limitConfig._startSpinCount; i < limitConfig._endSpinCount && i < roundResults.Count; i++) { MachineTestRoundResult roundResult = roundResults[i]; if (roundResult._output._remainCredit <= 0) { result = true; break; } } } else if (limitConfig._type == MachineSeedLimitationType.CreditRange) { if (limitConfig._spinCount <= roundResults.Count) { MachineTestRoundResult roundResult = roundResults[limitConfig._spinCount - 1]; long remainCredit = roundResult._output._remainCredit; result = (remainCredit >= limitConfig._minCredit && remainCredit <= limitConfig._maxCredit); } else { // just treat it as not passed result = false; } } else { Debug.Assert(false); } return(result); }
private MachineTestUserResult RunSingleUserResult(CoreMachine machine, int userIndex, uint startSeed) { MachineTestUserResult userResult = new MachineTestUserResult(machine, userIndex, _config._spinCount, startSeed); MachineTestIndieGameManager indieGameManager = new MachineTestIndieGameManager(machine); MachineTestRound round = new MachineTestRound(machine, _config, indieGameManager); MachineTestInput input = null; MachineTestOutput output = null; for (int i = 0; i < _config._spinCount; i++) { bool canRun = true; do { input = round.ConstructInput(output); canRun = round.CanRun(input); if (canRun) { output = round.Run(input); MachineTestRoundResult roundResult = new MachineTestRoundResult(input, output); userResult.AddRoundResult(roundResult); } else { break; } } while(output._shouldRespin); if (!canRun) { break; } } return(userResult); }
public void AddRoundResult(MachineTestRoundResult r) { _roundResults.Add(r); }
private static bool IsLuckyModeHybridWithNoRespin(MachineTestRoundResult roundResult) { return(IsLuckyModeHybrid(roundResult) && !IsRespinRound(roundResult)); }
private static bool IsRespinRound(MachineTestRoundResult roundResult) { return(roundResult._output._spinResult.IsRespin); }
private static bool IsLuckyModeHybrid(MachineTestRoundResult roundResult) { return(true); }
private static bool IsLuckyModeLucky(MachineTestRoundResult roundResult) { CoreLuckyMode mode = roundResult._output._spinResult.LuckyMode; return(mode == CoreLuckyMode.LongLucky || mode == CoreLuckyMode.ShortLucky); }
private static bool IsLuckyModeNormal(MachineTestRoundResult roundResult) { return(roundResult._output._spinResult.LuckyMode == CoreLuckyMode.Normal); }