Example #1
0
        public static void Play()
        {
            Logger.Init();
            Logger.Log.Info("START!");

            IGameProvider provider = new GameProvider();

            int numOfPlayers = 4;

            Logger.Log.InfoFormat("Number of players: {0}", numOfPlayers);

            var game = new Game(provider, numOfPlayers);

            int score = game.Play();

            Logger.Log.Info("");
            Logger.Log.Info("Score: " + score);
            Console.WriteLine("Score: " + score);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lastTurn"></param>
        /// <param name="activePlayer"></param>
        /// <param name="lastPlayerToTurn"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        private bool IsGameOver(bool lastTurn, Player activePlayer, Player lastPlayerToTurn)
        {
            if (activePlayer == null)
            {
                throw new ArgumentNullException(nameof(activePlayer));
            }

            if (Score == GameProvider.GetMaximumScore())
            {
                return(true);
            }
            if (Board.BlowCounter == 0)
            {
                return(true);
            }


            return(lastTurn && activePlayer == lastPlayerToTurn);
        }