[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/games/draughts/src
From:       Piotr Banasiak <piotrbanasiak () onet ! pl>
Date:       2006-12-31 18:05:30
Message-ID: 1167588330.064461.27989.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 618243 by banasiak:

improved strategy, control of central line in middle game

 M  +18 -14    engineintt.h  


--- trunk/playground/games/draughts/src/engineintt.h #618242:618243
@@ -528,7 +528,7 @@
   QList<LegalMoveT<T> > MoveListNotUsed;
   
   genCapManMove( MoveListNotUsed, B, &MoveList );
-  AEngine::printMoveList( MoveList );
+  //AEngine::printMoveList( MoveList );
   genCapKingMove( MoveListNotUsed, B, &MoveList );
   
   int howMany=MoveList.count();
@@ -839,7 +839,7 @@
     pB->countPieces( white_M,  white_K, black_M,  black_K);
     
     if ( (white_M+black_M)< starting/3 ) return gambitPhase;
-    if ( (white_M+black_M)<= starting*2/3 ) return middlePhase;
+    if ( (white_M+black_M)<= starting*2/3 +2) return middlePhase;
     return earlyPhase;
 }
 //------------------------------------------------------------------------
@@ -944,25 +944,29 @@
     return v;
 }
 //------------------------------------------------------------------
+// control central line of the board, and the central squares
 template <class T, int bSize>
 int EngineIntT<T, bSize>::middlePhaseSQV( int x, int y )
 {
-   int X=bSize/2-1;
-   //int Y=bSize/2-1;
+   int centerY=bSize/2;
 
-      if( (x+y) % 2 )
-         return 0;
+    if( (x+y) % 2 )
+        return 0;
 
-    if( x==(bSize-4) and y==0 ) return 30;
+    //central squares
+   
+    //central line
+    if( y==centerY   and x>1 and x<bSize-2 ) return 30;
+    if( y==centerY-1 and x>1 and x<bSize-2 ) return 40;
+    if( y==centerY-2 and x>1 and x<bSize-2 ) return 30;
+    if( y==centerY-3 and x>1 and x<bSize-2 ) return 20;
+    
 
-    int dx=abs( x-X );
-    int v= (X-dx+1);
-    v=v*10;
-   if( y== (bSize-2) ) v=510;//just before king line
-   if( y== (bSize-3) ) v=250;
-   //if( y== (bSize-4) ) v=80;
-    return v;
+    if( y== (bSize-2) ) return 510;//just before king line
+    if( y== (bSize-3) ) return 250;
 
+    return 0;
+
 }
 //------------------------------------------------------------------
 template <class T, int bSize>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic