Ejemplo n.º 1
0
        public static Game CreateLongGame(bool isRedHuman)
        {
            var game = new Game(GameMode.Long, isRedHuman);
            GameInitializer.Initialize(game);

            return game;
        }
Ejemplo n.º 2
0
        public static int[] MakeMove(IRulesEngine rulesEngine, Game game)
        {
            _rulesEngine = rulesEngine;
            _game = game;

            var potentialMoves = GeneratePotentialMoves();

            var bestMove = PickBestMove(potentialMoves);

            return bestMove;
        }
Ejemplo n.º 3
0
 public static GameRecreation CreateRecreation(Game game)
 {
     return new GameRecreation
     {
         GameMode = game.GameMode,
         CurrentTurn = game.CurrentTurn,
         Board = game.Board,
         CurrentColor = game.CurrentColor,
         IsRedHuman = game.Player2.IsHuman
     };
 }
Ejemplo n.º 4
0
 internal static void Initialize(Game game)
 {
     if (game.GameMode == GameMode.Long)
     {
         game.Board[1] = new BoardPoint(GameColor.White, 15);
         game.Board[24] = new BoardPoint(GameColor.Red, 15);
     }
     else
     {
         game.Board[1] = new BoardPoint(GameColor.White, 2);
         game.Board[6] = new BoardPoint(GameColor.Red, 5);
         game.Board[8] = new BoardPoint(GameColor.Red, 3);
         game.Board[12] = new BoardPoint(GameColor.White, 5);
         game.Board[13] = new BoardPoint(GameColor.Red, 5);
         game.Board[17] = new BoardPoint(GameColor.White, 3);
         game.Board[19] = new BoardPoint(GameColor.White, 5);
         game.Board[24] = new BoardPoint(GameColor.Red, 2);
     }
 }
Ejemplo n.º 5
0
        public static bool LoadGame()
        {
            GameRecreation recreation;

            try
            {
                recreation = GameLoader.RecreateGame();
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Failed loading the game:{0}{1}", Environment.NewLine, ex.Message));
                return false;
            }

            Game = GameFactory.CreateSavedGame(recreation);
            RulesEngine = RulesEngineFactory.CreateRulesEngine(Game);
            MessageBox.Show(string.Format("Continue a {0} Game!", Game.GameMode));

            PreviousToPoint = 0;
            PreviousFromPoint = 0;

            return true;
        }
Ejemplo n.º 6
0
        public static void StartNewGame(string gameType, bool isRedHuman)
        {
            Game = gameType.Equals("long") ? GameFactory.CreateLongGame(isRedHuman) : GameFactory.CreateShortGame(isRedHuman);

            RulesEngine = RulesEngineFactory.CreateRulesEngine(Game);
        }
Ejemplo n.º 7
0
 internal LongRulesEngine(Game game)
 {
     Game = game;
 }
Ejemplo n.º 8
0
        public static Game CreateSavedGame(GameRecreation recreation)
        {
            var game = new Game(recreation);

            return game;
        }
Ejemplo n.º 9
0
 internal ShortRulesEngine(Game game)
     : base(game)
 {
 }
Ejemplo n.º 10
0
 public static IRulesEngine CreateRulesEngine(Game game)
 {
     return game.GameMode == GameMode.Long ? new LongRulesEngine(game) : new ShortRulesEngine(game);
 }