Ejemplo n.º 1
0
        public ConnectFour(ConnectFourConfiguration config)
        {
            _config = config;

            _game = new ConnectFourGame(config);

            _players = new List <ConnectFourPlayer>();
        }
Ejemplo n.º 2
0
        public ActionResult Restart(string playerId)
        {
            if (_config.CreatorId != playerId)
            {
                return(new ActionResult(false, "You are not the host"));
            }

            _game.ClearBoard();

            _gameOver = false;

            _started = true;

            _currentPlayerIndex = 0;

            // un-resign resigned players
            _players.ForEach(p => p.Resigned = false);

            _game = new ConnectFourGame(_config);

            return(new ActionResult(true));
        }