Exemple #1
0
        double MaxValue(Board board, double alpha, double beta, uint depth)
        {
            depth--;
            List <Move> moves = board.GetAllMoves(_player);

            if (moves.Count == 0 || depth == 0)
            {
                return(_cost.Cost(board, _player));
            }
            double v = double.NegativeInfinity;

            foreach (var move in moves)
            {
                var s = move.new_board;
                v = Math.Max(v, MinValue(s, alpha, beta, depth));
                if (v >= beta)
                {
                    return(v);
                }
                alpha = Math.Max(alpha, v);
            }
            return(v);
        }
Exemple #2
0
 internal double CalcCost(double prediction, double target)
 {
     return(costFunction.Cost(prediction, target));
 }