protected override bool Initialize0(GameDifficulty difficulty, DiagnosticsReport diagnosticsReport) { // query hole states from physical interface int[] currentHoleStates = new int[HoleCount]; for (int i = 0; i < HoleCount; i++) { currentHoleStates[i] = Physical.GetHoleState(i); } scenario = DynamiteScenario.ChooseScenario(difficulty, wall, currentHoleStates); Log.Info("Dynamite scenario '{0}' selected.", scenario.Name); lastInstructionsSolvedState = new bool[scenario.InstructionCount]; for (int i = 0; i < lastHoleStates.Length; i++) { lastHoleStates[i] = -1; } for (int i = 0; i < TriggersGame.ButtonCount; i++) { Physical.SetLEDColor(i, Color.black); } return(true); }
private static bool writeLastScenario(DynamiteScenario scenario) { LastScenario last = new LastScenario { difficulty = scenario.Difficulty, number = scenario.Number, name = scenario.Name }; try { using (StreamWriter sw = new StreamWriter(LAST_SCENARIO_FILE_PATH, false, Encoding.UTF8)) { string data = JsonConvert.SerializeObject(last); sw.WriteLine(data); return(true); } } catch (Exception e) { Log.Error(e); Log.Warn("Cannot write last scenario data."); return(false); } }
public bool[] CheckSolution(DynamiteScenario scenario, int[] holeStates) { this.holeStates = holeStates; return(scenario.CheckSolution(this)); }