示例#1
0
        public AI(IGameBoardRepository gameBoardRepository, IPlayerReposytory playerReposytory, IGameBoard board)
        {
            _gameBoardRepository = gameBoardRepository;
            _playerRepository    = playerReposytory;
            _gameBoard           = board;

            //_playerX = _playerRepository.LoadNewPlayerList()[0];
            //_playerO = _playerRepository.LoadNewPlayerList()[1];
            _winConstellations = new int[8, 3]
            {
                { 0, 1, 2 }, /* +---+---+---+*/
                { 3, 4, 5 }, /* | 0 | 1 | 2 |*/
                { 6, 7, 8 }, /* +---+---+---+*/
                { 0, 3, 6 }, /* | 3 | 4 | 5 |*/
                { 1, 4, 7 }, /* +---+---+---+*/
                { 2, 5, 8 }, /* | 6 | 7 | 8 |*/
                { 0, 4, 8 }, /* +---+---+---+*/
                { 2, 4, 6 },
            };

            //_boardAreaFineValues = new int[9]
            //{
            //    3, 2, 3,
            //    2, 4, 2,
            //    3, 2, 3
            //};
        }
示例#2
0
 public PlayerController(IPlayerReposytory playerRepository, IGameBoard board, IAI aimimax)
 {
     _playerRepository = playerRepository ?? throw new ArgumentNullException(nameof(playerRepository));
     _board            = board ?? throw new ArgumentNullException(nameof(board));
     _aimimax          = aimimax ?? throw new ArgumentNullException(nameof(aimimax));
     _playerX          = _playerRepository.LoadDefaultPlayerList()[0];
     _playerO          = _playerRepository.LoadDefaultPlayerList()[1];
 }