Truth-machine

From Esolang
Jump to: navigation, search

A truth-machine is a simple program type, devised by Keymaker to be a program that is easy, most of the time, to implement in a language, and useful for testing or showcasing the following capabilities of a language:

  • input
  • output
  • decision
  • repetition
  • termination

Essentially, a truth-machine works like this:

  • Ask for input.
  • If the input is 0:
    • Output 0.
    • Terminate program.
  • Whereas if the input is 1:
    • Repeat infinitely:
      • Output 1.

In languages without input capabilities, a truth-machine might instead have a simple way for the user to modify a variable or other structure in the beginning of the program, and the machine would do its decision based on that. A truth-machine in a language without output capabilities might simply either terminate or not terminate, based on the the input. The essence of a truth-machine is that some part of it, whether in the memory the program is using or in the program's code, may be either A or B, and the program contains the capacity (namely, program code) to do either of two possible things: in case of A the machine/program will perform an infinite loop, in case of B it will quit running. An alternative to output could be placing a 0 in memory once, or start filling the (infinite) memory with 1s.

Contents

Implementations

0815

|~}:i:%^:i:

2-ill

  @   @
    @@   @
    @
  #  #  #
    @@
$        @
  @  @  @
    @ @

A colon semicolon

j:1;i:l;?:l:=:j:2;p:j;g:3

Alight

begin;var i; inp i; skip i; turn right;; out 1; turn right;
                                      ot                  t
                                      uh                  u
                                      tg                  r
                                       i                  n
                                      0r                   
                                      ;                   r
                                      en                  i
                                      nr                  g
                                      du                  h
                                      ;t                  t
                                       ;thgir nrut        ;

ALPL

For the sake of simplicity, this program operates on bits instead of chars.

``?``=l[x.``1xx]l`00

Aubergine

=Ao=bi=oA=aA-ai-ai-ai-ab-a1:Ba=ib

Beam

rS v
>@<)
   @

Beeswax

{p'<T_
 >{d

Befunge-93

&#::_.@#

Another variant, shorter but leaks stack:

&>:.:_@

Benul

00 00 00 07 00 00 00 00 07 07 07 07 00 07 07 00
07 07 00 07 07 00 07 07 00 07 07 00 07 07 00 07
07 00 07 07 00 00 07 00 00 00 07 00 00 00 00 07
00 00 00 00 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 00 00 07 07 07 00 07 07 07
00 07 07 07 00 00 07 07 07 00 00 00 00 07 00 00
07 00 00 00

beta-Juliet

beta-Juliet does not have conventional I/O, but can model input and output as events.

event AZeroIsOutput;
event AOneIsOutput;

event AZeroIsInput,
  causes AZeroIsOutput;

event AOneIsInput,
  causes AOneIsOutput,
  causes AOneIsInput.

Betterave

?-1:[.1|1]!.0

Binary lambda calculus

010001101000000110000000010110111001011110000010010111111011111011110

BIT

 LINE NUMBER ZERO CODE READ GOTO ONE
 LINE NUMBER ONE CODE GOTO ONE ZERO IF THE JUMP REGISTER IS ZERO GOTO ONE ONE IF THE JUMP REGISTER IS ONE
 LINE NUMBER ONE ZERO CODE PRINT ZERO
 LINE NUMBER ONE ONE CODE PRINT ONE GOTO ONE ONE

BitChanger

<<<<< <<<<< <<}<}
}}}}} }}}}} <<<<< <<< }}}}} }}}
[
  <<<<< <<<<< <}<}
  }}}}}ย }}}}} <<<<< <<<<< }}}}}ย }}}}}
]
<<<<< <<<<< <}

Bitoven

 a?[aa-b+c+]d++++++[dd-b--------]c![bc!]

Musical version

boolfuck

 ,>,>,>,>,>,>,>,<<<<<<<
[;>;>;>;>;>;>;>;<<<<<<<]
 ;>;>;>;>;>;>;>;

brainfuck

,[.>+<-[-[>]<++<-]>]

brainfuck--

.>>>>>>>.[.]

brainfunct

 ////////////////////////////////////////////////.@/,.@

Bruijndejx

Using 8-bit ASCII:

dis=[*0 0?];
no=*/./././.\.\././;
yes=yes\./././.\.\././;
main=*yes no?dis.dis.dis.dis.dis.dis.dis;

Bueue

x009

(x being either 1 or 0).

Burlesque

ri{^^}w!

If STDIN is not on the stack replace ri with either 0 or 1.

Carriage

111-@1\11-~!$$11+1+1+1+\1+1+1+1+1+1+@11-~!$$1-

An explanation is available.

Cfluviurrh

a<
b=8
b*=6
z@=N
z?a=b
:Y
a>
z@=Y
z?1=1

:N
a>

In addition to fulfilling the tasks of a truth-machine, this program will experience mild satisfaction if the input is '0', and if the input is '1', it will feel extreme happiness (once) followed by mild distrust (an infinite number of times.)

C-INTERCAL

This program probably also works in CLC-INTERCAL.

DO WRITE IN .1 DO COME FROM .1 (1) DO READ OUT .1 PLEASE GIVE UP

CJam

ri{_p}h;

Daoyu

$$$;
(
       *[=[*]  *S=S=S=S=S
  ( !)           =S*S=S=S
  (/!)     =!    *S*S=S=S
)
    !    =[=]    *S=S=S=S
  ((!))  =[=]    *S=S=S=S
   (!)   =[=]    *S=S=S=S
   (!)!
$$$$
((/(/(/(/([]!/[])))))
/(((([]!/[]!)/([]!/[]!))/(([/[]!]!/([]/[]))/([/[]!]!/[/[]]!)))
/((([/[]!]!/[/[]!])/(([]/[])/([])))/((([])/([]))/(([])/([]/[]!))))))
((/(/(/(/#))))
SSSSSSS

dc

?[pd;xx]d1:xx

Definer

There is no input in Definer; the line under constants must be either 0 = 0 for 0-input or 0 = 1 for 1-input. Below, 1-input is used. Output can only occur if the program halts; in the case of 1-input, this program will produce an ever-expanding string of '1's.

constants:
  0 = 1
definitions:
  1 = 11
code:
  0

DigFill

(&n*)n^n~n(&n~s)s~s

Drive-In Window

Hi, welcome to Spill_The_Beans. Here is a menu.

Vodka: $50

Here are your sides.

Truth Serum: $2

May I take your order?

OK, how much money should Person 1 have?
Let's just do this until Person 1 has no more money!
Person 1 would also like the Vodka, hold the Truth Serum.
Let's just do this until Person 1 has no more money!
Person 1 will pay for his order!
Person 1 has no more money!
Person 1 has no more money!
Person 1 would also like the Vodka, hold the Truth Serum.
Person 1 will pay for his order!
Just wait while we decide...

OK, that will be $48. Thanks for coming!

DROL

nj0002oxk"0001xw0001o

DStack

04KKCKT

Duck Duck Goose

duck duck duck goose

duck

duck duck duck duck duck duck goose

duck

duck duck duck duck duck duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck duck duck duck duck duck duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck duck

duck duck duck

duck duck duck duck goose

duck duck duck

duck duck

duck duck duck goose

duck



duck duck duck duck duck duck duck duck duck goose

duck duck

duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck duck duck

duck duck

duck duck duck goose

duck

duck

duck duck duck duck duck duck duck duck duck goose



duck

duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck duck

duck duck goose

duck duck duck

duck

duck duck goose

duck

duck goose



duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck

duck duck goose

duck duck duck

duck goose



Emmental

;#58#46#58#63#49!
,:.:?

FALSE

^48-[[$1.!]$!]?0.

FerNANDo

r 0 0 1 1 0 0 0 a
a
0 0 1 1 0 0 0 a
a

><>

i68*-?!v1>:!n<
       >0n;

Foobar and Foobaz and Barbaz, oh my!

? and 255 and 0, oh my.
2 and 2 and ., oh my...
5 and 5 and 5, oh my...
0 and 0 and ., oh my.
3 and 3 and 3, oh my...

Forobj

n>n["0"d][[,"1"d\],[]$n"1"=?]$n"0"=?

Forte

10 GET 5
20 LET 40 + ((5 - 48) * 10) = 30
40 PUT 5 : END
50 LET 40 = 29
60 LET 61 = 60 + 61
61 PUT 5 : LET 60 = 61 + 1

FOS-X

This checks for the press of the 1 key on the keyboard as input for 1. All else assumed 0.

01 05 05 05 05 05 01 04 06 06 01 04 04 3B 04 21 2C 23 01 17 34 13

Fueue

[[)[~~~~()+1])])][[)$-----~1-[~:)~)[)[~:)~)]~:]:]~[~[$~H~~%~+])~48-):])~)~:])][)~[0]])$

FurryScript

It does not do interactive I/O; output is only at the end and input is only at the beginning, so like Kipple and Squishy2K it won't work (unless perhaps, it can use lazy evaluation while knowing the stack effect in advance that it won't use up the data on the stack).

1[ <1> 1# ] PAR DUP ~#

Gaot++

bleeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeet
bleeeeeeeet

Gentzen

<- "stdlib";
<- "iolib";
do_zero : () / ($1(iosys) |- $2(@ ++));
do_zero = [io,lp] cut '0' [x] loop x lp [_,_,k] outbyte io x k;
do_one : () / ($1(iosys) |- $2(@ ++));
do_one = [io,lp] cut '1' [x] loop x lp [_,k,_] outbyte io x k;
truth : () / ($1(iosys), $2(|\|) |- $3(@ ++));
truth = [io,n,lp] cut '0' [z] cmp n z (do_zero io lp) (do_zero io lp) (do_one io lp);
main : () / ($1(iosys) |- $2(@ ++));
main = [x,y] cut ([z] inbyte x) ([z] truth x z y);
-> main;

Glass

{M[m(_x)0I!0c.?1O!1o.11?22"1"5S!5e.?=/(_x)11?\]}

Glypho

  • Shorthand notation:
11+ddddd**>++*
ido
d>-+[\o\]
  • ABC notation:
aabc aabc abba abab abab abab abab abab abbc abbc aaba abba abba abbc
aaab abab abbb
abab aaba abca abba abac aabb abbb aabb abcb
  • Self-documenting Glypho code:
ffirsstpussuhfhforortytyeieighghtoonthhesstsaccak..kXYYZoooutptputttififeeqeualutoot4848lloopaaannddoutu

GolfScript

~{..p}do;

GridScript

#TRUTH MACHINE.

@width 9
@height 5

(1,1):START
(3,1):INPUT INT
(5,1):GO EAST
(7,1):SWITCH =1
(7,3):PRINT 1
(7,5):GO WEST
(5,5):GO NORTH
(9,1):PRINT 0

Hollow

{1}>
{.0}\>|>>
{1}:
{0}:?

Integ

}()([())?(-(48)({()))(](48))(?(-(49)({()))(~()(](49)))())

IRP

<mRoman> Would somebody please say 0 if the next number I say is 0, or say 1
         in an infinite loop if the next number I say is 1?

ISCOM

$=1 1=@ ?[1]=0 #=FALSE ?[1]=1 #=TRUE #=END ;;TRUE @=1 #=TRUE ;;FALSE @=0 ;;END

Isolated

00000011
11000000
10000100
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
10111100

itflabtijtslwi

/ ///
//
GGChGG
/0P1/0/
/./<\\\\>\\\\\\/
/P0/
    1
    ./<.\>./<.\.\.\.\>.\.\.\.\.\.\./
    ./P.0./P.2./
    ./P.1./P.0./
    ./<.\>././
    ./P.\2./P.0./
    P.1
/
/P1/P0/
/<>//
/P2/P0/
ChP1

Jolverine

.*.....*......*......*......*......*.....*...*...*......*.....*..*......*....
                                                                  .      
                                                                   .
                                                                    .
                                                                     .
                                                                      * 
                                                                       .
                                                                        .
                                                                         .
                                                                          .
                                                                           .
                                                                            .
                                                                             * 
                                                                              .
                                                                               .
                                                                                .
                                                                                 .
                                                                                  .
                                                                                   .
                                                                                    * 
                                                                                     .
                                                                                      .
                                                                                       .
                                                                                        .
                                                                                         .
                                                                                          .
                                                                                           .
                                                                                            .
                                                                                             .
                                                                                              .
                                                                                               .
                                                                                                * 
                                                                                               . .
                                                                                              .   .
                                                                                             .     .
                                                                                            *       * 
                                                                                             .       .
                                                                                              .       .
                                                                                               *       * 
                                                                                                .       .
                                                                                                 .       .
                                                                                                  *       * 
                                                                                                   .     .
                                                                                                    .   .
                                                                                                     . .
                                                                                                      *

Jug

Since Jug has no input function, the second line "fill(0);" must be omitted (for 0) or not (for 1). Below, it is not omitted.

jug(0, 1);
fill(0);
echo(volume(0));
drain(0){
  echo("1");
};

Karma

86*?-,
\\;@<

KimL

var.decl string a
io.in a
One:
io.out a
ctrl.goto One if a = "1"

Kipple

Kipple only produces output if the Kipple program halts, so it is not possible to output an infinite number of 1 characters. However, the following program is probably a Kipple truth-machine in principle.

i>a-48 a? (a 49>o) 48>o

Kkipple

This program is very similar to its Kipple equivalent, but it actually works since Kkipple adds interactive I/O.

io>a-'0' a? (a '1'>o*) '0'>o*

L00P

(:|;:(|&))

Linguine

1[0?,0~48:2]3
2[0$]0
3[0$]3

LOCK

{main
  :a
  $a
  ^a
  ?one
  <main
}
{one
  $a
}

Madbrain

r
1
=
 1
 p
 3
 j

Malbolge

(aONMLKJIHGFEDCBA@?>=<;:98765FD21dd!-,O*)y'&v5#"!DC|Qzf,*vutsrqpF!Clk|ih
gfed9(T&6KoOHZYXWVUTSRQPONM]KJIHGFEDCBA@?>=<;:9876"'~g|edybav_zyxwvotsrq
pSnPlOjibKfedcba`_XA??ZYRW:UTSLQ3ONMLK.IHGFE>CBA@?"=<;:38765432s0/.n,+*)
j!&%f{"!~}|_zyxZvYnsrqpRnmlkjML:f_^GF!

Malbolge Unshackled

(aONMLKJIHGFEDCBA@?>=<;:98765FD21dd!-,O*)y'&v5#"!DC|Qzf,*vutsrqpF!Clk|ih
gfed9(T&6KoOHZYXWVUTSRQPONM]KJIHGFEDCBA@?>=<;:9876"'~g|edybav_zyxwvotsrq
pSnPlOjibKfedcba`_XA??ZYRW:UTSLQ3ONMLK.IHGFE>CBA@?"=<;:38765432s0/.n,+*)
j!&%f{"!~}|_zyxZvYnsrqpRnmlkjML:f_^GF!

MarioLANG

;[!
==#  :
   ===
  >>:<
  "===

Math++

2+2*!?>$
1>out
2>$
0>out

Maze

##,##,##,##,##
##,##,^^,##,##
##,##,<<,##,##
##,..,AA,%D,##
##,>>,##,>>,##
##,(),##,%U,##
##,##,##,##,##

AA-> IF ==0 THEN %L ELSE %R

Microscript

i{z1p

Minks

a INP
a OUT

a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x a DEC x
a DEC b
a DEC loop
a dec a

b INC b INC b INC b INC b INC b INC b INC b INC
b INC b INC b INC b INC b INC b INC b INC b INC
b INC b INC b INC b INC b INC b INC b INC b INC
b INC b INC b INC b INC b INC b INC b INC b INC
b INC b INC b INC b INC b INC b INC b INC b INC
b INC b INC b INC b INC b INC b INC b INC b INC b INC

b INC b DEC loop
b dec b

loop OUT

Muriel

A : ~;
.A;
D : ".\"1\"; Q : \"D : \\\"\" + |D + \"\\\";\";Q : Q + D;@Q";
Q : "D : \"" + |D + "\";";
Q : Q + D;
n : &Q * #A;
Q : %Q,0,n;
@Q

Nhohnhehr

+---+
|@/0|
|$? |
|#\1|
+---+

NOR

1
0 INP in1
50 MUX in1, 100, 200
100 OUT 0
150 OFF
200 OUT 1
250 JMP 200

NULL

17328365648

Numeric Topline

16469004801100010

Ouroboros

r.*.n!(

OOLANG

start.label;
var.Input.0.in;

var==0.4.7.ifa;

0.print;
.halt;

var==1.9.9.ifa;

1.print;
start.goto;

PATH

  /           \
$,>-}+{v\>-}+{^}.#
   / \ > ^
   \./!}/

pb

^t[B]vb[T]w[B!48]{b[49]v}

pbrain

>++++++[-<++++++++>]<(.)+(.:),:

Piet

Truth machine 22-2-12-1.png

PoGo

if po uf to go

Pyth

QIQ#Q

Q-Ref

_innum(x)[_outnumcount(x)x?]

QWOP

OW1P1W1OW0P0

Recurl

Since Recurl has no input facilities, the first line must be either A:<0> or A:<1>.

Using an infinite list:
A:<0>
A?0<
  A:<1,A>
>
A#0
Using a loop:
A:<0>
A#1
A@0<
  A#1
>

Redivider

main:
  { /0/; "0" }
| { /1/; "1" + main["1"] }.

ResPlicate

0 -49 13 1 48 8 1 0 0 4 2 0 49 4 2 48 0

REVER

 (<i,>o) {
   +d(!x)=[0**x='1',0='0'];
   +x=0;
   d=i;
   *d(x);
   o=d;
   x-=1;
   *'0';
   o=d;
 }

REVERSE

GETXA
SKIP
PUTXB
XB+24
XA-48
REVERSE=XA
XB+25
SKIP
REVERSE
PUTXB
REVERSE

ROOP

I
wX
 
 
nw
hO

Sceql

______&!
\
  -=
  --------=
  ________=
/
==_==
\
  =*=
/
=-*

Self-modifying Brainfuck

1,.[-<->]<[<]>[.]0

Ser2

!'@run-:#:/loop-:'@input-:#:
!loop-:'@iopair--:#:'0:/exit-:'@output--:#:'0:
!loop-:'@iopair--:#:'1:/loop-:'@output--:#:'1:
!exit-:'@iopair--:#:'0:/#:

Shuffle

๐Ÿƒ‘๐Ÿƒž๐Ÿ‚ฒ๐Ÿ‚พ๐Ÿƒ๐Ÿ‚ท

๐Ÿƒž๐Ÿ‚ฑ๐Ÿ‚ฎ๐Ÿƒ๐Ÿ‚พ๐Ÿ‚ฑ๐Ÿ‚พ

SICKBAY

100 INPUT A%
(200+A%) PRINT 0;
200 PRINT 1;:GOTO 200

Simplefunge

>ivv
   o
   ^
  >V
   0
   o
   @

Slashist

VAR:<choice>:""

VAR:<ZERO>:{0}

VAR:<ONE>:{1}

INP:<choice>

NCL:ZRO:[<inp> = {0}]

CEL:ONE:[<inp> = {1}]

LOP:ZRO

OUT:<ZERO>

NUK:

LOP:ONE

OUT:<ONE>

ELP:ONE

Slim

0@0@0@0@0@0@0@0@0@|
:X|
:X|@<
:X|@<
:X|
:X|
:X|
:XX|
:^^@^^@<^^^^@0@
:0^^@^^@^^^@^0@0@0@0@0@0@0@0@
:

SMITH

MOV R3, 3
MOV R0, TTY
MOV R1, R0
SUB R0, 48
NOT R0
MUL R0, 3
COR +1, +5, R0
NOP
NOP
NOP
COR +1, -3, R3
MOV R0, 48
MOV TTY, R0
STOP
MOV R2, 49
SUB R1, 49
NOT R1
MUL R1, 2
MOV TTY, R2
COR +1, -1, R1

Core SNUSP

$,.>++++++!/-<-------->\
/.\!+>>/!?<\?<++++++++>/
\./

Splinter

As the language has no input, place 'Z' (for 0) or 'O' (for 1) inside the first {}. Below, 0 is used.

I{Z}
Z{\0}O{\1O}I

Squishy2K

Like the truth-machine in Kipple, this is only a truth-machine in principle, as the infinite string of 1's that is generated is never output (at least on the reference interpreter; the language afaik would not disallow implementations that lazily output the result.)

* main
{
  "0"? "0"!
  "1"? "1" main("1")!
}

Stackstack

inputnum
while
  "1"
  print
  1
endwhile
"0"
print

StaPLe

eval;pop;dup;[if;put;dup;swap;[eval;pop;dup;push;dup;];];dup;get;

Starry

 , +             +           +  * *' + . '` + . +' `

Stlang

M ./r(i1=={{.$?0}{.1(i@}.0U}{.0(i@}? \

For other versions see Stlang#Truth-machine.

Super Stack!

input if dup output fi output

Suxesol

As there is no input in Suxesol, the first block must be either [0] or [1]. Below, [1] is used.

[1][0*[?[1.]]0.]

SyL

ke ge no
ki yo gihi wewo
we
  ke no yo geha we le wu no wo
  ku le
  we
    yo giho we no wo
  wo
wo
ke no yo geha we la wu no wo
yo giho we no wo

Tag

As there is no input in Tag, the queue should be initially populated with 0 or 1.

zero :01(p0#)
one  :11(p1)
print:p2!(p1)

Telegram

START INPUT X STOP PRINT X STOP GO TO 2 IF X EQUALS 1 STOP END

This=That

a=input
a=print
while loop i=a~~1
a=print
while loop i=end

Thue

a::=:::
-0-::=~0
1::=~1
--::=-1-
::=
-a-

Trigger

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.$$-111..$-000

Underload

This is an example of an implementation in a language that has no input facilities, only output. In the first parentheses, use ! for 1-input, and nothing for 0-input. The program below is calibrated for 1-input.

(!)((1)S:^)~((0)S)~^:^

Unlambda

``c`@?1`c`|i

Urn

(:(1:::a)::)(a:(1:::)(1:::a)::a)

Please note that an Urn program needs to receive an EOF after the input of 0 or 1; no input-collecting (loop) in this language can end if it doesn't reach the end of input (that is: receive EOF).

Verbose

Untested. Input must be either "NULLA" for zero or "I" for one.

GET A ROMAN NUMERAL TYPED IN BY THE CURRENT PERSON USING THIS PROGRAM AND PUT IT ONTO THE TOP OF THE PROGRAM STACK
PUT THE NUMBER -III ONTO THE TOP OF THE PROGRAM STACK
MOVE THE FIRST ELEMENT OF THE PROGRAM STACK TO THE SECOND ELEMENT'S PLACE AND THE SECOND ELEMENT OF THE STACK TO THE FIRST ELEMENT'S PLACE
GET THE TOP ELEMENT OF THE STACK AND OUTPUT IT FOR THE CURRENT PERSON USING THIS PROGRAM TO SEE
MOVE THE FIRST ELEMENT OF THE PROGRAM STACK TO THE SECOND ELEMENT'S PLACE AND THE SECOND ELEMENT OF THE STACK TO THE FIRST ELEMENT'S PLACE
GET THE FIRST ELEMENT OF THE PROGRAM STACK AND THE SECOND ELEMENT OF THE PROGRAM STACK AND IF THE SECOND ELEMENT OF THE PROGRAM STACK IS NOT ZERO JUMP TO THE INSTRUCTION THAT IS THE CURRENT INSTRUCTION NUMBER AND THE FIRST ELEMENT ADDED TOGETHER'S RESULT

Wheat

input x
if x "0":
 terminate
-       v THE INPUT DATA FOR THE TRUTH-MACHINE BELOW (USE "0" OR "1")
output "0"

When

Untested.

out = 1 when out
out = in

Whenever

1 2#-read();
2 defer(1) print("0") 3#-1;
3 defer(2) again(3) print("1");

x-D

:E 8-------> x-----> x8S 8:C 8> :) 8P :( 8< 8P

XRF

0AFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF FFFFF FFFFF
FFFFF FFFFF FFFFF 1BFFF 31AFF

Yboy

,v~1_1:..$^...!

Ypsilax

If a 0 is placed immediately to the right of 'IN:', a single 0 will appear immediately to the right of 'OUT:'. If a 1 is placed immediately to the right of 'IN:', an infinite number of 1's will eventually appear immediately to the right of 'OUT:'.

(      ) (      )
 ------   ------
 N:0N:0   N:1N:1
 T: T:0   T: T:! (    )
                  ! 1!
 ----                 
 IN:
OUT:

ZOMBIE

ZOMBIE, like Underload, lacks input facilities. For 0, the third line should be "remember 0". For 1, the third line should be "remember 1".

zombie input is a zombie
summon
	remember 1
animate
zombie bleck is a zombie
summon
	task go
		taste remembering input 0 good
			say "0"
		bad
			shamble
				say "1"
			around
		spit
	animate
animate

See also