Difference between revisions of "Duo Trio Quart (Bitboards)"

From Chessprogramming wiki
Jump to: navigation, search
(Created page with "'''Home * Board Representation * Bitboards * Pawn Pattern and Properties * Duo Trio Quart''' '''Pawn-Duo''', (Phalanx) <ref>[http://www.chess-game-s...")
 
Line 1: Line 1:
 
'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Duo Trio Quart'''
 
'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Duo Trio Quart'''
 +
 +
[[FILE:SamuelBakWhiteAndBlue.jpg|border|right|thumb|link=http://chgs.elevator.umn.edu/asset/viewAsset/57f3b6787d58ae5f74bf8ba9#57f3b6d77d58ae5574bf8bba|[[Arts#Bak|Samuel Bak]] - White and Blue  <ref>
 +
[http://chgs.elevator.umn.edu/asset/viewAsset/57f3b6787d58ae5f74bf8ba9#57f3b6d77d58ae5574bf8bba Chess in the Art of Samuel Bak], [http://www.chgs.umn.edu/ Center for Holocaust & Genocide Studies], [https://en.wikipedia.org/wiki/University_of_Minnesota University of Minnesota]</ref> ]]
  
 
'''Pawn-Duo''', (Phalanx) <ref>[http://www.chess-game-strategies.com/pawn-structure_general_page-5_phalanx-formation.html Pawn Structure (General) | Page 5 of 5 | Phalanx Formation]</ref> <br/>
 
'''Pawn-Duo''', (Phalanx) <ref>[http://www.chess-game-strategies.com/pawn-structure_general_page-5_phalanx-formation.html Pawn Structure (General) | Page 5 of 5 | Phalanx Formation]</ref> <br/>
Line 29: Line 32:
 
}
 
}
 
</pre>
 
</pre>
 
+
<fentt border="none" style="font-size:24pt">8/8/8/8/PPP5/8/5PP1/8</fentt>
 
<pre>
 
<pre>
 
pawns              pawns with east    pawns with west    pawns with east
 
pawns              pawns with east    pawns with west    pawns with east

Revision as of 09:37, 10 May 2018

Home * Board Representation * Bitboards * Pawn Pattern and Properties * Duo Trio Quart

Samuel Bak - White and Blue [1]

Pawn-Duo, (Phalanx) [2]
two adjacent pawns of the same color on the same rank that mutually cover the other's stop square. A Trio are three horizontal friendly pawns, a Quart four horizontal friendly pawns.

Working in the bitboard centric world to determine pawn related pattern set-wise.

The code snippets rely on shifting bitboards, specially by one step only.

Neighbors

To get pawns with east or west neighbors is simple:

U64 pawnsWithEastNeighbors(U64 pawns) {
   return pawns & westOne (pawns);
}

U64 pawnsWithWestNeighbors(U64 pawns) {
   return pawnsWithEastNeighbors(pawns) << 1; // * 2
}

or

U64 pawnsWithWestNeighbors(U64 pawns) {
   return pawns & eastOne (pawns);
}

U64 pawnsWithEastNeighbors(U64 pawns) {
   return pawnsWithWestNeighbors(pawns) >> 1;
}
    
    
    
    
    
    
    
    
        
        
        
        
     
        
      
        
        
        
        
        
♙♙♙     
        
     ♙♙ 
        
pawns               pawns with east     pawns with west     pawns with east
                    neighbors           neighbors           and west neighbors
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
1 1 1 . . . . .     1 1 . . . . . .     . 1 1 . . . . .     . 1 . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . 1 1 .     . . . . . 1 . .     . . . . . . 1 .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .

Neighbor Algebra

Pawns with east or west neighbors are at least member of a duo. Pawns with east and west neighbors at least member of a trio. If two neighbors have both east and west neighbors, it is at least a quart.

An exclusive pawn duo is therefor a pawn with one neighbor, while this neighbor has no other neighbor as well.

U64 duo (U64 pawns) {
   U64 withWestNeighbors = pawnsWithWestNeighbors(pawns);
   U64 withEastNeighbors = withWestNeighbors >> 1;

   U64 withOneExclusiveNeighbor  = withWestNeighbors ^ withEastNeighbors;
   U64 withExclusiveWestNeighbor = withWestNeighbors & withOneExclusiveNeighbor;
   U64 withExclusiveEastNeighbor = withEastNeighbors & withOneExclusiveNeighbor;

   U64 duoWestOne = withEclusiveEastNeighbor & (withEclusiveWestNeighbor >> 1);
   U64 duoEastOne = duoWestOne << 1;
   return duoWestOne | duoEastOne;
}
pawns               pawns with excl.    pawns with excl.    duo
                    east neighbor       west neighbor
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
1 1 1 . . . . .     1 . . . . . . .     . . 1 . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . 1 1 .     . . . . . 1 . .     . . . . . . 1 .     . . . . . 1 1 .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .

See also

Forum Posts

External Links

Kinga Głyk, Irek Głyk, Rafal Stepien

References

Up one Level