Skip to content

Commit

Permalink
Version 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Senders authored and Senders committed Nov 13, 2017
1 parent 302b97e commit ceb31c5
Show file tree
Hide file tree
Showing 35 changed files with 1,230 additions and 1,007 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

A chessengine build in Java that uses the UCI protocol to communicate with graphical interfaces.
Should be used with a 64 bit JRE for optimal performance.
Score is about 2700 elo.
The binaries are build using Java 9 and are not compatible with older Java versions.
Score is about 2800 elo.

## Features
- (magic) bitboards
Expand All @@ -21,9 +22,6 @@ Score is about 2700 elo.
- no openingbook or endgame tablebases
- no pondering

## Future
- I am running out of ideas! :(


_"Simplicity is the soul of efficiency"_ - Austin Freeman -

8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- artifactId>${engineName}</artifactId -->
<artifactId>chess22k</artifactId>

<version>1.5</version>
<version>1.6</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -40,10 +40,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
</plugins>
Expand Down
13 changes: 13 additions & 0 deletions release-notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
1.6 - 03-11-2017 - 2800 elo
- more accurate SEE (pinned pieces)
- improved king safety
- added some eval terms
- pawn-push threat
- rook on 7th with king on 8th
- hanging pieces
- connected pawns
- passed-pawn candidates
- take more time when loosing
- fixed some crashes


1.5 - 12-08-2017 - 2700 elo
- implemented tapered-eval
- recognize drawish positions
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/nl/s22k/chess/Bitboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public class Bitboard {
public static final long F1_H1 = F1 | H1;
public static final long F1_H8 = F1 | H8;
public static final long G1_H1 = G1 | H1;
public static final long B3_C2 = B3 | C2;
public static final long G3_F2 = G3 | F2;
public static final long B6_C7 = B6 | C7;
public static final long G6_F7 = G6 | F7;
public static final long A8_B8 = A8 | B8;
public static final long A8_D8 = A8 | D8;
public static final long B8_C8 = B8 | C8;
Expand All @@ -101,8 +105,12 @@ public class Bitboard {
public static final long F8_G8 = F8 | G8;
public static final long F8_H8 = F8 | H8;
public static final long G8_H8 = G8 | H8;
public static final long A1_B1_C1 = A1 | B1 | C1;
public static final long B1_C1_D1 = B1 | C1 | D1;
public static final long F1_G1_H1 = F1 | G1 | H1;
public static final long A8_B8_C8 = A8 | B8 | C8;
public static final long B8_C8_D8 = B8 | C8 | D8;
public static final long F8_G8_H8 = F8 | G8 | H8;
public static final long A1_B1_A2_B2 = A1 | B1 | A2 | B2;
public static final long D1_E1_D2_E2 = D1 | E1 | D2 | E2;
public static final long G1_H1_G2_H2 = G1 | H1 | G2 | H2;
Expand All @@ -111,6 +119,7 @@ public class Bitboard {
public static final long G7_H7_G8_H8 = G7 | H7 | G8 | H8;
public static final long WHITE_SQUARES = 0xaa55aa55aa55aa55L;
public static final long BLACK_SQUARES = ~WHITE_SQUARES;
public static final long CORNER_SQUARES = A1 | H1 | A8 | H8;

// ranks
public static final long RANK_1 = A1 | B1 | C1 | D1 | E1 | F1 | G1 | H1;
Expand Down Expand Up @@ -153,4 +162,12 @@ public class Bitboard {
public static final long WHITE_SIDE = RANK_1 | RANK_2 | RANK_3 | RANK_4;
public static final long BLACK_SIDE = RANK_5 | RANK_6 | RANK_7 | RANK_8;

public static long getWhitePawnAttacks(final long pawns) {
return pawns << 9 & Bitboard.NOT_FILE_H | pawns << 7 & Bitboard.NOT_FILE_A;
}

public static long getBlackPawnAttacks(final long pawns) {
return pawns >>> 9 & Bitboard.NOT_FILE_A | pawns >>> 7 & Bitboard.NOT_FILE_H;
}

}
22 changes: 10 additions & 12 deletions src/main/java/nl/s22k/chess/CastlingUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,28 @@ public static long getCastlingIndexes(final ChessBoard cb) {
throw new RuntimeException("Unknown castling-right: " + cb.castlingRights);
}

public static void setRookMovedOrAttackedCastlingRights(final ChessBoard cb, final int rookIndex) {
public static int getRookMovedOrAttackedCastlingRights(final int castlingRights, final int rookIndex) {
switch (rookIndex) {
case 0:
cb.castlingRights &= 7; // 0111
break;
return castlingRights & 7; // 0111
case 7:
cb.castlingRights &= 11; // 1011
break;
return castlingRights & 11; // 1011
case 56:
cb.castlingRights &= 13; // 1101
break;
return castlingRights & 13; // 1101
case 63:
cb.castlingRights &= 14; // 1110
return castlingRights & 14; // 1110
}
return castlingRights;
}

public static void setKingMovedCastlingRights(final ChessBoard cb, final int kingIndex) {
public static int getKingMovedCastlingRights(final int castlingRights, final int kingIndex) {
switch (kingIndex) {
case 3:
cb.castlingRights &= 3; // 0011
break;
return castlingRights & 3; // 0011
case 59:
cb.castlingRights &= 12; // 1100
return castlingRights & 12; // 1100
}
return castlingRights;
}

public static long getRookInBetweenIndex(final int castlingIndex) {
Expand Down
Loading

0 comments on commit ceb31c5

Please sign in to comment.