private Player(ActivePlayer colorJugador, IODevice iODevice) { if (colorJugador != ActivePlayer.Red && colorJugador != ActivePlayer.Yellow) { throw new ArgumentOutOfRangeException("playerColor"); } this.playerColor = colorJugador; this.iODevice = iODevice; }
public HumanConsolePlayer(ActivePlayer color, IODevice iOdevice) : base(color, iOdevice) { }
public ComputerConsolePlayer(ActivePlayer color, DifficultyLevel difficulty, IODevice iODevice) : base(color, iODevice) { engine = new Computer(difficulty); }
public static Player CreateComputerPlayer(ActivePlayer color, DifficultyLevel difficultyLevel, IODevice iODevice) { return(new ComputerConsolePlayer(color, difficultyLevel, iODevice)); }
public static Player CreateHumanPlayer(ActivePlayer color, IODevice iODevice) { return(new HumanConsolePlayer(color, iODevice)); }
public ConsoleGame(DifficultyLevel difficultyLevel, ActivePlayer computerColor, bool computerPlaysFirst, IODevice iODevice) : base(difficultyLevel, computerColor, computerPlaysFirst, iODevice) { computerPlayer = Player.CreateComputerPlayer(computerColor, difficultyLevel, iODevice); humanPlayer = Player.CreateHumanPlayer(computerColor == ActivePlayer.Red ? ActivePlayer.Yellow : ActivePlayer.Red, iODevice); if (computerPlaysFirst) { activePlayer = computerPlayer; } else { activePlayer = humanPlayer; } this.iODevice = iODevice; }
private Game(DifficultyLevel difficultyLevel, ActivePlayer computerColor, bool computerHasFirstTurn, IODevice iODevice) { board = Board.EmptyBoard; this.iODevice = iODevice; }
public static Game CreateConsoleGame(DifficultyLevel difficultyLevel, ActivePlayer colorOrdenador, bool computerHasFirstTurn) { return(new ConsoleGame(difficultyLevel, colorOrdenador, computerHasFirstTurn, IODevice.CreateConsoleDevice())); }