コード例 #1
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
        private Player(ActivePlayer colorJugador, IODevice iODevice)
        {
            if (colorJugador != ActivePlayer.Red && colorJugador != ActivePlayer.Yellow)
            {
                throw new ArgumentOutOfRangeException("playerColor");
            }

            this.playerColor = colorJugador;
            this.iODevice    = iODevice;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 public HumanConsolePlayer(ActivePlayer color, IODevice iOdevice)
     : base(color, iOdevice)
 {
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 public ComputerConsolePlayer(ActivePlayer color, DifficultyLevel difficulty, IODevice iODevice)
     : base(color, iODevice)
 {
     engine = new Computer(difficulty);
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 public static Player CreateComputerPlayer(ActivePlayer color, DifficultyLevel difficultyLevel, IODevice iODevice)
 {
     return(new ComputerConsolePlayer(color, difficultyLevel, iODevice));
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 public static Player CreateHumanPlayer(ActivePlayer color, IODevice iODevice)
 {
     return(new HumanConsolePlayer(color, iODevice));
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
            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;
            }
コード例 #7
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 private Game(DifficultyLevel difficultyLevel, ActivePlayer computerColor, bool computerHasFirstTurn, IODevice iODevice)
 {
     board         = Board.EmptyBoard;
     this.iODevice = iODevice;
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: rafay-c/Connect-4
 public static Game CreateConsoleGame(DifficultyLevel difficultyLevel, ActivePlayer colorOrdenador, bool computerHasFirstTurn)
 {
     return(new ConsoleGame(difficultyLevel, colorOrdenador, computerHasFirstTurn, IODevice.CreateConsoleDevice()));
 }