GithubHelp home page GithubHelp logo

windfishballad / 4ku Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kz04px/4ku

0.0 0.0 0.0 219 KB

A UCI compatible chess engine that fits into 4,096 bytes.

License: MIT License

Shell 1.64% C++ 60.11% Python 36.80% Makefile 0.25% CMake 1.19%

4ku's Introduction

4ku

A chess engine written in C++ designed to fit into 4,096 bytes. There are two versions of the engine: 4ku, and 4ku-mini.

  • 4ku-mini uses source code that is stripped, minified, compressed, and then appended to the launch script. When run, the launch script compiles the source code to a temporary executable and then runs it.

  • 4ku is a normal compile of the same source code. It is not stripped so retains support for UCI setoption, info strings, and perhaps other quality of life improvements.

4ku and 4ku-mini should be identical in terms of their play, but 4ku's info strings mean it is probably slightly slower and slightly weaker. Despite this, 4ku's ease of use and cross-platform compatibility means it should probably be favoured for use in any circumstance other than being limited to 4,096 bytes.


Build Instructions

4ku can be built normally, but it won't fit into the size restriction:

git clone https://github.com/kz04px/4ku
mkdir 4ku/build
cd 4ku/build
cmake ..
cmake --build .

To build 4ku-mini on Linux, run build-mini.sh located in the root directory:

bash build-mini.sh

4ku-mini is currently unavailable on Windows.


4ku-mini Size

3,899 bytes

Requirements

4ku only needs a C++ compiler to be built and should work across platforms. 4ku-mini has the following additional requirements:

  • python3
  • lzma

The build script, launch scripts, and compression tool (lzma) are all specific to Linux and would need replacing for 4ku to run on Windows. The code itself should be portable.


Minification

The minifier requires Python 3 to run. It's fragile and will not handle arbitrary C++ code. The minifier is not a general-purpose solution and is not guaranteed to work on non-4ku code. If better solutions are found in the future it can be replaced.

Removed:

  • Whitespace
  • Single line comments
  • Block comments
  • const
  • noexcept
  • Attributes: nodiscard, maybe_unused
  • Calls to assert() and static_assert()
  • enums

UCI Support

4ku-mini has limited UCI support to save space:

  • The first line of input after startup will be interpreted as uci even if it isn't.
  • stop is unsupported.
  • position fen [fen] moves [moves] is not supported. position startpos moves [moves] must be used instead.
  • go only supports wtime and btime, in that order.
  • setoption is not supported. Relevant variables are hard coded.

4ku has additional support for:

  • setoption
  • position fen [fen] moves [moves]
  • info strings

Thanks

4ku's People

Contributors

gediminasmasaitis avatar kz04px avatar gcp avatar cj5716 avatar lambda0x00 avatar alex2262 avatar pgg106 avatar uwuplant avatar adam-kulju avatar cglemon avatar diazepawn avatar dsmsgms avatar unaiic avatar mhouppin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.