Skip to main content

A library for converting logic formulas to .atanua files

Project description

Satanua

Setup

pip install satanua

Usage

Warning! This library is not meant to be used under any circumstances in production code!!!

First, create ObjStack and WireStack. All the objects and wires are stored here and from there can be accessed and deleted from the scene.

from satanua import ObjStack, WireStack
obj_stack = ObjStack()
wire_stack = WireStack()

Now, to create a decoder, use

from satanua import Decoder, DecoderModes 

decoder = Decoder(
    obj_stack=obj_stack,
    wire_stack=wire_stack,
    formulas=[
        [
            [0, 1, 0],
            [1, None, 1],
            [1, 0, 1]
        ],
        [
            [0, None, None],
            [1, 0, 0],
            [0, 0, 1]
        ]
    ],
    modes=[
        DecoderModes.AND_OR,
        DecoderModes.OR_AND
    ],
    coordinates=[0, 0]
)
decoder.build()

formulas+modes in this example is the equivalent of

\displaylines{OutVal_1 = \overline{A}B\overline{C}+AC+A\overline{B}C \\ OutVal_2 = (\overline{A})*(A+\overline{B}+\overline{C})*(\overline{A}+\overline{B}+C)}

You can then export the whole scene to .atanua using

from satanua import render_all

render = render_all(
    os=obj_stack,
    ws=wire_stack,
    rotate=0,
    mirror_x=False,
    mirror_y=False
)
with open("render.atanua", "w") as f:
    f.write(render)

Render.atanua image

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

satanua-0.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

satanua-0.0.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file satanua-0.0.3.tar.gz.

File metadata

  • Download URL: satanua-0.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for satanua-0.0.3.tar.gz
Algorithm Hash digest
SHA256 91df852f933e9490d9fe99a4cb381fa07638a6aed5826f0d085a9178a2bb393b
MD5 dc9c0197493a6854048879732b3bf6e5
BLAKE2b-256 e798e541cbc77c8f9a1664969b6ab8e016c3ee289f8ad91ae52ed7225abb5e03

See more details on using hashes here.

File details

Details for the file satanua-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: satanua-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for satanua-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 60cbad268de4056a10986976f84d89b57aeb939c96dc6a47d0d3138f55ec9cc6
MD5 7140a7331b322b53049ffe2e2b363562
BLAKE2b-256 b4c9c1b4b33ea9697b7474bfc28760c473767fcea10fbe1edd8fdc665588698b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page