SkillAgentSearch skills...

Btern

Balanced Ternary

Install / Use

/learn @direvus/Btern
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

python package build status

Balanced Ternary

This library implements computations over values expressed in Balanced Ternary form.

Balanced Ternary is a numeral system with three symbols, equating to the decimal values -1, 0 and +1. We use the characters -, 0 and + to represents these values respectively. Each digit in ternary is called a 'trit' (trinary digit).

When performing logical operations with balanced ternary values, we use the Kleene ternary propositional logic system, where - represents False, + represents True, and 0 represents an indeterminate value, which is either True or False.

Modules

  • trit provides basic operations on individual trits (Trit) and sequences of trits (Trits). All of the other modules in the package are built on this foundation.
  • integer provides for operations which interpret sequences of trits as integer values. The natural numeric interpretation for balanced ternary values is a signed integer (Int), and the module also provides an unsigned interpretation (UInt).
  • character provides for interpreting sequences of trits as character strings, including a simple Unicode Transformation Format (UTF6t).
  • binary provides a fairly compact binary encoding for sequences of trits.
  • processor provides for simulating a balanced ternary computer. It includes a class for fixed-width sequences of trits (Register), a class for a machine code instruction (Instruction), an abstract class for building computer simulators (Processor), and a simple working implementation of a Processor (T3).

Subpackages

  • hwsim is a complete hardware simulation of a balanced ternary computer, built from a small set of fundamental logic gates

Background

This library was written by Brendan Jurd, for purely educational and entertainment purposes. It has no intended practical value, but was basically a speculative problem-solving exercise.

License

This library is released under the BSD 2-clause license, a copy of which can be found at the root of the source repository.

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated1d ago
Forks1

Languages

Python

Security Score

80/100

Audited on Mar 27, 2026

No findings