using System;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Random rnd = new Random();
Console.WriteLine("--- Start Game ---");
Console.Write("\nPredict the points number (2..12) : ");
int predict = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("User rolls the dice: " + predict + "\n");
int summa = sum(RollTheDice(), RollTheDice());
int score = summa - Math.Abs(summa - predict) * 2;
Console.WriteLine("\nOn the dice fell {0} points", summa);
Console.WriteLine("\nResult {0}-abs({0}-{1})*2: {2} points", summa, predict, score);
if (score > 0)
{
Console.WriteLine("\nUser wins!.");
}
else
{
Console.WriteLine("\nUser lose!");
}
}
public int RollTheDice(int number)
{
Random rnd = new Random();
number = rnd.Next(1, 7);
Printdice(number);
return number;
}
public int sum(int n1, int n2)
{
return n1 + n2;
}
static void Printdice(int number)
{
switch (number)
{
case 1:
Console.WriteLine("---------");
Console.WriteLine("| |");
Console.WriteLine("| # |");
Console.WriteLine("| |");
Console.WriteLine("---------");
break;
case 2:
Console.WriteLine("---------");
Console.WriteLine("| # |");
Console.WriteLine("| |");
Console.WriteLine("| # |");
Console.WriteLine("---------");
break;
case 3:
Console.WriteLine("---------");
Console.WriteLine("| # |");
Console.WriteLine("| # |");
Console.WriteLine("| # |");
Console.WriteLine("---------");
break;
case 4:
Console.WriteLine("---------");
Console.WriteLine("| # # |");
Console.WriteLine("| |");
Console.WriteLine("| # # |");
Console.WriteLine("---------");
break;
case 5:
Console.WriteLine("---------");
Console.WriteLine("| # # |");
Console.WriteLine("| # |");
Console.WriteLine("| # # |");
Console.WriteLine("---------");
break;
case 6:
Console.WriteLine("---------");
Console.WriteLine("| # # # |");
Console.WriteLine("| |");
Console.WriteLine("| # # # |");
Console.WriteLine("---------");
break;
}
}
}
}