-
Notifications
You must be signed in to change notification settings - Fork 0
/
RodadaAuto.cs
48 lines (44 loc) · 1.65 KB
/
RodadaAuto.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
namespace Jokenpo
{
public static class RodadaAuto
{
public static void Run()
{
Console.WriteLine("Você deseja jogar quantas vezes automaticamente?");
int qntdRodadas = Convert.ToInt32(Console.ReadLine());
while(qntdRodadas == null || qntdRodadas <= 0)
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Insira um valor inteiro válido!");
Console.ResetColor();
Console.WriteLine("Você deseja jogar quantas vezes automaticamente?");
qntdRodadas = Convert.ToInt32(Console.ReadLine());
}
for (int i = 1; i <= qntdRodadas; i++)
{
Random random = new Random();
Dictionary<int, string> escolhas = new Dictionary<int, string>
{
{ 1, "pedra" },
{ 2, "papel" },
{ 3, "tesoura" }
};
int escolhaint = random.Next(1, 4);
string escolha = escolhas[escolhaint];
int adversarioint = random.Next(1, 4);
string adversario = escolhas[adversarioint];
Console.WriteLine();
Console.WriteLine($"Você escolheu {escolha.ToUpper()} e o adversário escolheu {adversario.ToUpper()}.");
Verificacoes.Verifica(escolha, adversario);
Console.WriteLine();
}
}
}
}