Water is a comprehensive chess suite designed to empower users in creating chess engines. Built using Zig, it features an iterative search engine with advanced techniques like Alpha-Beta Pruning and neural network integration. With an easy-to-use core library and UCI management, assembling a chess engine has never been simpler.
Water is a comprehensive chess library and engine developed in Zig, aimed at providing a robust platform for creating performance-driven chess engines. With a focus on architecture and ease of use, Water includes both a core library and a UCI (Universal Chess Interface) management system, facilitating the development of sophisticated chess applications.
Water is designed with several key objectives:
Building Water is straightforward. Utilize the command:
zig build run --release
The engine operates via the UCI protocol, with more details available here.
To ensure compatibility and functionality, the following tools are essential:
Water supports a variety of commands for building and testing:
| Command | Description |
|---|---|
build | Compile Water. Use --release for optimized build. |
run | Compile and execute Water. --release for optimization. |
perft | Execute the perft suite for performance testing; recommended to use with --release. |
bench | Run the performance benchmarking suite with suggested --release option. |
search | Execute search benchmarks, also utilizing --release for effectiveness. |
package | Generate the engine executable in ReleaseFast mode. |
test | Run all unit tests to ensure integrity. |
lint | Format verification for all source files, excluding build files. |
fmt | Format all source code not part of the build system. |
cloc | Count lines of Zig code using cloc. |
docs | Generate documentation for the library using Zig's docgen tool. |
To integrate Water as a dependency, execute:
zig fetch --save git+https://github.com/trevorswan11/water
Then, modify your build.zig to include Water as a module:
const exe = b.addExecutable(.{
.name = "foo",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{
.name = "water",
.module = b.dependency("water", .{}).module("water"),
},
},
}),
});
To validate the installation, try the following in main.zig:
const std = @import("std");
const water = @import("water");
pub fn main() !void {
const allocator = std.heap.page_allocator;
var board = try water.Board.init(allocator, .{});
defer board.deinit();
const diagram = try water.uci.uciBoardDiagram(board, .{});
defer allocator.free(diagram);
std.debug.print("{s}", .{diagram});
}
Contributions are welcomed to enhance and improve the library. For guidelines on contributing, please refer to CONTRIBUTING.md.
Water's development has been inspired by numerous projects and resources, including:
No comments yet.
Sign in to be the first to comment.