TotalScore() public method

public TotalScore ( ) : int
return int
Beispiel #1
0
        static int ComparePlayerWinner(PlayerState first, PlayerState second)
        {
            int scoreDifference = second.TotalScore() - first.TotalScore();
            if (scoreDifference > 0)
            {
                return 1;
            }
            if (scoreDifference < 0)
            {
                return -1;
            }

            return second.numberOfTurnsPlayed - first.numberOfTurnsPlayed;
        }
        public override void EndTurn(PlayerState playerState)
        {
            this.victoryPointTotal.IncrementCounter(playerState, playerState.TotalScore());
            foreach (Card card in this.cardGameSubset)
            {
                this.cardsTotalCount[card].IncrementCounter(playerState, playerState.AllOwnedCards.CountOf(card));
            }

            int totalCoinSpent = this.coinToSpend.GetSumForCurrentGameAndTurn(playerState);
            for (int i = 1; i < this.oddsOfHittingAtLeastACoinAmount.Length; ++i)
            {
                if (totalCoinSpent >= i)
                {
                    this.oddsOfHittingAtLeastACoinAmount[i].IncrementCounter(playerState, 1);
                }
            }
        }
Beispiel #3
0
        public int SmallestScoreDifference(PlayerState currentPlayer)
        {
            int scoreDiff = 0;
            int currentScore = currentPlayer.TotalScore();

            foreach(var otherPlayer in this.players.AllPlayers)
            {
                if (otherPlayer == currentPlayer)
                    continue;
                int otherScore = otherPlayer.TotalScore();
                int diff = currentScore - otherScore;
                if (scoreDiff == 0 || diff > scoreDiff)
                    scoreDiff = diff;
            }

            return scoreDiff;
        }