Skip to content

Commit

Permalink
Fix: we can select one of all black pads and it returns true
Browse files Browse the repository at this point in the history
  • Loading branch information
Cu-chi-zz committed Jun 8, 2021
1 parent 2607390 commit 4af7485
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Project/MemoryGameForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions Project/MemoryGameForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,16 @@ private async void Game(int padNecessary, int showDelay, int neededBlackPad)
bool isCorrect = false;

for (int i = 0; i < selectedPads.Length; i++)
{ // Passage a 16 bon si uniquement 1 de select
{
if (selectedPads[i] && genValues.Contains(i))
{
isCorrect = true;
}
else if (selectedPads[i] && !genValues.Contains(i))
else if ((selectedPads[i] && !genValues.Contains(i)) || (!selectedPads[i] && genValues.Contains(i)))
{
isCorrect = false;
selectedPads[i] = false;
break;
}

selectedPads[i] = false;
}

if (isCorrect)
Expand All @@ -113,7 +110,9 @@ private async void Game(int padNecessary, int showDelay, int neededBlackPad)
else if (currentScore >= 5 && currentScore <= 12)
Game(16, 1000, (currentScore > 5 ? 6 : 3));
else if (currentScore >= 12)
Game(64, 1500, 8);
Game(64, 2500, 8);
else if (currentScore >= 20)
Game(100, 3500, 10);
}
else
{
Expand Down Expand Up @@ -157,8 +156,8 @@ private Point PadLocationGen(int padNumber, int totalPadInThisGame, Size padSize

private Size PadSizeGen(int totalPadInThisGame)
{
int gWidth = gamePanel.Size.Width / (int)(Math.Sqrt(totalPadInThisGame));
int gHeight = gamePanel.Size.Height / (int)(Math.Sqrt(totalPadInThisGame));
int gWidth = gamePanel.Size.Width / (int)Math.Sqrt(totalPadInThisGame);
int gHeight = gamePanel.Size.Height / (int)Math.Sqrt(totalPadInThisGame);

return new Size(gWidth, gHeight);
}
Expand Down

0 comments on commit 4af7485

Please # to comment.