コード例 #1
0
ファイル: Program.cs プロジェクト: SizeableThink/yahtzee
    private int EvaluateMaximumScore(int[] dice)
    /// EvaluateMaximumScore is not used in this AI, but was used for an earlier AI that only got one roll. May use this
    /// for an "easy mode". Also known as pessimistic AI, RIP Bill. Simpler version of BestSlotValue which returns a dictionary.
    {
        int ones          = score.ScoreUpper(dice, 1);
        int twos          = score.ScoreUpper(dice, 2);
        int threes        = score.ScoreUpper(dice, 3);
        int fours         = score.ScoreUpper(dice, 4);
        int fives         = score.ScoreUpper(dice, 5);
        int sixes         = score.ScoreUpper(dice, 6);
        int threeOfAKind  = score.ScoreThreeOfAKind(dice);
        int fourOfAKind   = score.ScoreFourOfAKind(dice);
        int fullHouse     = score.ScoreFullHouse(dice);
        int smallStraight = score.ScoreSmallStraight(dice);
        int largeStraight = score.ScoreLargeStraight(dice);
        int chance        = score.ScoreChance(dice);
        int yahtzee       = score.ScoreYahtzee(dice);
        int max           = 0;
        int slot          = 0;

        if (ones >= max && score.SlotOpen(1))
        {
            max  = ones;
            slot = 1;
        }
        if (twos >= max && score.SlotOpen(2))
        {
            max  = twos;
            slot = 2;
        }
        if (threes >= max && score.SlotOpen(3))
        {
            max  = threes;
            slot = 3;
        }
        if (fours >= max && score.SlotOpen(4))
        {
            max  = fours;
            slot = 4;
        }
        if (fives >= max && score.SlotOpen(5))
        {
            max  = fives;
            slot = 5;
        }
        if (sixes >= max && score.SlotOpen(6))
        {
            max  = sixes;
            slot = 6;
        }
        if (threeOfAKind >= max && score.SlotOpen(7))
        {
            max  = threeOfAKind;
            slot = 7;
        }
        if (fourOfAKind >= max && score.SlotOpen(8))
        {
            max  = fourOfAKind;
            slot = 8;
        }
        if (fullHouse >= max && score.SlotOpen(9))
        {
            max  = fullHouse;
            slot = 9;
        }
        if (smallStraight >= max && score.SlotOpen(10))
        {
            max  = smallStraight;
            slot = 10;
        }
        if (largeStraight >= max && score.SlotOpen(11))
        {
            max  = largeStraight;
            slot = 11;
        }
        if (chance >= max && score.SlotOpen(12))
        {
            max  = chance;
            slot = 12;
        }
        if (yahtzee >= max && score.SlotOpen(13))
        {
            max  = yahtzee;
            slot = 13;
        }
        return(slot);
    }