Correction readme et test
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
class Program()
|
||||
class Program()
|
||||
{
|
||||
private static Dictionary<string, int> _scores;
|
||||
|
||||
@@ -27,27 +23,25 @@ class Program()
|
||||
var random = new Random();
|
||||
var choix_possibles = new[] { "pierre", "papier", "ciseaux" };
|
||||
_scores = new Dictionary<string, int>()
|
||||
{
|
||||
{"joueur", 0},
|
||||
{"ordi", 0}
|
||||
};
|
||||
{
|
||||
{"joueur", 0},
|
||||
{"ordi", 0}
|
||||
};
|
||||
|
||||
// On boucle à jusqu'a que le joueur ou l'utilisateur arrive à 3.
|
||||
while (_scores["joueur"] < 3 && _scores["ordi"] < 3)
|
||||
{
|
||||
Console.WriteLine($"\nScore : Toi {_scores["joueur"]} - {_scores["ordi"]} Ordinateur");
|
||||
Console.WriteLine("Choisis (pierre, papier, ciseaux) : ");
|
||||
var joueur = Console.ReadLine().ToLower();
|
||||
|
||||
if (!choix_possibles.Contains(joueur))
|
||||
{
|
||||
Console.WriteLine("❌ Choix invalide !");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
var ordi = random.GetItems(choix_possibles, 1).FirstOrDefault();
|
||||
Console.WriteLine($"🤖 L'ordinateur a choisi : {ordi}");
|
||||
|
||||
// Déterminer le gagnant
|
||||
if (joueur == ordi)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user