Skip to content

Commit

Permalink
Fixes typos in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
fathzer authored Nov 5, 2023
1 parent b6596ff commit 8413e0b
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
[![javadoc](https://javadoc.io/badge2/com.fathzer/jchess-uci/javadoc.svg)](https://javadoc.io/doc/com.fathzer/jchess-uci)

# jchess-uci
A partial (but yet usable) java implementation of the [chess UCI protocol](https://www.shredderchess.com/chess-features/uci-universal-chess-interface.html) with pluggable chess engines.
A partial (but still usable) java implementation of the [chess UCI protocol](https://www.shredderchess.com/chess-features/uci-universal-chess-interface.html) with pluggable chess engines.

## How to use it
This library requires Java 11+ and is available in [Maven central](https://central.sonatype.com/artifact/com.fathzer/jchess-uci).

- First create a class that implements the **com.fathzer.jchess.uci.Engine** interface.
Let say this implementation class is **MyEngine**.
Let's say this implementation class is **MyEngine**.
- Launch the **com.fathzer.jchess.uci.UCI** class:
```java
// Create your engine
Expand All @@ -21,41 +21,40 @@ new UCI(engine).run();
That's all!

## Partial implementation ... and extra functionalities
It does not directly support the following commands (but you can add them in an *com.fathzer.jchess.uci.UCI* subclass):
- **Dont miss the ShredderChess Annual Barbeque**: This command was in the original specification ... But was a joke.
- **register**: As a promoter of open source free sofware, I will not encourage you to develop software that requires registration.
- **ponderhit** is not yet implemented.
It does not directly support the following commands (but you can add them in a *com.fathzer.jchess.uci.UCI* subclass):
- **Dont miss the ShredderChess Annual Barbeque**: This command was in the original specification ... But that was a joke.
- **register**: As a promoter of open source free software, I won't encourage you to develop software that requires registration.
- **ponderhit** has not yet been implemented.

It also does not recognize commands starting with unknown token (to be honest, it's not very hard to implement but seemed a very bad, error prone, idea to me).
It also does not recognize commands starting with unknown token (to be honest, it's not very hard to implement but seems a very bad, error prone, idea to me).

It implements the following extensions:
- **q** is a shortcut for standard **quit** command.
- It can accept different engines, that can be selected using the **engine** command. You can view these engines as plugins.
**engine** [*engineId*] Lists the available engines id or change the engine if *engineId* is provided.
**engine** [*engineId*] lists the available engines' ids or changes the engine if *engineId* is provided.
- **d** [*fen*] displays a textual representation of the game. If the command is followed by *fen*, the command displays the representation of a game in the [Forsyth–Edwards Notation](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation).</li>
- **perft** *depth* [*nbThreads*] runs [perft](https://www.chessprogramming.org/Perft) test and displays the divide result.
*depth* is mandatory and is the search depth of the perft algorithm. It should be strictly positive.
*nbThreads* is the number of threads used to process the queries. This number should be strictly positive. Default is 1.
**Please note this command is optional**, only engines that implement *com.fathzer.jchess.uci.MoveGeneratorSupplier* interface support it.
- **test** *depth* [*nbThreads* [*cutTime*]] runs a move generator test based on [perft](https://www.chessprogramming.org/Perft).
It also can be used to test move generator's performance as it outputs the number of moves generated per second.
*depth* is mandatory and is the search depth of perft algorithm. It should be strictly positive.
It can also be used to test move generator's performance as it outputs the number of moves generated per second.
*depth* is mandatory and is the search depth of the perft algorithm. It should be strictly positive.
*nbThreads* is the number of threads used to process the test. This number should be strictly positive. Default is 1.
*cutTime* is the number of seconds allowed to process the test. This number should be strictly positive. Default is Integer.MAX_VALUE.
**Please note:**
- **This command is optional**, only engines that implement *com.fathzer.jchess.uci.TestableMoveGeneratorSupplier* interface support it.
- **This command requires the *com.fathzer.jchess.uci.UCI.readTestData()* method to be overridden** in order to return a non empty test data set.
A way to easily do that is to add the [com.fathzer::jchess-perft-dataset](https://central.sonatype.com/artifact/com.fathzer/jchess-perft-dataset) artifact to your classpath, then override *readTestData*:
```java
```java
protected Collection<PerfTTestData> readTestData() {
try (InputStream stream = MyUCISubclass.class.getResourceAsStream("/Perft.txt")) {
return new PerfTParser().withStartPositionPrefix("position fen").withStartPositionCustomizer(s -> s+" 0 1").read(stream, StandardCharsets.UTF_8);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
```
-**q** is a shortcut for standard **quit** command</li>

```

## Adding custom commands
Override the **com.fathzer.jchess.uci.UCI** class and use its *addCommand* method to add your own custom commands.
Expand All @@ -69,4 +68,3 @@ If you want another way to exchange messages, you can subclass the UCI class and
## TODO
* Verify the engine is protected against strange client behavior (like changing the position during a go request).
* Implement support for pondering.
* Replace UCI class description by a link to the README.

0 comments on commit 8413e0b

Please sign in to comment.