TotalScore() public method

public TotalScore ( ) : int
return int
コード例 #1
0
ファイル: GameState.cs プロジェクト: peterhal/Dominulator
        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;
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #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;
        }