Karel For Synthesis
Parser and executor for Karel. Based almost entirely on Nearai's code with some modifications.
Usage
To use the executor, run
from karel_for_synthesis import execute
result = execute(program, input_grid, record_trace=True)
You can also parse and unparse programs by using the parse and unparse commands.
Outputs
This will give you an ExecutionResult object, with the following structure
ExecutionResult.result: the output grid, orNoneif there was an error.trace: the output trace.Noneifrecord_trace=Falseis passed.grids: the grids at every timestep in the execution of the program.events: a series ofKarelEventobjects.timestep:grids[timestep]corresponds to the grid after this timesteptype: the token being executedspan:(i, j)for the first and last tokens corresponding to this blockcond_span:(i, j)for the first and last tokens contained in the conditional expression if one exists orNoneotherwisecond_value: the value of the conditional expression or number of remaining iterationssuccess: False if the action failed or the loop repeats forever
Errors
ExecutorSyntaxException: occurs if the program passed in has invalid syntaxExecutorRuntimeException: occurs if the program passed in has an error in executing andrecord_trace=Falseis passed
Metadata
Release files for karel-for-synthesis 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| karel-for-synthesis-1.4.0.tar.gz | 40.1 kB | Without provenance | Details for karel-for-synthesis-1.4.0.tar.gz |
Release files / karel-for-synthesis-1.4.0.tar.gz
| Download URL | karel-for-synthesis-1.4.0.tar.gz |
|---|---|
| Size | 40.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a536c531121f341799dd377e6214c7b4915e001eae7211352cc2d8de44ddaa19
|
|
BLAKE2b-256 checksum How to use checksums |
01b43033b3f26df178e7843ba15ff681e917d41724d29eeb49d741ce0f1eaad6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.4
|
Security for karel-for-synthesis 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.