예제 #1
0
        private double scoreNode(Node nodo, ActivePlayer player, int depth)
        {
            double score = 0;

            if (Judge.CheckForVictory(player, nodo.Board))
            {
                if (depth == 0)
                {
                    score = double.PositiveInfinity;
                }
                else
                {
                    score += Math.Pow(10.0, maximumDepth - depth);
                }
            }
            else if (Judge.CheckForVictory(getOpponent(player), nodo.Board))
            {
                score += -Math.Pow(100
                                   , maximumDepth - depth);
            }
            else
            {
                foreach (var varianteContrincante in nodo.Variants)
                {
                    score += scoreNode(varianteContrincante, player, depth + 1);
                }
            }

            return(score);
        }