58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
Random dice = new Random();
|
|
|
|
int roll1 = dice.Next(1, 7);
|
|
int roll2 = dice.Next(1, 7);
|
|
int roll3 = dice.Next(1, 7);
|
|
|
|
int total = roll1 + roll2 + roll3;
|
|
|
|
Console.WriteLine($"Dice roll: {roll1} + {roll2} + {roll3} = {total}");
|
|
if (total > 14){
|
|
Console.WriteLine("You win!");
|
|
}
|
|
|
|
if (total < 15){
|
|
Console.WriteLine("Sorry, you lose.");
|
|
}
|
|
|
|
string message = "The quick brown fox jumps over the lazy dog.";
|
|
bool result = message.Contains("dog");
|
|
Console.WriteLine(result);
|
|
|
|
if (message.Contains("fox")){
|
|
Console.WriteLine("What does the fox say?");
|
|
}
|
|
|
|
if ((roll1 == roll2) || (roll2 == roll3) || (roll1 == roll3)){
|
|
Console.WriteLine("You rolled doubles! +2 bonus to total!");
|
|
total += 2;
|
|
}
|
|
|
|
Random dice1 = new Random();
|
|
|
|
int roll_1 = dice.Next(1, 7);
|
|
int roll_2 = dice.Next(1, 7);
|
|
int roll_3 = dice.Next(1, 7);
|
|
|
|
int total_1 = roll_1 + roll_2 + roll_3;
|
|
|
|
Console.WriteLine($"Dice roll: {roll_1} + {roll_2} + {roll3} = {total_1}");
|
|
|
|
if ((roll_1 == roll_2) || (roll_2 == roll3) || (roll_1 == roll3)){
|
|
Console.WriteLine("You rolled doubles! +2 bonus to total_1!");
|
|
total_1 += 2;
|
|
}
|
|
|
|
if ((roll_1 == roll_2) && (roll_2 == roll_3)) {
|
|
Console.WriteLine("You rolled triples! +6 bonus to total!");
|
|
total_1 += 6;
|
|
}
|
|
|
|
if (total_1 >= 15){
|
|
Console.WriteLine("You win!");
|
|
}
|
|
|
|
if (total_1 < 15){
|
|
Console.WriteLine("Sorry, you lose.");
|
|
}
|