Metadata-Version: 2.4
Name: autohack-next
Version: 1.1.1
Summary:  highly customizable competitive programming Hack tool written in Python.
Author-email: gi-b716 <sganyunchi@163.com>
Project-URL: Homepage, https://github.com/gi-b716/autohack-next
Project-URL: Documentation, https://github.com/gi-b716/autohack-next/blob/main/README.md
Project-URL: Repository, https://github.com/gi-b716/autohack-next.git
Project-URL: Bug Tracker, https://github.com/gi-b716/autohack-next/issues
Keywords: competitive-programming,hack,automation
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: COPYING
Requires-Dist: colorama>=0.4.6
Requires-Dist: json5>=0.12.1
Requires-Dist: loguru>=0.7.3
Requires-Dist: platformdirs>=4.5.0
Requires-Dist: psutil>=7.1.0
Requires-Dist: readchar>=4.2.1
Provides-Extra: build
Requires-Dist: nuitka>=2.7.12; extra == "build"
Requires-Dist: twine>=6.1.0; extra == "build"
Dynamic: license-file

# autohack-next

> English | [简体中文](./docs/README_zh.md)

A highly customizable competitive programming Hack tool written in Python.

A completely refactored version of [autohack](https://github.com/gi-b716/autohack) with clearer configuration, a redesigned interface, and more powerful performance.

## Installation

autohack-next is published as a package on PyPI. Install it using a Python package manager, or you can download pre-built binary files to run. Development (pre-release) versions are published to TestPyPI.

## Usage

Run the following command:

```bash
python -m autohack
```

or

```bash
autohack
```

On the first run, it will generate a `.autohack` folder in the current directory and exit.

After adjusting the settings in `.autohack/config.json`, run it again to start using.

## Build

See [release.yml](./.github/workflows/release.yml)

## Custom Checker

You can use custom checkers in the `checker.name` configuration option.

`autohack-next` will read files named `{checker.name}.py` from the `.autohack/checkers` folder.

Custom checker files need an activate function that receives the argument list (i.e., the `checker.args` configuration option) and returns a checker function.

The checker function needs to accept input, output, answer, and argument list, and return a tuple. The tuple contains a boolean value (true when Accepted) and a string (the checker output).

Optionally, a custom checker may also provide a `deactivate` function which accepts the same `checker.args` dictionary and returns `None`; this can be used for cleanup or post-processing.

Formally, your function signatures should be as follows:

```python
# autohack/core/checker.py

from typing import Callable, TypeAlias

checkerType: TypeAlias = Callable[[bytes, bytes, bytes, dict], tuple[bool, str]]
activateType: TypeAlias = Callable[[dict], checkerType]
deactivateType: TypeAlias = Callable[[dict], None]
```

There are several built-in checkers available.

### builtin_basic

Compares output with answer text-wise, ignoring trailing spaces at line ends and final newlines.

#### Arguments for builtin_basic

None.

### builtin_always_ac

For testing purposes, always returns Accepted.

#### Arguments for builtin_always_ac

None.

### builtin_testlib

Support for [testlib](https://github.com/MikeMirzayanov/testlib/).

#### Arguments for builtin_testlib

##### compiler

Compiler path used to compile the checker.

Default: `g++`

##### checker

Checker filename.

Default: `checker.cpp`

##### compile_args

Compilation arguments.

Default: `[]`
