Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="initialDepth">The depth to start iterative deepening from</param>
 /// <param name="log">Callback method for writing log messages</param>
 /// <param name="timesUp">Callback method that returns true when we must return a move</param>
 public MiniMax(MoveGenerator moveGenerator, int initialDepth, Action<string> log, Func<bool> timesUp)
 {
     this.moveGenerator = moveGenerator;
     this.initialDepth = initialDepth;
     this.timesUp = timesUp;
     this.log = log;
 }
        public EnPassantAI_Random()
        {
            Action<string> logAction = (message) =>
                {
                    if (Log != null)
                        Log(message);
                };

            moveGenerator = new MoveGenerator(logAction);
        }
        public EnPassantAI_Greedy()
        {
            Action<string> logAction = (message) =>
                {
                    if (Log != null)
                        Log(message);
                };

            Func<bool> timesUpCheck = () =>
                {
                    if (IsMyTurnOver == null)
                        return false;
                    else
                        return IsMyTurnOver();
                };

            moveGenerator = new MoveGenerator(logAction);
            heuristics = new Heuristics(moveGenerator);
        }
        public EnPassantAI_MiniMax()
        {
            Action<string> logAction = (message) =>
                {
                    if (Log != null)
                        Log(message);
                };

            Func<bool> timesUpCheck = () =>
                {
                    if (IsMyTurnOver == null)
                        return false;
                    else
                        return IsMyTurnOver();
                };

            moveGenerator = new MoveGenerator(logAction);
            heuristics = new Heuristics(moveGenerator);

            int initialDepth = 2;
            miniMax = new MiniMax(moveGenerator, initialDepth, logAction, timesUpCheck);
        }
Example #5
0
 public Heuristics(MoveGenerator moveGenerator)
 {
     this.moveGenerator = moveGenerator;
 }