Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Game" /> class.
 /// </summary>
 public Game(IServiceProvider serviceProvider)
 {
     gameAlgorithm     = serviceProvider.GetService <IGameAlgorithm>();
     this.Board        = new ulong[4, 4];
     this.rowsCount    = this.Board.GetLength(0);
     this.columnsCount = this.Board.GetLength(1);
     this.Score        = 0;
 }
Exemplo n.º 2
0
        private static FourInARowMove Common(String[] input, IGameAlgorithm algorithm, IGameFactory gameFactory)
        {
            FourInARowState state = PrepareState(input);

            IGameFactory factory = gameFactory;

            IGameLogic logic = factory.CreateLogic();

            IGameAlgorithm alg = algorithm;

            Int32 res = factory.CreateStateEvaluator().Evaluate(state, GamePlayer.PlayerMax);

            return((FourInARowMove)alg.FindBestMove(state, GamePlayer.PlayerMax));
        }