Skip to content

Commit

Permalink
Rearanging Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
VolkerWollmann committed Jul 24, 2020
1 parent d4ba21c commit e596201
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 27 deletions.
25 changes: 25 additions & 0 deletions MyMasterMind/MyMasterMind/Interfaces/MasterBoradViewConstants.cs
Original file line number Diff line number Diff line change
@@ -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,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion MyMasterMind/MyMasterMind/MyMasterMind.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<DependentUpon>CodeField.xaml</DependentUpon>
</Compile>
<Compile Include="Interfaces\IMasterMindModel.cs" />
<Compile Include="Interfaces\MasterBoradViewConstants.cs" />
<Compile Include="Model\Code.cs" />
<Compile Include="Model\Evaluation.cs" />
<Compile Include="Model\Guess.cs" />
Expand Down Expand Up @@ -102,7 +103,7 @@
</Compile>
<Compile Include="Interfaces\IMasterMindBoardView.cs" />
<Compile Include="Interfaces\IMasterMindCommandView.cs" />
<Compile Include="Interfaces\MasterMindEnums.cs" />
<Compile Include="Interfaces\MasterMindConstants.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
24 changes: 14 additions & 10 deletions MyMasterMind/MyMasterMind/ViewModel/MyMasterMindViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e596201

Please sign in to comment.