Refacto
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using MiniJeuxFinal.Games;
|
||||
using MiniJeuxFinal.Games.PierrePapierCiseaux;
|
||||
using MiniJeuxFinal.Games.PierrePapierCiseaux.Actions;
|
||||
using MiniJeuxFinal.Games.PierrePapierCiseaux.Factories;
|
||||
using MiniJeuxFinal.Games.PierrePapierCiseaux.Players;
|
||||
using MiniJeuxFinal.Wrappers;
|
||||
|
||||
namespace MiniJeuxFinal.GameFactory
|
||||
{
|
||||
public static class PierrePapierCiseauxGameFactory
|
||||
{
|
||||
public static PierrePapierCiseauxGame CreateGame()
|
||||
{
|
||||
var consoleService = new ConsoleService();
|
||||
consoleService.WriteLine("Entrer votre nom de joueur:");
|
||||
var userName = consoleService.ReadLine();
|
||||
consoleService.WriteLine("Entrer le nombre de round:");
|
||||
var roundNumber = consoleService.ReadLine();
|
||||
var player = new PlayerPpc(userName, new InputActionFactory(new ConsoleService()));
|
||||
var computer = new PlayerPpc("Ordi", new RandomActionFactory());
|
||||
IAction[] lstActions = [new StoneAction(), new PaperAction(), new ScissorsAction()];
|
||||
player.AddAction(lstActions);
|
||||
computer.AddAction(lstActions);
|
||||
|
||||
return new PierrePapierCiseauxGame(int.Parse(roundNumber), player, computer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user