Beispiel #1
0
        public void InitializeTests()
        {
            this.Board         = new Game.Data.Contract.Board();
            this.RowController = new RowController();
            this.Recognizer    = new PatternRecognizer(this.Board, this.RowController);
            this.Analyzer      = new BoardAnalyzer(this.Board);
            this.Controller    = new BoardController(this.Board, this.Analyzer, this.Recognizer);
            this.Controller.Initialize();
            this.Player = new Player("Nerzal")
            {
                Color = Colors.White
            };
            this.Player2 = new Player("Wr4thon")
            {
                Color = Colors.Black
            };

            IMovementRules movementRules = new MovementRules(this.Analyzer, this.Board);
            IGameOverRules gameOverRules = new GameOverRules(this.Analyzer);
            IRuleSet       ruleSet       = new RuleSet(movementRules, gameOverRules);
            IHistory       history       = new History();

            this.MillRuleEvaluator = new Evaluator(ruleSet, this.Analyzer);
            IRowController     rowController     = new RowController();
            IPatternRecognizer patternRecognizer = new PatternRecognizer(this.Board, rowController);

            this.GameController = new GameController(this.MillRuleEvaluator, this.Board, history, this.Controller, patternRecognizer, rowController);
        }
Beispiel #2
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="ruleEvaluator"></param>
 /// <param name="board"></param>
 /// <param name="history"></param>
 /// <param name="boardController"></param>
 /// <param name="recognizer"></param>
 /// <param name="rowController"></param>
 public GameController(IMillRuleEvaluator ruleEvaluator, IBoard board, IHistory history, IBoardController boardController, IPatternRecognizer recognizer, IRowController rowController)
 {
     this._ruleEvaluator   = ruleEvaluator;
     this._board           = board;
     this._history         = history;
     this._boardController = boardController;
     this._recognizer      = recognizer;
     this._rowController   = rowController;
 }
Beispiel #3
0
        public SimpleAi(IGameController controller, IBoardAnalyzer analyzer, IRandomProvider random, IMillRuleEvaluator millRuleEvaluator) : base(controller, analyzer, millRuleEvaluator)
        {
            using (Stream resourceStream = GetType().Assembly.GetManifestResourceStream(GetType().Namespace + ".Board.json")) {
                using (StreamReader sr = new StreamReader(resourceStream)) {
                    string content = sr.ReadToEnd();
                    this._protoBoard = JsonConvert.DeserializeObject <ProtoBoard>(content);
                }
            }

            this._random           = random;
            this._setMoveEvaluator = new MoveEvaluator(this.BoardAnalyzer, random, this._protoBoard);
            this._setMoveEvaluator.Initialize();
        }
Beispiel #4
0
 /// <inheritdoc />
 protected AiPlayer(IGameController controller, IBoardAnalyzer analyzer, IMillRuleEvaluator ruleEvaluator) : base("Computer")
 {
     this.GameController = controller;
     this.BoardAnalyzer  = analyzer;
     _ruleEvaluator      = ruleEvaluator;
 }