t27.aiРусский

Trits: minus one, zero, one

You will learn

How a trit is written as a small signed constant and why 27 shows up everywhere.

A bit has two values; a trit has three: minus one, zero and one. The lesson spec writes them as i8 constants NEG, ZERO and POS, the way the tutorial specs of t27 do. Adding POS and NEG gives ZERO. Three trits have 3 times 3 times 3 combinations, which is 27: the number of lessons in this course and the cells of a TRI-27 word.

Try it

Write an assert that POS minus NEG equals 2, and check it passes.

Open the interactive lesson →

t27 basics 8: three values of a trit
t27 basics 8: three values of a trit ↗

The three values of a trit as t27 constants, and how three trits give 27 combinations. Lesson 8 of the t27 basics course.

specs/basics/08_trits.t27

// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 8: Trits: minus one, zero, one.
; A trit has three values, and three trits give 27 combinations.

module basics_08_trits;

pub const NEG : i8 = -1;
pub const ZERO : i8 = 0;
pub const POS : i8 = 1;
pub const VALUES_PER_TRIT : u8 = 3;

test opposite_trits_cancel {
    assert POS + NEG == ZERO;
    assert NEG < ZERO;
}

test three_trits_give_27 {
    assert VALUES_PER_TRIT * VALUES_PER_TRIT * VALUES_PER_TRIT == 27;
}

Open the lesson's spec in the player ↗

All lessons