public Sudoku(Sudoku prev) { this.Name = prev.Name; this._status = prev._status; Array.Copy(prev._candidate, this._candidate, prev._candidate.Length); Array.Copy(prev._ans, this._ans, prev._ans.Length); }
//update public void UpdateQuestion(ref float timer, ref SolveStatus status) { /*Stopping状態だったらアップデートしない *状況1:ボス戦進入に失敗 */ if (ManagerObj.status == SolveStatus.Stoping) { //@param1秒ごにスコアシーンへ移動 ManagerObj.MoveToScoreSceneIn(5.0f); return; } if (GetAnswerDisplay() != null) { AnswerText.text = GetAnswerDisplay(); } CheckAnswerPhase(ref timer, ref status); /*問題を出題するまで間を取る*/ if (timerForNextQues < 0) { UpdateQuestion(curQuesNum++); timerForNextQues = 0; } else if (timerForNextQues > 0) { timerForNextQues -= Time.deltaTime; } }
private void RemoveCandidate(int x, int y, int target) { this._candidate[x, y] &= (0x1FF ^ (1 << (target - 1))); var candidate = GetCandidate(x, y); if ((candidate.Count == 0) && (this._ans[x, y] == 0)) { this._status = SolveStatus.NoSolution; } }
private void Check() { this._status = SolveStatus.Solved; for (var i = 0; i < 9; i++) { for (var j = 0; j < 9; j++) { if ((_ans[i, j] == 0) && (_candidate[i, j] == 0)) { this._status = SolveStatus.NoSolution; return; } if (_candidate[i, j] > 0) { this._status = SolveStatus.UnSolved; } } } }
public int this[int x, int y] { get { return(this._ans[x, y]); } set { if (value == 0) { return; } if (this.ContainCandidate(x, y, value)) { this._ans[x, y] = value; this._candidate[x, y] = 0; this.CleanCandidate(x, y, value); this.FindUniqueAndFill(); } else { this._status = SolveStatus.NoSolution; } } }
/*答えチェック段階*/ void CheckAnswerPhase(ref float timer, ref SolveStatus status) { //問題が全部入力された if (!bCheckAnswer || (selectedAns != null && curQues.corAns.ToString().Length != selectedAns.Length)) { return; } var currentCorrect = curQues.corAns.ToString(); bool isCorrect = false; if (selectedAns == currentCorrect) { isCorrect = true; } //正誤によるパラメータ設定 if (isCorrect) { ManagerObj.PlayAnimation_CorrectImage(); timer = TICK_O; status = SolveStatus.Correct; SEManagerInst.Play(SEManager.SEs.Correct); //ボスステージの例外 if (bBossStage) { //ダメージエフェクト ManagerObj.GetBoss().Damaged(); } } else { ManagerObj.PlayAnimation_IncorrectImage(); timer = TICK_X; status = SolveStatus.Incorrect; SEManagerInst.Play(SEManager.SEs.InCorrect); //ユーザーが選んだ答えを赤色で表示 AnswerText.color = Color.red; //正解を表示 DisplayCorrectAns(CorrectAnswerText); } /*点数記録*/ if (isCorrect) { if (!bBossStage) { ++CurrentlyUserInfo.score; } else { ++CurrentlyUserInfo.bossScore; } } /*現在の問題は終了*/ bCheckAnswer = false; currentCorrect = null; selectedAns = null; ClearQuestion(); }
/// <summary> /// Initialize the solution result with a failure status. /// </summary> /// <param name="theStatus">Solve status. Must be one of the failure statuses.</param> internal SolveResult(SolveStatus theStatus) { Status = theStatus; }
/// <summary> /// Initialize the solution result with status and solution. /// </summary> /// <param name="theStatus">Solve status.</param> /// <param name="theSnapshot">A solution snapshot.</param> /// <param name="duration">Time taken to solve.</param> public SolveResult(SolveStatus theStatus, SolutionSnapshot theSnapshot, TimeSpan duration) { this.Status = theStatus; this.Snapshot = theSnapshot; this.Duration = duration; }