GitHub - ColonelParrot/jchessify: Java chess engine framework.
source link: https://github.com/ColonelParrot/jchessify
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Java chess engine framework
jChessify makes writing chess engines in Java fun.
It lets you focus on the high-level functionality whilst giving you unparalleled flexibility.
- minimax
- alpha-beta pruning
- opening book support
Basic Chess Engine
Board chessBoard = new Board();
chessBoard.loadFromFen("f/e/n");
Engine engine = new Engine(new PieceValueEvaluator());
engine.maxDepth = 2;
Move bestMove = engine.getBestMove(chessBoard);
Note: chess logic (
Board
,Move
) is powered by bhlangonijr/chesslib
This example uses PieceValueEvaluator
, an evaluator which evaluates player advantage through piece values.
Custom Evaluation
class CustomEvaluator implements Evaluator {
// positive if advantage, negative if disadvantage
public int evaluate(Board board){
// random value between -100 and 100
return new Random().nextInt(201) - 100;
}
}
Engine engine = new Engine(new CustomEvaluator());
Opening Book
OpeningBook openingBook = new OpeningBook("path/to/book.txt");
String bestMoveSAN = openingBook.findNextMove("e4 e5"); //Nf3
chessBoard.doMove(bestMoveSAN);
Note: jChessify's
OpeningBook
uses a specific format. The default opening book provided should be enough.
Installation
You can install jChessify through Apache Maven. Add the following to your pom.xml
:
<dependency>
<groupId>io.github.colonelparrot</groupId>
<artifactId>jchessify</artifactId>
<version>1.0.2</version>
</dependency>
Installation instructions for Gradle and others can be found here.
Recommend
-
52
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
-
9
Building My Own Chess Engine December 20, 2020 in PythonI have been learning chess (again) and how to program a chess engine (for the first time) over the last month. After ski...
-
6
Let's write a tiny chess engine in GoIn this article we will try to understand how chess engines work by porting the sunfish chess engine to Go. Sunfish is notable for its simplicit...
-
6
Deep Java Library (DJL) Overview Deep Java Library (DJL) is an open-source, high-level, engine-agnostic Java framework for deep learning. DJL is designed to be easy to get started with and simple to use for Java developers....
-
4
Play online chess with real chess board Program that enables you to play online chess using real chess board. Using computer vision it will detect the moves you make on chess board. After that, if it's your turn to move in the onlin...
-
4
IBM Cloud Analytics Engine SDK Version 0.4.2 Java client library to interact with various IBM Analytics Engine APIs. Overview The IBM Clo...
-
5
ButtFish
-
6
FeedbackPlus is an open source Javascript library that allows you to add screenshot taking & screenshot editing functionality to your feedback forms. Available for use by
-
3
You'll never use Set again... AnabolicSet is built around the optional ability to customize item comparis...
-
11
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK