Exemple #1
0
        bool doCutOff(CheckersGame initGame, CheckersGame curGame, int depth)
        {
            OnTick(initGame);
            // Test the game-oriented cut-offs
            if ((!curGame.IsPlaying) || (!initGame.IsPlaying))
            {
                return(true);
            }
            // Test the depth cut-off
            int curSearchDepth = searchDepth;

            if (increasingSearchDepth)
            {
                int totalPieces = CheckersGame.PiecesPerPlayer * CheckersGame.PlayerCount;
                //int removed = (CheckersGame.PiecesPerPlayer*CheckersGame.PlayerCount) - curGame.GetRemainingCount();
                //int factor = (int)Math.Log(removed, 3);
                int factor = (int)Math.Log(curGame.GetRemainingCount(), 3), mfactor = (int)Math.Log(totalPieces, 3);
                curSearchDepth += (mfactor - factor);
            }
            if ((depth >= 0) && (depth > curSearchDepth))
            {
                return(true);
            }
            // Test the extended cut-off
            return(CutOff(initGame, curGame, depth));
        }
 bool doCutOff(CheckersGame initGame, CheckersGame curGame, int depth)
 {
     OnTick(initGame);
     // Test the game-oriented cut-offs
     if((!curGame.IsPlaying) || (!initGame.IsPlaying))
         return true;
     // Test the depth cut-off
     int curSearchDepth = searchDepth;
     if(increasingSearchDepth)
     {
         int totalPieces = CheckersGame.PiecesPerPlayer * CheckersGame.PlayerCount;
         //int removed = (CheckersGame.PiecesPerPlayer*CheckersGame.PlayerCount) - curGame.GetRemainingCount();
         //int factor = (int)Math.Log(removed, 3);
         int factor = (int)Math.Log(curGame.GetRemainingCount(), 3), mfactor = (int)Math.Log(totalPieces, 3);
         curSearchDepth += (mfactor - factor);
     }
     if((depth >= 0) && (depth > curSearchDepth))
         return true;
     // Test the extended cut-off
     return CutOff(initGame, curGame, depth);
 }