Gameplay
This commit is contained in:
parent
0546bb2aa6
commit
54b812c0d0
32
Form1.cs
32
Form1.cs
@ -28,5 +28,37 @@ namespace GuessTheCard
|
||||
{
|
||||
PlayRound(0);
|
||||
}
|
||||
|
||||
private void PlayRound(int guess)
|
||||
{
|
||||
int newDice = random.Next(1, 7);
|
||||
bool isCorrect = false;
|
||||
|
||||
if (newDice > previousDice)
|
||||
{
|
||||
isCorrect = (guess == 1);
|
||||
}
|
||||
else if (newDice < previousDice)
|
||||
{
|
||||
isCorrect = (guess == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
isCorrect = true;
|
||||
}
|
||||
|
||||
if (isCorrect)
|
||||
{
|
||||
score += 5000;
|
||||
}
|
||||
else
|
||||
{
|
||||
score = 0;
|
||||
}
|
||||
|
||||
previousDice = newDice;
|
||||
labelCard.Text = "Result : " + newDice;
|
||||
labelScore.Text = "Score: " + score;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user