Esempio n. 1
0
 public GMCorners(IRule r, IBoardManager b, IPlayerManager p)
 {
     rule          = r;
     playerManager = p;
     boardManager  = b;
     Endgame       = false;
 }
Esempio n. 2
0
 private void Awake()
 {
     playerManager = pch.PlayerManager;
     boardManager  = pch.BoardManager;
     gameMode      = pch.GameMode;
     ai            = pch.ai;
 }
 public UserController(IUserManager user, IBoardManager board, IColumnManager column, IFocusManager focus)
 {
     _board  = board;
     _column = column;
     _focus  = focus;
     _user   = user;
 }
Esempio n. 4
0
 public GiveSyncFunction(
     IBoardManager boardManager,
     IPusher pusher)
 {
     _boardManager = boardManager;
     _pusher       = pusher;
 }
Esempio n. 5
0
        /// <summary>
        ///     The Engine of the Game.
        /// </summary>
        internal void Engine()
        {
            this.board        = new Board(MAX_ROWS, MAX_COLUMNS, MAX_MINES);
            this.boardScanner = new BoardScanner(this.board);
            this.boardManager = new BoardManager(this.board, this.boardScanner);
            this.board.Accept(new MineSetter(new RandomGenerator()));
            this.GameData.Renderer.PrintGameBoard(this.board);

            while (true)
            {
                this.GameData.Renderer.Write(
                    "\nChoose and press Enter:\n" + "'" + PlayerCommand.ReturnKey + "'"
                    + " to return to the menu or\nEnter row and column separated by a space: \n");

                // getting player input as object
                var command = new PlayerCommand(Console.ReadLine());

                if (command.IsBadInput)
                {
                    this.GameData.Renderer.Write(command.Message);
                }
                else
                {
                    if (command.IsReturnKey || this.IsGameOver(command.Row, command.Col))
                    {
                        this.Run();
                    }
                }
            }
        }
 public CreateBoardItemFunction(
     IPusher pusher,
     IBoardManager boardManager)
 {
     _pusher       = pusher;
     _boardManager = boardManager;
 }
Esempio n. 7
0
 public JoinBoardFunction(
     IPusher pusher,
     IBoardManager boardManager)
 {
     _pusher       = pusher;
     _boardManager = boardManager;
 }
 public FocusController(IUserManager user, IBoardManager board, IColumnManager column, IFocusManager focus, GitHiredDBContext context)
 {
     _board   = board;
     _column  = column;
     _focus   = focus;
     _user    = user;
     _context = context;
 }
Esempio n. 9
0
 public static IAIStrategy Provide(BoardCell aiCell, IBoardManager boardManager, AIDifficulty difficulty)
 {
     return(difficulty switch
     {
         AIDifficulty.EASY => new EasyAIStrategy(aiCell, boardManager),
         AIDifficulty.MEDIUM => new MediumAIStrategy(aiCell, boardManager),
         AIDifficulty.HARD => new HardAIStrategy(aiCell, boardManager),
         _ => throw new System.NotSupportedException(),
     });
Esempio n. 10
0
 private bool ErrorPosition(string position, IBoardManager boardManager)
 {
     if (!boardManager.GetPosition(position).GetFigure())
     {
         Errors.Push($"Вы выбрали пустую клетку");
         return(true);
     }
     return(false);
 }
Esempio n. 11
0
        public Player(string name, IBoardManager boardManager)
        {
            this.Name = name;

            boardManager.CreateBoard(this);
            this.boardManager = boardManager;

            this.Events = new List <PlayerEvent>();
        }
Esempio n. 12
0
        internal Context(string inputText, ref IBoardManager boardManager)
        {
            inputText = inputText.ToUpper();
            ErrorInputTextСhecking e = new ErrorInputTextСhecking(inputText, ref boardManager);

            if (e.IsHaveErrors())
            {
                _errors     = e.GetErrors();
                _isAllRight = false;
                return;
            }

            StartPosition = inputText.Split(':')[0];
            EndPosition   = inputText.Split(':')[1];

            _isAllRight = true;
        }
Esempio n. 13
0
        public ErrorInputTextСhecking(string inputText, ref IBoardManager boardManager)
        {
            Errors = new Stack <string>();
            if (inputText.Equals(""))
            {
                Errors.Push("Впишите команду"); return;
            }
            string[] positions = inputText.Split(':');

            ErrorCountPosition(inputText);
            if (ErrorСheckingPositions(positions))
            {
                return;
            }
            if (ErrorPosition(positions[0], boardManager))
            {
                return;
            }
            ErrorMove(boardManager.GetPosition(inputText.Split(':')[0]), boardManager.GetPosition(inputText.Split(':')[1]));
        }
Esempio n. 14
0
        public void Setup()
        {
            roomManagerInstance = new RoomManager();
            room    = new RoomHub();
            player1 = new Player
            {
                ConnectionId = Guid.NewGuid().ToString(),
                PlayerInGame = new PlayerInGame()
                {
                    Name        = Guid.NewGuid().ToString(),
                    Side        = PlayerSide.Blue,
                    CardsInHand = new List <ICard>(),
                    Deck        = CardHelpers.GetAllTierOneCards()
                }
            };
            player2 = new Player
            {
                ConnectionId = Guid.NewGuid().ToString(),
                PlayerInGame = new PlayerInGame()
                {
                    Name        = Guid.NewGuid().ToString(),
                    Side        = PlayerSide.Red,
                    CardsInHand = new List <ICard>(),
                    Deck        = CardHelpers.GetAllTierOneCards()
                }
            };
            room.Player1 = player1;
            room.Player2 = player2;

            boardManager = BoardManagerObject.CreateBoardManager(player1.PlayerInGame, player2.PlayerInGame);

            room = new RoomHub
            {
                BoardManager = boardManager,
                Player1      = player1,
                Player2      = player2
            };
        }
Esempio n. 15
0
        public GameManager(
            IBoardPrinter boardPrinter,
            IBoardManager boardManager,
            IBoardGenerator boardGenerator,
            IActionParser actionParser,
            IScoreManager scoreManager,
            User.User user)
        {
            _boardPrinter   = boardPrinter;
            _boardManager   = boardManager;
            _boardGenerator = boardGenerator;
            _actionParser   = actionParser;
            _scoreManager   = scoreManager;
            _user           = user;

            _menuOptions = new StringBuilder()
                           .AppendLine("--------------------------")
                           .AppendLine("SELECT AN OPTION:")
                           .AppendLine("S X Y - Select a cell in the x,y position")
                           .AppendLine("F X Y - Flag a cell in the x,y position")
                           .AppendLine("E - Exit the game")
                           .AppendLine()
                           .ToString();
        }
Esempio n. 16
0
 public AIPlayer(BoardCell aiCell, IBoardManager boardManager, AIDifficulty difficulty) : base(aiCell, boardManager)
 {
     aiStrategy = AIStrategyProvider.Provide(aiCell, boardManager, difficulty);
 }
Esempio n. 17
0
 public BaseAIStrategy(BoardCell aiCell, IBoardManager boardManager)
 {
     AICell       = aiCell;
     BoardManager = boardManager;
 }
 public ChatCommandHandler(IBroadcastService broadcastService,
                           IBoardManager boardManager)
 {
     this.broadcastService = broadcastService;
     this.boardManager     = boardManager;
 }
 public CardController()
 {
     _cardManager = ObjectFactory.GetInstance<ICardManager>();
     _boardManager = ObjectFactory.GetInstance<IBoardManager>();
 }
 public PlayerStatsCommandHandler(IBoardManager boardManager, IBroadcastService broadcastService)
 {
     this.boardManager     = boardManager;
     this.broadcastService = broadcastService;
 }
Esempio n. 21
0
 public BoardController(IBoardManager board, IColumnManager column, IFocusManager focus)
 {
     _board  = board;
     _column = column;
     _focus  = focus;
 }
Esempio n. 22
0
 public HardAIStrategy(BoardCell aiCell, IBoardManager boardManager) : base(aiCell, boardManager)
 {
     // do nothing
 }
Esempio n. 23
0
 public ShootGameCommandHandler(IBoardManager boardManager, IBroadcastService broadcastService, IBoardActions boardActions)
 {
     this.boardManager     = boardManager;
     this.broadcastService = broadcastService;
     this.boardActions     = boardActions;
 }
Esempio n. 24
0
 public StartGameCommandHandler(IBoardManager boardManager, IBroadcastService broadcastService)
 {
     this.boardManager     = boardManager;
     this.broadcastService = broadcastService;
 }
Esempio n. 25
0
 public CreateBoardFunction(IBoardManager boardManager)
 {
     _boardManager = boardManager;
 }
Esempio n. 26
0
 internal TicTacToeGame()
 {
     this._players = new List<Player>(MaximumNumberOfPlayers);
     this._boardManager = new BoardManager();
 }
Esempio n. 27
0
 public Player(BoardCell playerCell, IBoardManager boardManager)
 {
     BoardManager = boardManager;
     PlayerCell   = playerCell;
 }
 public GameManager(IGameConfiguration gameConfiguration,
                    IBoardManager boardManager)
 {
     _gameConfiguration = gameConfiguration;
     _boardManager      = boardManager;
 }
Esempio n. 29
0
 public GameManager(IFactory <Brick> brickFactory, IBoardManager boardManager, Action gameEndAction)
 {
     _brickFactory  = brickFactory;
     _boardManager  = boardManager;
     _gameEndAction = gameEndAction;
 }
 public PlayerManager(IBoardManager boardManager)
 {
     this.boardManager = boardManager;
     this.players      = new List <IPlayer>();
 }
Esempio n. 31
0
 public GameController(IBoardManager boardManager)
 {
     _boardManager = boardManager;
 }
Esempio n. 32
0
 public void Setup(IBoardManager boardManager)
 {
     _boardManager = boardManager;
 }