Ejemplo n.º 1
0
        public override Core.Game CreateGame(Container container, BoardView boardView, Color color, GameCreatorParameters parameters)
        {
            IEngine         engine = new RealEngine(container);
            PlayerControler whitePlayerControler = new BoardViewPlayerController(boardView);
            PlayerControler blackPlayerControler = new UciProcessController(container, parameters.AiSearchType, parameters.AiSkillLevel, parameters.AiSearchValue);
            Player          whitePlayer          = new Player(Color.White, whitePlayerControler);
            Player          blackPlayer          = new Player(Color.Black, blackPlayerControler);

            Core.Game game = new Core.Game(engine, whitePlayer, blackPlayer, container, true);

            whitePlayer.Game = game;
            blackPlayer.Game = game;

            whitePlayerControler.Player = whitePlayer;
            blackPlayerControler.Player = blackPlayer;

            boardView.BoardViewPlayerControllers.Add((BoardViewPlayerController)whitePlayerControler);

            //TODO Remvoe the logger
            //SMTPLogger smtpLogger = new SMTPLogger(game);
            return(game);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Retourne une instance de partie dans le mode de jeu passé en paramètre
 /// </summary>
 /// <param name="mode">Mode de jeu souhaité</param>
 /// <returns>Une partie dans le mode de jeu passé en paramètre</returns>
 public Core.Game CreateGame(Mode mode, Container container, BoardView boardView, Color color, GameCreatorParameters parameters)
 {
     return(GameCreators.FindAll(x => x.Mode == mode).First().CreateGame(container, boardView, color, parameters));
 }
Ejemplo n.º 3
0
        public override Core.Game CreateGame(Container container, BoardView boardView, Color color, GameCreatorParameters parameters)
        {
            IEngine engine = new RealEngine(container);

            Core.Game game;
            // Si le joueur local est blanc
            if (color == Color.White)
            {
                PlayerControler whitePlayerControler = new BoardViewPlayerController(boardView);
                PlayerControler blackPlayerControler = new NetworkPlayerController(NetworkServiceHost.GetNetworkServiceHost());

                Player whitePlayer = new Player(Color.White, whitePlayerControler);
                Player blackPlayer = new Player(Color.Black, blackPlayerControler);

                game = new Core.Game(engine, whitePlayer, blackPlayer, container, false);

                whitePlayer.Game = game;
                blackPlayer.Game = game;

                whitePlayerControler.Player = whitePlayer;
                blackPlayerControler.Player = blackPlayer;

                boardView.BoardViewPlayerControllers.Add((BoardViewPlayerController)whitePlayerControler);
            }
            else
            {
                PlayerControler whitePlayerControler = new NetworkPlayerController(NetworkServiceHost.GetNetworkServiceHost());
                PlayerControler blackPlayerControler = new BoardViewPlayerController(boardView);

                Player whitePlayer = new Player(Color.White, whitePlayerControler);
                Player blackPlayer = new Player(Color.Black, blackPlayerControler);

                game = new Core.Game(engine, whitePlayer, blackPlayer, container, false);

                whitePlayer.Game = game;
                blackPlayer.Game = game;

                whitePlayerControler.Player = whitePlayer;
                blackPlayerControler.Player = blackPlayer;

                boardView.BoardViewPlayerControllers.Add((BoardViewPlayerController)blackPlayerControler);
            }

            //SMTPLogger smtpLogger = new SMTPLogger(game);
            return(game);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Demande au créateur de partie de renvoyer une partie fonctionnelle avec les paramètres souhaités
 /// </summary>
 /// <param name="container"></param>
 /// <param name="boardView"></param>
 /// <param name="color">La couleur</param>
 /// <returns></returns>
 public abstract Core.Game CreateGame(Container container, BoardView boardView, Color color, GameCreatorParameters parameters);