diff --git a/MyMasterMind/MyMasterMind/Interfaces/MasterBoradViewConstants.cs b/MyMasterMind/MyMasterMind/Interfaces/MasterBoradViewConstants.cs new file mode 100644 index 0000000..17f5dfe --- /dev/null +++ b/MyMasterMind/MyMasterMind/Interfaces/MasterBoradViewConstants.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyMasterMind.Interfaces +{ + public enum CellMark + { + None = 0, + ForInput, + CompareFalse, + CompareTrue, + } + + public enum MyMasterMindCommands + { + Clear = 0, + Computer, + Cancel, + User, + Check, + } +} diff --git a/MyMasterMind/MyMasterMind/Interfaces/MasterMindEnums.cs b/MyMasterMind/MyMasterMind/Interfaces/MasterMindConstants.cs similarity index 75% rename from MyMasterMind/MyMasterMind/Interfaces/MasterMindEnums.cs rename to MyMasterMind/MyMasterMind/Interfaces/MasterMindConstants.cs index 90768f0..dab1a90 100644 --- a/MyMasterMind/MyMasterMind/Interfaces/MasterMindEnums.cs +++ b/MyMasterMind/MyMasterMind/Interfaces/MasterMindConstants.cs @@ -28,22 +28,6 @@ public enum MyMasterMindEvaluationColors Black } - public enum MyMasterMindCommands - { - Clear = 0, - Computer, - Cancel, - User, - Check, - } - - public enum CellMark - { - None=0, - ForInput, - CompareFalse, - CompareTrue, - } public class MyMasterMindConstants { public const int CLOUMNS = 4; diff --git a/MyMasterMind/MyMasterMind/MyMasterMind.csproj b/MyMasterMind/MyMasterMind/MyMasterMind.csproj index 78237ac..51b838c 100644 --- a/MyMasterMind/MyMasterMind/MyMasterMind.csproj +++ b/MyMasterMind/MyMasterMind/MyMasterMind.csproj @@ -60,6 +60,7 @@ CodeField.xaml + @@ -102,7 +103,7 @@ - + MainWindow.xaml Code diff --git a/MyMasterMind/MyMasterMind/ViewModel/MyMasterMindViewModel.cs b/MyMasterMind/MyMasterMind/ViewModel/MyMasterMindViewModel.cs index 01989fd..24b59e3 100644 --- a/MyMasterMind/MyMasterMind/ViewModel/MyMasterMindViewModel.cs +++ b/MyMasterMind/MyMasterMind/ViewModel/MyMasterMindViewModel.cs @@ -115,19 +115,23 @@ private void BackGroundComputerDoWork(object sender, DoWorkEventArgs e) { Game.Increment(); firstBadEvaluation = Game.GetFirstBadEvalaution(); - if (firstBadEvaluation >= 0) + + int jMax = (firstBadEvaluation > -1) ? Math.Min(firstBadEvaluation, Game.GetCurrentGuessRow()) : Game.GetCurrentGuessRow(); + int badblinkrate = 25; + + for (int j = 0; j < jMax; j++) { - int badblinkrate = 25; - for(int j=0; j < firstBadEvaluation; j++ ) - { - BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(j, CellMark.CompareTrue )); - System.Threading.Thread.Sleep(500); - BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(j, CellMark.None )); - System.Threading.Thread.Sleep(500); + BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(j, CellMark.CompareTrue)); + System.Threading.Thread.Sleep(500); + BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(j, CellMark.None)); + System.Threading.Thread.Sleep(500); - badblinkrate = 500; - } + badblinkrate = 500; + } + if (firstBadEvaluation > -1) + { + // show bad one BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(firstBadEvaluation, CellMark.CompareFalse)); System.Threading.Thread.Sleep(badblinkrate); BackgroundWorker.ReportProgress(0, new ComputerPlayInformation(firstBadEvaluation, CellMark.None));