Truth-machine
A truth-machine is a simple program type, devised by User: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.
- Repeat infinitely:
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
- 1 Implementations
- 1.1 !@#$%^&*()_+
- 1.2 /gɹəʊguː/
- 1.3 @
- 1.4 05AB1E
- 1.5 0815
- 1.6 2-ill
- 1.7 2DFuck
- 1.8 2KWLang
- 1.9 33
- 1.10 3x
- 1.11 ><>
- 1.12 ACL
- 1.13 A:;
- 1.14 Acrostic
- 1.15 Acyclic Tag
- 1.16 Aeolbonn
- 1.17 AF
- 1.18 Alight
- 1.19 ALLSCII
- 1.20 Alphabet Stew
- 1.21 ALPL
- 1.22 AmBored
- 1.23 Andromeda
- 1.24 Aubergine
- 1.25 Argh!
- 1.26 Arrow
- 1.27 A.R.T.I.C.L.E.
- 1.28 AsciiDots
- 1.29 asm2bf
- 1.30 Assembly language
- 1.31 Babalang
- 1.32 Backshift
- 1.33 Beam
- 1.34 Beeswax
- 1.35 Befunge-93
- 1.36 Benul
- 1.37 beta-Juliet
- 1.38 Betterave
- 1.39 Binary lambda calculus
- 1.40 BIT
- 1.41 bitch
- 1.42 BitChanger
- 1.43 Bitoven
- 1.44 Bit Stupid
- 1.45 Bitter
- 1.46 Bitwise Cyclic Tag
- 1.47 Bitwise Trance
- 1.48 Black
- 1.49 Blindfolded Arithmetic
- 1.50 boolfuck
- 1.51 Brace For Impact
- 1.52 brainfuck
- 1.53 brainfuck--
- 1.54 brainfunct
- 1.55 Brainlisp
- 1.56 Brainloller
- 1.57 Bruijndejx
- 1.58 Bueue
- 1.59 Bur
- 1.60 Burlesque
- 1.61 ByteByteJump
- 1.62 Carriage
- 1.63 Cerberus
- 1.64 Cfluviurrh
- 1.65 Churro
- 1.66 C-INTERCAL
- 1.67 CJam
- 1.68 Coeus
- 1.69 comp
- 1.70 Cortex language 3
- 1.71 Cortex language 3A
- 1.72 Counting
- 1.73 Cubestate
- 1.74 CV(N)(C)
- 1.75 Daoyu
- 1.76 dc
- 1.77 Definer
- 1.78 Difficult
- 1.79 DigFill
- 1.80 DINAC
- 1.81 dotlang
- 1.82 Drive-In Window
- 1.83 DROL
- 1.84 DStack
- 1.85 Duck Duck Goose
- 1.86 Egel
- 1.87 Emmental
- 1.88 Emoji-gramming
- 1.89 Encapsulation
- 1.90 EnScript
- 1.91 Eodermdrome
- 1.92 Eso2D
- 1.93 ESOPUNK
- 1.94 Exotic
- 1.95 Expensive
- 1.96 FALSE
- 1.97 FerNANDo
- 1.98 Finvara
- 1.99 ><>
- 1.100 Fishing
- 1.101 Fit
- 1.102 Flipfractal
- 1.103 Foobar and Foobaz and Barbaz, oh my!
- 1.104 Forobj
- 1.105 Forte
- 1.106 FOS-X
- 1.107 FROM HERE TO THERE
- 1.108 Fueue
- 1.109 Funciton
- 1.110 Functional()
- 1.111 FurryScript
- 1.112 Gaot++
- 1.113 Gentzen
- 1.114 GetWhen
- 1.115 Glass
- 1.116 Glypho
- 1.117 GolfScript
- 1.118 golfuck
- 1.119 Grawlix
- 1.120 Gregorovich
- 1.121 GridScript
- 1.122 Hexadecimal Stacking Pseudo-Assembly Language
- 1.123 Hexagony
- 1.124 Hollow
- 1.125 Hot
- 1.126 HQ99+LUFTBALLONS
- 1.127 HQ9funge
- 1.128 Hurgusburgus
- 1.129 Integ
- 1.130 INTERCAL-72
- 1.131 IRP
- 1.132 ISCOM
- 1.133 Isolated
- 1.134 itflabtijtslwi
- 1.135 ΙΧΘΥΣ
- 1.136 Jolverine
- 1.137 Jug
- 1.138 JUMP
- 1.139 Juna
- 1.140 Karma
- 1.141 Keg
- 1.142 KimL
- 1.143 Kipple
- 1.144 Kkipple
- 1.145 L00P
- 1.146 Lightlang
- 1.147 Linguine
- 1.148 LOCK
- 1.149 logOS
- 1.150 Losescript
- 1.151 Lossia
- 1.152 Ly
- 1.153 Madbrain
- 1.154 MailBox
- 1.155 Malbolge
- 1.156 Malbolge Unshackled
- 1.157 MarioLANG
- 1.158 Math++
- 1.159 Maze
- 1.160 MechaniQue
- 1.161 Metatape
- 1.162 Microscript
- 1.163 MineFriff
- 1.164 Minks
- 1.165 MIX (Knuth)
- 1.166 Modulous
- 1.167 Muriel
- 1.168 Nhohnhehr
- 1.169 No Literals, Gotos Only, Final Destination!
- 1.170 NOR
- 1.171 NULL
- 1.172 Numeric Topline
- 1.173 Numobin
- 1.174 OneLine
- 1.175 OOLANG
- 1.176 Ouroboros
- 1.177 PATH
- 1.178 pb
- 1.179 pbrain
- 1.180 Phile
- 1.181 Piet
- 1.182 Pistons & Pistons
- 1.183 Pizza Delivery
- 1.184 PlusOrMinus 2
- 1.185 Poetic
- 1.186 PoGo
- 1.187 PokéBattle
- 1.188 Powder
- 1.189 Print Function Deluxe
- 1.190 Pxem
- 1.191 pyhton [sic]
- 1.192 Puzzlang
- 1.193 Pyth
- 1.194 QIRAML
- 1.195 Q-Ref
- 1.196 QWOP
- 1.197 RAGE!!!
- 1.198 Real Brainfuck
- 1.199 Realm
- 1.200 Recurl
- 1.201 Redivider
- 1.202 ResPlicate
- 1.203 REVER
- 1.204 REVERSE
- 1.205 ROOP
- 1.206 Rouedeux
- 1.207 Sadako
- 1.208 Sayonara
- 1.209 Sceql
- 1.210 Scratch 3.0
- 1.211 Seeker
- 1.212 SELENE.
- 1.213 Self-modifying Brainfuck
- 1.214 Ser2
- 1.215 Shuffle
- 1.216 SICKBAY
- 1.217 Silberjoder
- 1.218 Simplefunge
- 1.219 Slashist
- 1.220 Slim
- 1.221 SMITH
- 1.222 Core SNUSP
- 1.223 Solo
- 1.224 Something?Oops!
- 1.225 Splinter
- 1.226 Squishy2K
- 1.227 Stackstack
- 1.228 StaPLe
- 1.229 Starry
- 1.230 Stlang
- 1.231 Stop
- 1.232 Strvar
- 1.233 Stupid
- 1.234 StupidStackLanguage
- 1.235 Subleq
- 1.236 Suicide
- 1.237 SuperPar
- 1.238 Super Stack!
- 1.239 Surtic
- 1.240 Suxesol
- 1.241 SyL
- 1.242 Tables
- 1.243 Tag
- 1.244 Telegram
- 1.245 TheSingularity
- 1.246 The Waterfall Model
- 1.247 This=That
- 1.248 Thue
- 1.249 Tiangou
- 1.250 Tier
- 1.251 TPPL
- 1.252 Trigger
- 1.253 Triski
- 1.254 Tubes
- 1.255 Turi
- 1.256 Turing-machine
- 1.257 Turth-machine
- 1.258 Underload
- 1.259 Unlambda
- 1.260 Unsquare
- 1.261 Urn
- 1.262 Var=Bar
- 1.263 Varigen
- 1.264 Verbose
- 1.265 Waduzitdo
- 1.266 Wheat
- 1.267 When
- 1.268 Whenever
- 1.269 Whitespace
- 1.270 Wierd Machine
- 1.271 x-D
- 1.272 XENBLN
- 1.273 XRF
- 1.274 Yboy
- 1.275 Ypsilax
- 1.276 Zeno
- 1.277 ZOMBIE
- 1.278 Tttt
- 1.279 Conglument
- 1.280 Your
- 2 See also
Implementations
!@#$%^&*()_+
0_*(!#)#
/gɹəʊguː/
;<{!<![}&1+,<!]?
@
?ň¤Ō10
05AB1E
[?_#
0815
|~}:i:%^:i:
2-ill
@ @ @@ @ @ # # # @@ $ @ @ @ @ @ @
2DFuck
,x>,x>,x>,x>,x>,x>,x>,x<<<<<<<r.>r.>r.>r.>r.>r.>r.>r.[<<<<<<<r.>r.>r.>r.>r.>r.>r.>r.]
2KWLang
Requires 3 files: main.2kwl, 1.2kwl, and 0.2kwl.
Contents of main.2kwl
:
print “\0”; import ((“\0” == “1”) ? “1.2kwl”: “0.2kwl”);
Contents of 1.2kwl
:
print “1”; import “1.2kwl”;
Contents of 0.2kwl
:
print “0”;
33
O[on@]
3x
?([1])[0]
><>
i'0'-:?vn; : >^
Also works for *><>.
ACL
1A54B64BF78
A:;
j:1;i:l;?:l:=:j:2;p:j;g:3
Acrostic
N CONTINGENCIES T C H N A I R O N COMMENCE NOTHINGNESS G A H E DUPLICATED N G
Acyclic Tag
.48 .49^ +^
Set the input bit by changing the last line; "^" for 0, "+^" for 1.
Aeolbonn
The first line is the input. Printed with newline after each 1:
0 1 8 1 :1 : 4 1 :0
Without newline after each 1:
0 1 6 1 :1 4 1 :0
AF
31 00 00 03 01 20 00 32 00 22 10 00 03 01 30 00 11 21 32 00 30 00 03 00 30 00 31 01
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;;;;;;;
ALLSCII
With string input:
>'%%""C 92!?F 42?
With number input:
LC 44!?F44?
Alphabet Stew
rtsetviiv
ALPL
For the sake of simplicity, this program operates on bits instead of chars.
``?``=l[x.``1xx]l`00
AmBored
If the input is 0, it writes "0" in white once on the screen. If the input is 1, it writes "1" in alternating colors.
>>7v7v7v7v7<,[0>[++^++^++^++^++.vvvv]]7<7^7^7^7^7>7.
Andromeda
Treats the queue as an input/output mechanism.
vv< >?v >^
Aubergine
=Ao=bi=oA=aA-ai-ai-ai-ab-a1:Ba=ib
Argh!
lglj j jShh lrllxpq 0jph0 j1k llk
Arrow
>>#v#v#<![¤>[¤^¤^¤#v#v#]#<#^#^#>#
Replace !
with #
for input = 1 and nothing for input = 0
A.R.T.I.C.L.E.
get_input f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13. push push push push push. push push push push push. zero_label. dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n. n n n n n n1. loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18. f f f f zero_label. add_0_to_compare f2 f3 f4 f5 f6 f7 f8 f9 f10 f11. n n n n n n1 n2 n3. n n n n n. pop_and_cmp f2 f3 f4 f5 f6 f7 f8. bnoc_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17. f f f f print_0. zero_label2. dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n. n n n n n n1. loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18. f f f f zero_label2. add_1_to_compare f2 f3 f4 f5 f6 f7 f8 f9 f10 f11. n n n n n n1 n2 n3. n n n n n n1. pop_and_cmp f2 f3 f4 f5 f6 f7 f8. bnoc_1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17. f f f f print_1. end_if_none f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15. f f f f end. print_1. print1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14. loop f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16. f f f f print_1. print_0. zero_label3. dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n. n n n n n n1. loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18. f f f f zero_label3. add_0_to_print f2 f3 f4 f5 f6 f7 f8 f9 f10 f11. n n n n n n1 n2 n3. n n n n n. print0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14. get_input f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13. end.
AsciiDots
/(#1$_#) .----~#0$#& .-#?-^
asm2bf
It's using inline brainfuck to keep things relatively concise.
in_ r1 jz_ r1, %skip raw .> raw .> raw .[ raw .. raw .] @skip out r1
When assembled:
+>+[<[>>+>+<<<-]>>[<<+>>-]>[[-]>>,>>>>+<<<<<<+>>[<<[-]<+>>>-]<<<[>>>+<<<-]>[<<<[-]>[-] >>>>>>>>[<<<<<<<<+>+>>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>[-]]>>>>>>[-]<<<<<<]<<<[>>+>+<< <-]>>[<<+>>-]>[[-]>>[.]]>+<<+<<[>>->+<<<-]>>>[<<<+>>>-]<[->+<<[>>>-<<+<-]>[<+>-]>>[<-> [-]]<[<<<+>>>-]<]>>[-]<<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>.<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[- ]<<<[-]>[-]>>]<<]
Assembly language
This is not the actual program; this is the program in mnemonics.
MOV 01 00 MOV 00 01 JZ 0E 01 MOV 00 01 JMP 09
Babalang
The program return code is 1 if input is neither 0 nor 1
0_str is you and move and more and move and more and more and more and more 1_str is 0_str and move baba is you and word ice is tele baba on 0_str is text baba on 0_str fear ice baba not on 1_str is defeat baba is text ice is done baba is win
Backshift
Although it was intended as a sorting algorithm, it turned out to be computationally powerful.
x
x is the input. 1 does the same thing as 0 , 0 does the same thing as 1.
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
bitch
\>/;<
BitChanger
<<<<< <<<<< <<}<} }}}}} }}}}} <<<<< <<< }}}}} }}} [ <<<<< <<<<< <}<} }}}}} }}}}} <<<<< <<<<< }}}}} }}}}} ] <<<<< <<<<< <}
Bitoven
a?[aa-b+c+]d++++++[dd-b--------]c![bc!]
Bit Stupid
3-byte version.
,:.
Bitter
m0 = 0 >><
m0 = 1 ><(>><)
Bitwise Cyclic Tag
11
Bitwise Trance
010000001101100001111110001010100
Black
In the code below, input is calibrated for 1.
input:O1 truth-machine in Black. calibrate machine by moving * under O or 1. * needs to use output extension. uses O instead of 0 because the Javascript interpreter makes 0s vanish for some reason. * * * * * * * * * O * 1 * *
Blindfolded Arithmetic
a = i / i b = a + a c = b + b c = c + a c = b * c i = c * i i = a + i
Input of 1 sets i to an infinite string of 1
s but doesn't print
boolfuck
,>,>,>,>,>,>,>,<<<<<<< [;>;>;>;>;>;>;>;<<<<<<<] ;>;>;>;>;>;>;>;
Brace For Impact
(t@)in(j^)(y~) (q#)in = 0(j^) (f=) (e%) (t@)out(j^)1 (w&)out = 1(j^) (s;)out (f=)
brainfuck
>>>,.[[->+<<+>]>-]<<<[<<]>[.]
I have a shorter one that needs negative cells:
,.[[-<+>>+<]>-]<<<[<<]>[.]
Another one based on subtraction(That is the simplest I can go)
,.[->+>+<<]++++++[->--------<]>[>[.]]
brainfuck--
.>>>>>>>.[.]
brainfunct
////////////////////////////////////////////////.@/,.@
Brainlisp
(in)(out)(loop(loop(dec)(left)(inc)(right)(right)(inc)(left))(right)(dec))(left)(left)(left)(loop(left)(left))(right)(loop(out))
Brainloller
Short, but needs negative cells.
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).
Bur
Bur doesn't have any form of input. Instead, change the character at index 24 to be 0 or 1:
~@0#0!!;~@1#1!!v@1@;~@,#0!~$0?#0!~$0!‽=0*#1!~$0!‽=1*;
A shorter example that tests 1 vs "anything else" rather than 1 vs 0. This time, the index in question is index 16:
~@1#1!!v@1@;~@,#0!#1!‽=1*#0!!v;
Burlesque
ri{^^}w!
If STDIN is not on the stack replace ri with either 0 or 1.
ByteByteJump
00000000 ff 06 03 06 ff 06 00 08 00 00 00 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000030 ff 03 |..| 00000032
Note that ByteByteJump, as more of a class of CPUs than a system, needs to be further described for a program. In particular, the version used here has 1-byte addresses. However, this program can be extended up to 5-byte addresses relatively trivially.
As for IO, 0xFF is assumed to be both an input and output port (having it pre-initialized and no output works just as well). Termination is handled via jumping to 0xFF, which implies 2 bytes of the instruction are out-of-range - the handling of this appears to be system-defined anyway (BytePusher handles this via zero-padding).
Finally, entering a character which is not '0' or '1' as the first character of input will fail horribly.
Carriage
111-@1\11-~!$$11+1+1+1+\1+1+1+1+1+1+@11-~!$$1-
An explanation is available.
Cerberus
.-...-..--.--....-..-.-- .-.---..-.--.----..-..-- --.-..-.--.-.....-.-..--
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.)
Churro
{========={o}{o}}{====={o}{======{o}{==={o}{====={o}{====={o}{========{o}{===={o}{========{o}{=========={o}
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;
Coeus
hA[AB][][aA]aA
comp
;{^&}&
Cortex language 3
;'
(by definition)
Cortex language 3A
;'
Counting
when cnt == 1 read acc out acc when acc == 0 halt when acc == 1 out acc
Cubestate
,0 B' .1 F' D' M2 S U' B D S L2 M2 B' 8
CV(N)(C)
soθɰ̊oθʋi
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
And, just another all-input usable way:
constants: 1 = 11 definitions: code: 0
Difficult
a=thing.console.Input("")? thing.keyword.switch a[ thing.keyword.wheneq 1[ thing.keyword.while true[ thing.console.printnd{a}? ] ] thing.keyword.wheneq 0[ thing.console.printnd{0}? ] ]
DigFill
(&n*)n^n~n(&n~s)s~s
DINAC
SET zeroOrOne:\0 IN zeroOrOne IF zeroOrOne = '1 WHILE 01 OUT '1 ELSE OUT 00
dotlang
•W~ W0`s#0# W1`s#1>#v ^<<
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
Egel
tm = [ 0 -> 0 | 1 -> 1 + 10 * tm 1 ] tm <input>
Replace <input>
with 0 or 1
Emmental
;#58#46#58#63#49! ,:.:?
Emoji-gramming
😊🕐💖 😇🕐🕐 😇🕐🕐 😇🕐💖 😇🕐💖 😊🕑🕐 😇🕑💜 😊♈🎤 😵♈💜 😇🚨💕 😊📢🕑 😈🚨💕 😊📢🕐
Encapsulation
<000 - 100 1 - 11
EnScript
Please make sure that you add a "9" after your input!
INP A OUT A//19 or 09 LDA Z, 10 ENC A, Z OUT A
Eodermdrome
(0) zero-quits: z (0) quit! z (1) the-loop: (1) on-one: loop-the-loops loop-the-loop (1) loop-the-loop
Eso2D
All non-0 values are treated as 1.
$`v >*@ ^
ESOPUNK
COPY #STDI X TEST X = 49 MARK L COPY X #STDO TJMP L HALT
Exotic
(. (. .)) (. .) (. ((. .) .)) *(. ((. .) .)) a .
Expensive
,.[[-<+>>+<]>-]<<<[<<]>[.]<+><>-<-<+<--+<-
FALSE
^48-[[$1.!]$!]?0.
FerNANDo
r 0 0 1 1 0 0 0 a a 0 0 1 1 0 0 0 a a
Finvara
(k): (n 0): (0,0) (i 3): (1,0) (p 4): (1,0) (q 0): {(1,0),(1,1)} +--+--+--+--+ |kB|##|qB|nB| +--+--+--+--+ |##|##| | | +--+--+--+--+ |iW|pW| |kW| +--+--+--+--+ Turn 1 W: i a1 -> b1 Turn 1 B: k c1 -> c2 Turn 2 W: p a2 -> b2 Turn 2 B: q c3 -> b3 Turn 3 W: p a2 -> b2 Turn 3 B: n c4 -> c4 Turn 4 W: p a2 checks turn 3 Turn 4 B: n c4 -> c4
><>
i68*-?!v1>:!n< >0n;
Fishing
v+CCCCCC?=[C] `1`{I}! P [CC {N
Fit
:(.).
Flipfractal
#V## #/+< >X # #^##
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
FROM HERE TO THERE
FROM IN TO n FROM "0" TO 6 FROM "1" TO 4 FROM n TO LINE FROM 1 TO OUT FROM 4 TO LINE FROM 0 TO OUT
Fueue
[[)[~~~~()+1])])][[)$-----~1-[~:)~)[)[~:)~)]~:]:]~[~[$~H~~%~+])~48-):])~)~:])][)~[0]])$
Funciton
╔═══╗ ╔═══╗ ║ ╟──────┬──────╢-49║ ╚═══╝ ┌┘ ╚═══╝ ┌┤ ┌┐ ┌┘└┬┘└┐ │╔═╧═╗│ ╔════════════════════════════════════════════════════╗ │║255║│ ║ Funciton Truth-Machine v0.6 ║ │╚═══╝│ ╟────────────────────────────────────────────────────╢ └──┬──┘ ║ 0: Output "0" and terminate ║ │ ║ 1: Infinite loop, no output. Fill memory with "1" ║ │ ╚════════════════════════════════════════════════════╝ ┌┴┐ └┬┘ ┌────┴────┐ │ ╔═══╗ │ │ ║ 0 ║ │ │ ╚═╤═╝ │ │┌───┴───┐│ └┼─┐ ┌─┼┘ ├┐│ │┌┤ └┘│ │└┘ ┌┴┐ ┌┴┐ └┬┘ └┬┘ ╓───╖ └─┬─┘ ║ ∞ ║ ┌───┴───┐ ╙─┬─╜ │┌─────┐│ ┌─┴─┐ ││╔═══╗││ ╔══╗ │┌─┐│ ╔╤═════════════════════════════════════╗ ││║048║││ ║21╟─┼┴─┘│ ║│ Infinite loop with character append ║ ││╚═╤═╝││ ╚══╝┌┴┐ ┌┴┐ ╚╧═════════════════════════════════════╝ │└──┤ ││ └┬┘ └┬┘ │ ┌┴┐ ││ └─┬─┘ └──┤ │ ││ ┌─┴─╖ └─┘ ││ │ ∞ ║ ┌──────┘│ ╘═╤═╝ │ ╔═══╗ │ │ │ ║049║ │ │ │ ╚═╤═╝ │ │ │ ┌─┴─╖ │ │ │ ∞ ║ │ │ ╘═╤═╝ │ └──┐└┬──┘ └┬┘ │ │ │ │
Functional()
E S O L A N,G E(A(S,N E(~ S S)),~)E
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;
GetWhen
when(!input()): output(0), ip=% //If input is 0, output 0 and terminate. when(input()): output(1) //If input is 1, output 1 forever.
Note: This program would create a lot of unnecessary lines that are not executed. Below is a more memory efficient program:
1: x=input(), output(x), ip=x+2 //Output the input, then go to line 2 if it was 0 or line 3 if it was 1 2: ip=% //Halt 3: output(1)
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;
golfuck
:{;};
Grawlix
?(=^)>+[=]
Gregorovich
Replace the ^1
with ^0
for input 0.
^1_Rega,2-1_W(a>0)[#a]_#a
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
Hexadecimal Stacking Pseudo-Assembly Language
110000 420000 400000 030000 010001 000000 420000 400000 120000 010000 000001 120000
Hexagony
?!':)!
Or, properly formatted:
? ! ' : ) ! .
Hollow
{1}> {.0}\>|>> {1}: {0}:?
Hot
S(S(K(S(K(S(S(SKK)(KK))))(S(S(KS)K)(S(S(KS)K)(K(S(S(K(SS)))(S(K(SS)))(S(SKK)(SKK))))))))(S(SKK)(K(SK))))(S(SKK)(KK))
HQ99+LUFTBALLONS
======================================== ooooo oo oooo oooooo o oooooooooooooo o|||||o||o|||| |||||| |oo|||||||||||||| ||||||||||||||o||||||o|||||||||||||||||o |||||||||||||||||||||||||||||||||||||||| HQ99+LUFTBALLONSHQ99+LUFTBALLONSHQ99+LUF ========================================
HQ9funge
1 byte solution, shorter than everything else on this list.
T
Hurgusburgus
i(48)^:?{(1)o}?;(0)o@
Integ
}()([())?(-(48)({()))(](48))(?(-(49)({()))(~()(](49)))())
INTERCAL-72
You have to input either
ZERO
, OH
, or ONE
to this program.
PLEASE DO(1)NEXT (3)DO FORGET #1 DO READ OUT #1 DO (3)NEXT (1)PLEASE DO(2)NEXT DO NOT FORGET #1 DO READ OUT #0 PLEASE GIVE UP (2)DO WRITE IN .1 DO (1020)NEXT DO RESUME .1
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
ΙΧΘΥΣ
ι # above line increments accumulator to 1, delete above line for 0 Ις ΣχΧΘ ΙσΧιιθιιιθχΘ ς ΙΣΧιιθιιιθΥΣΘ ς σΥ
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"); };
JUMP
0 IF 0 THEN GOTO 2 ELSE GOTO 1 1 OUTPUT 1 GOTO 1 2 OUTPUT 0 GOTO 3
Binary form:
110010000100110110010
Juna
0 . 0 1 2 1 0 . . . 2 0 . 2 2
Karma
86*?-, \\;@<
Keg
?\1=[{1.}|_0]
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
(:|;:(|&))
Lightlang
?!&#&/!/
Enter nothing for 0 input
Linguine
1[0?,0~48:2]3 2[0$]0 3[0$]3
LOCK
{main :a $a ^a ?one <main } {one $a }
logOS
Editor paste\nswitch Email\nsend\nswitch Terminal\nrun replace "\n" with newline cut minimise LOOP paste minimise Email refresh copy switch Editor paste replace "1" with "switch LOOP\ncopy\nswitch Terminal\npaste\nrun" replace "\n" with a newline replace "0" with "rem" cut minimise Terminal paste run
Losescript
T
Lossia
l Loss l llIIIIll l[ l. ll l_
Ly
n:u![;]1[u1]
Madbrain
r 1 = 1 p 3 j
MailBox
Untested due to lack of interpreter.
box 0 (once) send input to 1 (contains "1") output box 1 (contains "0") output (contains "1") send "1" to 0 forward to 1
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!
Normalized:
jivvvvvvvvvvvvvvvvvvvvvvvvvvv<ivv*jovv/vvovvoivvv//v*vp<ivvvvvvvji*vv<vv vvvv*/o/jp<opvvvvvvvvvvvvvvivvvvvvvvvvvvvvvvvvvvvvpopjpjjpjjpjooooopoooo ojo*ojoopjoooooooopj*joopojooopo*ooooojooooopooooojoooopooooooojooo*oooo jpoojpooooojooo*ojpoooo*ooooojj/oppjji
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
MechaniQue
@^? @{_1}^->one @{_0}^->zero @[one]^:1|->one @[zero]^:0 @fin
Metatape
xi[o(])
Microscript
i{p
MineFriff
0,:?vo o,1<
Replace the "0" in the top-left corner with "1" to change input.
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
MIX (Knuth)
The following has quotation marks since it has a space in the first character position (the quotation marks should not be punched into the card). Expects input in typewriter (one character only, at leftmost position) and output also in typewriter.
" 0 R6 A R4 0 AP 7A7I F 7V 0 R7 E 9 BE "
Modulous
[INP INT][JMP F 3 IF 0][JMP F 4 IF 1][RST][PRT INT][END][DUP][PRT INT][JMP B 2]
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| +---+
No Literals, Gotos Only, Final Destination!
\,a a+a+a+a+a+a+a+a+a,b b+a+a+a+a,c ?cb,d :cb*+a+a :cb*+d
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
Numobin
)#=*[##-(]##-##--(
OneLine
^!~!~
Remove the ^
to set input to 0.
OOLANG
start.label; var.Input.0.in; var==0.4.7.ifa; 0.print; .halt; var==1.9.9.ifa; 1.print; start.goto;
Ouroboros
r.*.n!(
PATH
/ \ $,>-}+{v\>-}+{^}.# / \ > ^ \./!}/
pb
^t[B]vb[T]w[B!48]{b[49]v}
pbrain
++++++[->++++++++<]>(.)+(.:),:
Phile
OPEN "stdin.stream"; OPEN "stdout.stream"; READ "stdin.stream" = 0? 5; WRITE "stdout.stream" 1; 1? 3; WRITE "stdout.stream" 0; CLOSE "stdin.stream"; CLOSE "stdout.stream";
Piet
Pistons & Pistons
▢├▢ ┴ ┬ 1 ▢ ▢┤▢┤1 0
To change input to '0', replace
1 ▢ ▢┤▢┤1
with
1 ▢ ▢┤▢ 1 ┴
Pizza Delivery
?[31`]30`.
PlusOrMinus 2
Replace the first +
on the second line with a >
for input 0. Here the code for input 1 is shown.
V v<<< >+|>+++++++++++++++++++++++++++++++++++++++++++++++++>-+^ >++++++++++++++++++++++++++++++++++++++++++++++++->>>>>
Poetic
Truthful Machine, functioning with epistemological methodologies i wanted to say a truth i do enjoy a true, intelligible saying but i accept, i'm no legit philosopher reality is unknowable
PoGo
if po uf to go
PokéBattle
Trainer 1: Alice Togepi Emolga Talonflame Rhyperior Abra Pikachu Trainer 2: Bob Yveltal Raichu Oranguru Nidoqueen Incineroar Avalugg Battle Start! Turn 0: Alice: Rhyperior Go! Bob: Avalugg Go! Turn 1: Rhyperior uses Leer! Bob tried to run away! You can't run from a trainer battle! Turn 2: Rhyperior uses Fissure! Avalugg uses Blizzard! Turn 3: Alice thinks about Turn 4. Bob thinks about Turn 7. Turn 4: Alice tried to run away! You can't run from a trainer battle! Bob uses Potion! Turn 5: Alice tried to run away! You can't run from a trainer battle! Avalugg uses Barrier! Turn 6: Alice thinks about Turn 5. Bob tried to run away! You can't run from a trainer battle! Turn 7: Alice tried to run away! You can't run from a trainer battle! Avalugg uses Barrier! Battle End! Winner: Alice
Powder
{ "if" : { "1" : "infinite_loop", "0" : "halt" } "input" : 1, "result" : "if".'input', "halt" : { "output" : 0 }, "infinite_loop" : { "output" : 1, "result" : "infinite_loop" } }
Print Function Deluxe
$&=1p0 . p1 @2
Pxem
getchar() version
- File name
.i0.z1.o01.a0.pxe
- File content
- don't care
scanf("%d", value) version
- File name
._.w1.o1.a0.pxe
- File content
- don't care
They, actually, can be rewritten to .i0.z1.o.a0.pxe
and ._.w1.o.a0.pxe
respectively.
pyhton [sic]
The following truth machine takes inputs that are not multiples of seven as 1 and multiples as seven as zero. This makes 1 and 0 behave as expected, naturally. Making behaviour undefined for input other than 1 or 0 would have been much simpler, but I only thought of that after finishing the program.
i)))()(9)9))9(())<<<5<53<3<<355<<,,,>,>1,1,,1>>,,666@6@/6/66/@@66 0 07 7 700 hhh?h?.h.hh.??h' ''I ''I '' I l!={#["2!60)]|8]]]]]]]]]]]]]]hI'~99(l];I_=
Puzzlang
X X X X X X X X X X X XX XX X XX XX XX X XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X X X X X XX X XX X XX XXX XXX X XX X X
Pyth
Wp
QIRAML
<author>Tetrapyronia</author> <document>This is a QIRAML Truth-machine</document> <help>If the input is '1', print '1' forever, otherwise print input once.</help> <license>GPL</license> <size>1</size> <version>1.0</version> <main> ? Input: if ==1 loop 0 @ @,x </main>
Q-Ref
_innum(x)[_outnumcount(x)x?]
QWOP
OW1P1W1OW0P0
RAGE!!!
<rant> WHY DOES input MEAN THE SAME THING AS WHAT YOU'RE ABOUT TO TELL ME!!! AS LONG AS input MEANS THE SAME THING AS "1": SCREAM "1"!!! SCREAM "0"!!! </rant>
Real Brainfuck
,[.].
Realm
?. 0.. ?.( .( 10001100 ) ) 00001100
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
Rouedeux
RRRRRRRRRRRRRRRRRRRRRRRRRRORRRRRRRRRRRRRRWPRRRRRRRRRRRRRRRRRRRRRRRRRRWPRRRRRRRRRRRRRRRRRRWPRRRRRRRRRRRRRRRRRRRRRRWPRQRRRRRRRRRRRRRRRRRRRRRRRRRRWPRRRRRRWPRRRRRRRRRRRRRWPRRRRRRRRRRRRRRRRRRRRRRRWP
For input 1
, add an extra R
to the beginning of the program. Input of 0
prints ZERO
and input of 1
prints ONE
infinitely.
Sadako
| ? : = 0 A A 2 | . A B : = 0 A A 1 | . A A
Sayonara
(main x x) (= x (0)) (= x x) (1)
Sceql
______&! \ -= --------= ________= / ==_== \ =*= / =-*
Scratch 3.0
Seeker
!x.@x:&.#x=0!0.#x=1!1.|.$0._.|.$1.>1
SELENE.
take start print end print
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
Silberjoder
See Aubergine or brainfuck for examples.
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
$,.>++++++!/-<-------->\ /.\!+>>/!?<\?<++++++++>/ \./
Solo
solo
Something?Oops!
? 2?Oops, 0 0?Oops. 0 6?Oops, 0 1?Oops. 0 4?Oops, 1 2?Oops!
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.
Stop
,:
Strvar
Change "0"
to "1"
for input 1. Loops forever for 1 = "1";
, prints 0 for 1 = "0";
.
1 = "0"; # "0" for input 0, "1" for input 1 "1";
Stupid
v=IN v=OUT v==1 v=OUT
StupidStackLanguage
htxux
Subleq
Written using Oleg Mazonka's Subleq compiler. This:
(-1) Input a: tmp Input (-1) Input tmp Constant tmp a 0 0 (-1) .tmp: 0 .Input: 0 .Constant: -49
Compiles to:
-1 19 3 18 18 6 19 -1 9 19 18 12 20 18 3 0 0 -1 0 0 -49
Suicide
*vAA:0 *vAB:1 %(vAA::vAB)><vAA <vAA
Replace *vAA:0
with *vAA:1
to change input to 1
SuperPar
![STDIO]=V,IN,OUT !!out{OUT.V=!1;do*@OUT;} !!in{!1=@IN.V;} { machine={ out[#.input]; #.input*48; }; in[machine.input]; do$@machine; }
Super Stack!
input if dup output fi output
Surtic
S1"\n"C1++++++++FC1[C1+++++]FC1[C2+]C2+!B1WB1[IC3?B2(C3==C1)?B3(C3==C2)IB2{OC3OS1!B1}B3[WB1[OC3OS1]]]
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
Tables
Input index: "input"
Output index: "output"
If input is not 0
or 1
, the program will not do anything.
On zero, the program outputs 0
and terminates.
On one, the program outputs 1
and goes into an infinite loop (unable to set infinite indices of a table)
Line Number/Index | Instruction/Value | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
| ||||||||||||||||||||||||||||||||||
1 |
| ||||||||||||||||||||||||||||||||||
3 |
| ||||||||||||||||||||||||||||||||||
4 |
|
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
TheSingularity
TheSingularity:"1",TheSingularity; TheSingularity:"0",TheSingularity:1,1,1;; TheSingularity:_c_,1,1,0; :1; TheSingularity:"1"; TheSingularity:1; :0; TheSingularity:"0";
The Waterfall Model
[[7, 4, 4, 4, 4], [6, 1, 0, 0, 0], [4, 2, 2, 0, 2], [5, 2, 2, 2, 2], [?, 0, 0, 0, 0]]
Second row is the output clock, last row is the input. Using the recommended number encoding, replace ?
in the last row with (input * 2 + 3), i.e. 3
for 0, 5
for 1. On 3
(=0), the output clock will be set to 3
(=0) and the program will cleanly exit. On 5
(=1), the output clock will alternate between 5
(=1) and 4
(NaN?) without terminating.
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-
Tiangou
i p < : : o >
Tier
0.tier
}=_{# >^
TPPL
ENTER BATHROOM SET RIP ADD ADD ADD ADD CHECK 1 YES? 19 TRASH PULL WIPE PULL WIPE WIPE PULL WIPE RIP FLUSH EXIT TRASH WIPE PULL WIPE PULL WIPE WIPE PULL WIPE RIP FLUSH ADD ADD ADD ADD JUMP 20
Trigger
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.$$-111..$-000
Triski
p (v z) (v o) a i v s d s i i (s i i) d d d d d d d d o z v i a l o l l o d d a s s i i (s i i)
Tubes
┌─┐ ├┐│ └◆┘ ▶◇◆┤ ▷┘
Turi
[ι]|1|ps5shlzPlE
Replace ι
with input.
Turing-machine
Q1:E>1 Q0:O>0 E0:E>1 O0:F<0
Turth-machine
Ask for input If the input is 0 Output 0 Whereas if the input is 1 Repeat infinitely Output 1
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
Unsquare
ioAx>Io<
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).
Var=Bar
v=1N v=0UT x=v==1 v=0UT x=STOP
Varigen
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
Waduzitdo
A: M: 0 Y J: 2 * T: 1 J: * T: 0 S:
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");
Whitespace
Here, each character used in instructions (space, tab, and linefeed) is preceded by S, T, or L, respectively.
S S L T L T T S S L T T T L S S L S L S T L S T S L S S S S T L T S S T L T S L L L L .
Wierd Machine
ICHF0JQI1QL∞
x-D
:E 8-------> x-----> x8S 8:C 8> :) 8P :( 8< 8P
XENBLN
ČÎx
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:
Zeno
real i = 0; zeno { for (i=1;i==t;i=1) { // Infinite for loop if i = 1 print(1); }; }; print(i);
Swap real i = 0;
to real i = 1;
to input 1 instead of 0.
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
Tttt
hcaaaaibdcbbbbbbcjdcifjf
Conglument
-.0~a+0b.2*-b~ac.4~+1c
Your
Your Your Your Your