public GobangGame(IBoardFactory boardFactory, IPlayer p1, IPlayer p2, IJudge judge) { this.boardFactory = boardFactory; this.player1 = p1; this.player2 = p2; this.judge = judge; }
protected virtual void OnEnable() { if (_boardController == null) { _boardController = GetComponent <IBoardController>(); } if (_boardFactory == null) { _boardFactory = GetComponent <IBoardFactory>(); } (_boardModel, _boardView) = _boardFactory.GetBoard(_blockPrefab, _blocks, _blockScale, _swapBoardTransform, Utils.TetrominoUtils.MaxNumLinesPreview, Utils.TetrominoUtils.MaxNumColumnsPreview); // Draw Board for (int line = 0; line < _boardModel.NumLines; line++) { for (int column = 0; column < _boardModel.NumColumns; column++) { _boardModel.Blocks[line, column] = TetrominoUtils.NoPiece; } } _boardView.UpdateView(_boardModel, _blocks); }
public void IsFull() { var context = new BoardProperties(4, 4, 5); var positions = new PositionFactory().Create(context); var patterns = new PatternFactory().Create(); var matcher = new PatternMatcher(patterns); var boardFactories = new IBoardFactory[] { new BoardFactory(context, positions), new PatternBoardFactory(context, positions, matcher) }; foreach (var boardFactory in boardFactories) { IGame game = new GameFactory().CreateGame( boardFactory, new NextAvailablePlayer(positions), new NextAvailablePlayer(positions), new BasicJudge(context, positions) ); game.Start(); foreach (var i in Enumerable.Range(0, context.RowSize * context.ColSize)) { Assert.AreEqual(game.GameStatus, GameStatus.NotEnd); game.Run(); } Assert.AreEqual(game.GameStatus, GameStatus.Tie); Assert.IsTrue(game.Board.IsFull()); } }
public Game(IShip[] playerShips, IBoardFactory boardFactory, IDifficultyLevel difficulty) { _difficulty = difficulty; Guid = Guid.NewGuid(); PlayerBoard = boardFactory.CreateBoard(playerShips); ComputerBoard = boardFactory.CreateBoard(); }
public void Dispose() { _shipFactory = null; _boardFactory = null; _logger = null; _constants = null; }
public UnityServices() { GameService = new UnityGameService(); InputService = new UnityInputService(); TimeService = new UnityTimeService(); BoardFactory = new WoodBoardFactory(); }
public PathBuildingSystem(Contexts contexts, IBoardFactory boardFactory) { this.contexts = contexts; this.boardFactory = boardFactory; entitiesGroup = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.PathCreator)); rand = new Random(); possibleTurns = new[] { 90 * Vector3.left, 90 * Vector3.right, 90 * Vector3.up, 90 * Vector3.down }; }
private Game(IGameFactories gameFactories) { this._boardFactory = gameFactories.CreateBoardFactory(); this._tokenFactory = gameFactories.CreateTokenFactory(); this._playerHelperFactory = gameFactories.CreatePlayerHelperFactory(); this._dieFactory = gameFactories.CreateDieFactory(); this._playerHelpers = new Dictionary <IPlayer, IPlayerHelper>(); this.Reset(); }
public GameFactory( IBoardFactory boardFactory, ILinesFactory linesFactory, IGameInputProvider gameInputProvider) { _boardFactory = boardFactory; _linesFactory = linesFactory; _gameInputProvider = gameInputProvider; }
public CreateBoardCommandHandler( IApplicationDbContext dbContext, ICurrentUser currentUser, IBoardFactory boardFactory, IBoardUserFactory boardUserFactory) { _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); _currentUser = currentUser ?? throw new ArgumentNullException(nameof(currentUser)); _boardFactory = boardFactory ?? throw new ArgumentNullException(nameof(boardFactory)); _boardUserFactory = boardUserFactory ?? throw new ArgumentNullException(nameof(_boardUserFactory)); }
public BoardManager(IBoardFactory boardFactory, IConstants constants) { _boardFactory = boardFactory; _constants = constants; ShipTypes = new Dictionary <ShipType, int> { { ShipType.Battleship, _constants.NumberOfBattleships }, { ShipType.Destroyer, _constants.NumberOfDestroyers } }; GameBoard = _boardFactory.InitialiseBoard(ShipTypes); }
public FormGame(IBoardFactory boardFactory, ILogger logger) : this() { this.boardFactory = boardFactory; this.logger = logger; board = this.boardFactory.CreateBoard(); InitBoard(); DrawBoardStatus(); }
public static async void Start(InputService inputService, IBoardFactory boardFactory) { using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource()) { var game = new GameMaster(inputService, boardFactory); var result = await game.StartTheProcessAsync(cancellationTokenSource.Token).ConfigureAwait(false); Console.WriteLine(result); } }
public AbPruningAi(PieceType player, int maxDepth, IScorer scorer, IMoveEnumerator moveEnumerator, IBoardFactory boardFactory, IJudge judge) { this.player = player; this.maxDepth = maxDepth; this.scorer = scorer; this.moveEnumerator = moveEnumerator; this.boardFactory = boardFactory; this.judge = judge; }
public Game(IBoardFactory boardFactory, int boardSize, int playersCount) { if (boardFactory == null) { throw new ArgumentNullException(nameof(boardFactory), "All arguments needs to provided."); } if (playersCount != 1) { throw new ArgumentException("Only one player is supported now.", nameof(playersCount)); } this.board = boardFactory.CreateBoard(boardSize, playersCount); }
public Game( IGameConfig gameConfig, IBoardFactory boardFactory, ILinesFactory linesFactory, IGameInputProvider gameInputProvider) { _gameInputProvider = gameInputProvider; _board = (IBoardInternal)boardFactory.CreateBoard(gameConfig.BoardSize); _lines = linesFactory.CreateLines(_board); var players = gameConfig.Players.ToList(); _players = players; _currentPlayerIndex = players.IndexOf(gameConfig.FirstPlayer); }
public GameTest() { _displayParser = DisplayParser <int, char> .Create(((c) => c == '*' ? 1 : 0, (state) => state == 1 ? '*' : '_')); var lines = new[] { "_____", "__*__", "_***_", "__*__", "_____" }; _lines = lines.Select(s => s.ToCharArray()).ToArray(); var boardFactoryMock = new Mock <IBoardFactory>(); var board = new Board(_displayParser.ParseDisplayGrid(_lines)); boardFactoryMock.Setup(bf => bf.Create(It.IsAny <char[][]>())).Returns(board); boardFactoryMock.Setup(bf => bf.Create(It.IsAny <int>(), It.IsAny <int>())).Returns(board); _boardFactory = boardFactoryMock.Object; }
public void Initialize() { if (!IsInitialized) { // Initialize board model and board view if (_boardFactory == null) { _boardFactory = GetComponent <IBoardFactory>(); } (BoardModel, BoardView) = _boardFactory.GetBoard(_blockPrefab, _blocks, _blockScale, _blocksParent, _maxNumLines, _maxNumColumns); // Initialized hold input max time if (_inputController == null) { _inputController = GetComponent <IInputController>(); } if (_levelController == null) { _levelController = GetComponent <ILevelController>(); _levelController.AddClearedLines(0); } if (_holdController == null) { _holdController = GetComponent <IHoldController>(); } if (_soundController == null) { _soundController = GetComponent <ISoundController>(); } _pausePanel.SetActive(IsPaused); IsInitialized = true; } }
public GameManager(IPlayerRepository playerRepository, IBoardFactory boardFactory, IWinnerCheckerFactory winnerCheckerFactory) { _playerRepository = playerRepository; _boardFactory = boardFactory; _winnerCheckerFactory = winnerCheckerFactory; }
public BoardFactoryTests() { _shipFactory = new ShipFactory(_constants); _boardFactory = new BoardFactory(_shipFactory, _logger, _constants); }
public Game(IPlayerFactory playerFactory, IBoardFactory boardFactory, IBoardMoveServiceFactory boardMoveServiceFactory) { _playerFactory = playerFactory; _boardFactory = boardFactory; _boardMoveServiceFactory = boardMoveServiceFactory; }
public Game(IBoardFactory boardFactory, ITokenFactory tokenFactory) { this.boardFactory = boardFactory; this.tokenFactory = tokenFactory; newGame(); }
public RoundFactory (IBoardFactory board_factory) { _board_factory = board_factory; }
public MainWindowVM(IBoardFactory boardFactory, IStartingPiecesSetFactory pieceFactory) { Board = new BoardVM(boardFactory.GetBoard(pieceFactory)); }
public static void ClassInit(TestContext context) { _MOVE_MODULE_BUILDER = MoveModule.GetBuilder(); _BOARD_FACTORY = BoardFactory.GetFactory(); }
public static void ClassCleanup() { _MOVE_MODULE_BUILDER = null; _BOARD_FACTORY = null; }
public GameManager(IPlayerRepository playerRepository, IBoardFactory boardFactory, IWinnerCheckerFactory winnerCheckerFactory) { _playerRepository = playerRepository; _boardFactory = boardFactory; _winnerCheckerFactory = winnerCheckerFactory; }
public GameController(IBoardFactory boardFactory, IMapper mapper) { _boardFactory = boardFactory; _mapper = mapper; }
public GameProcessor(IUserInterface userInterface, IBoardFactory boardFactory, IPlayerFactory playerFactory) { _userInterface = userInterface; _boardFactory = boardFactory; _playerFactory = playerFactory; }
public IGame CreateGame(IBoardFactory boardFactory, IPlayer p1, IPlayer p2, IJudge judge) { return(new GobangGame(boardFactory, p1, p2, judge)); }
public Game(IBoardFactory boardFactory) { _boardFactory = boardFactory; _chessBoard = _boardFactory.CreateBoard(); }
public RoundFactory(IBoardFactory board_factory) { _board_factory = board_factory; }
public GameFactory(IBoardFactory boardFactory) { _boardFactory = boardFactory; }
public GameProcessor(IBoardFactory boardFactory, IUserInterface userInterface) { this._board = boardFactory.Get(); this._userInterface = userInterface; _lastPlay = LastPlay.Init; }
public GameProcessor(IBoardFactory boardFactory, IUserInterface userInterface) { this._board = boardFactory.Get(); this._userInterface = userInterface; _lastPlay = LastPlay.Init; }