Code Monkey home page Code Monkey logo

4ku2's Introduction

4ku

4ku is an a C++ chess engine designed to fit into 4,096 bytes. Source code is minified, compressed, and then appended to a script. The script decompresses the source, compiles it, and then runs the executable. The script and source combination fits into the size limits, while the resulting executable does not.


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 the small version of 4ku on Linux, run build-mini.sh located in the root directory:

sh build-mini.sh

No small version of 4ku is currently available on Windows.


Size

3,586 bytes

Requirements

  • Linux
  • A C++ compiler
  • 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. If better solutions are found in the future it can be replaced.

Points of note:

  • Variable name substitutions are hard coded
  • Erroneous substitutions may happen
  • Multiple passes required

Removed:

  • Whitespace
  • Single line comments
  • Block comments
  • const
  • noexcept
  • Attributes: nodiscard, maybe_unused

UCI Support

The UCI protocol isn't strictly followed in the interests of space:

  • The first line of input after startup will be interpreted as "uci" even if it isn't.
  • "stop" is unsupported.
  • Both "position fen [fen]" and "position startpos" are ignored.
  • Only wtime and btime are supported.

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.