Code Input
MOCHINE rev 191119a↓ MEMORY ↓
Mochine is a computationally universal programming language used to interface with Mocha's Machine.
# = number
? = string or number
! = specialchar
All support use of * for machine state
All support use of $ for pointer
All support use of @ for value at pointer
(shorthand) (operation) (description)
0 Arguments
i INP : accept next line of input
! NOT : set value at pointer to 1 if 0, else 0
t TIM : set value at pointer to seconds since epoch
1 Argument
:X : Label 'X'. Can also be used as comments and empty lines
& AND ? : set value at pointer to argument if itself is 1, otherwise,
return itself
a APP ? : append string to value at pointer
| IOR ? : set value at pointer to argument if itself is 0, otherwise,
return itself
l LEN ? : set value at pointer to the length of its argument as a string
s MMS # : set machine state to itself plus argument
m MOV # : set pointer to itself plus argument
o OUT ? : output value to console
r RPN ? : set value at pointer to itself plus the evaluation of the
argument as RPN, comma pushes #s onto stack. Spaces ignored.
Valid operators: + - x / % ^ ! ~ # [ ] | l L s S c C t T
Valid truth operators: = ? < >
Valid advanced operators: m M n N q Q ' " h
Valid constants: e g p r R
Valid GolfScript stack manipulation ops: \ ; . ( )
^ XOR ? : set value at pointer to 0 if argument same as itself, else 1
2 Arguments
j JJJ condition ? : jump to line if condition is true.
Valid conditionals: = != < > <= >=
l LET ! ? : set * or $ or @ to argument
x SWP ! ! : swaps two specials
~~Pretty useless commands that also exist~~
Putting the 'fun' back into 'function'!
1 Argument
FUN # : swap this line of code with the #-th line after this
I2W # : set value at pointer to the English transcription of the
argument
IMG ? : output the image located at argument to console
MID ? : Use with one of the following arguments:
BRT Happy Birthday
QUO ? : Use with one of the following arguments:
(Open List)
ALH Allahu Akbar!
ANG Ain't nobody got time fo dat
BAT I'm Batman
BFL Das war ein befehl!
BHS Boom Headshot!
BTS Diabeetus
BTW Bird's the Word
BOS Balls of Steel
BRL Do a Barrel Roll!
BZG Bazinga!
CMB Combo Breaker
CTT Can't touch this
DOH Doh
DOI Do it
DRK Hello darkness
DUL It's time to d-d-d-d-duel!
EAG EA Games: Challenge Everything
FNH Finish Him
FRD Fus Ro Dah!
GAY Hah! Gaaaaaay!
HHA Ha-Ha!
HHH Haha hoho hihi hehe
HLJ Hallelujah!
IKU Silence! I kill you!
ILT I like turtles
JCN John Cena
JDI Just do it!
KHN Khaaaaan!
LDL Leedle
LEG My leg!
LRJ Leeroy
LSN Hey! Listen!
LYN Why you always lyin
LZR Lazor
MGY I'm gay!
MSF Mission Failed
MSK I'm Mr. Meeseeks! Look at me!
NGP No god please no
NOM Omnomnom
NOO Nooooooo!
NOT Noot noot
O66 Execute Order 66
OMY Oh myyyyyy!
PKL Pickle Rick
PNG Pingas
PUS Grab 'em by the pussy
PYT Frenchman Insults
RDN Ridin dirty
RRL Rick Roll
SFU Shut the fuck up!
SHU Shut up!
SKR The ting goes skra
SMF Surprise mothafucka
STP It's time to stop!
SWE Smoke weed every day
TIS This is Sparta!
TPL Oh baby a triple!
TRL Trololo
TRP It's a trap!
TTR Tuturu!
TWE That was easy
UTN Utini!
WED It is wednesday my dudes
WLD Wubalubadubdub
WLL Wololo
WYP Watch your profanity
YAA Yeah
YEE Yee
YES Yes! Yes!
SFX ? : Use with one of the following arguments:
(Open List)
5NF FNAF Jumpscare
APP Applause
BEL Bell
CRK Crickets
DNG Ding
DPH Dolphin
DRM Drumroll
JPD Jeopardy
LNO Dun Dun
LOS Losing Horn
MLG MLG Horn
NCP Inception
PTY Party Horn
QAK Quack
RBX Roblox Death SFX
SAD Sad Trombone
SAX Sexy Sax
SFL Seinfeld
SHY Fluttersquee
SWX Nintendo Switch
TDA Tada SFX
VLN Sad Violin
VVZ Vuvuzela
WHP Whip
WKA Waka waka
WLH Wilhelm scream
WSL That Dramatic Whistle Thing
XFL Illuminati
XPE XP Error
2 Arguments
FRG #,? : replace the argument(s) in the code at line # with ?
FSW #,# : swap the code at the specified lines
3 Arguments
WAV #,#,? : soundzzzz
4 Arguments
FAA #,#,#,# : replace the code from char #1 to char #2 with the code
from char #3 to char #4.
| Brainfuck | Mochine |
|---|---|
| > | MOV 1 |
| < | MOV -1 |
| + | RPN 1, |
| - | RPN 1,~ |
| . | INP |
| , | OUT @ |
| [ | :? |
| ] | JJJ @!=0 ? |
| Brainflak | Mochine |
|---|---|
| () | RPN 1, |
| (n) | LET @ n MOV 1 |
| [] | LET @ $ |
| [n] | LET * 0 SWP @ * RPN *,- |
| {} | LET * 0 SWP @ * MOV -1 |
| <> | RPN 0, |
| <n> |
Prints 1 without using any numbers.
RPN egg,] OUT @
Compressed: 7 bytes.
rg,] o@
A 'Hello, World!' program.
OUT Hello, world!
Compressed: 14 bytes.
oHello, world!
Adds the inputs
INP SWP @ * INP RPN *, OUT @
Compressed: 15 bytes.
i x@ * i r*, o@
Finds the nth triangular number.
INP RPN @,2,^2 SWP @ * RPN *,2,/ OUT @
Compressed: 24 bytes.
i r@,2,^2 x@ * r*,2,/ o@
Prints the current year.
TIM SWP @ * RPN *,31556952,/1970,+# OUT @
Compressed: 30 bytes.
t x@ * r*,31556952,/1970,+# o@
Bonus: prints 2018 without using any numbers.
LEN Written by Mocha~! LET * @ LEN I love using MOCHINE APP * OUT @
Prints the fibonacci numbers. All of them.
OUT 0 LET @ 1 OUT @ MOV 1 LET @ 1 :MAIN OUT @ LET * @ MOV -1 RPN *, OUT @ LET * @ MOV 1 RPN *, JJJ 1 MAIN
Compressed version. 54 bytes.
o0 =@ 1 o@ m1 =@ 1 o@ =* @ m-1 r*, o@ =* @ m1 r*, j1 5
Checks to see if input is Alice or Bob, and, if so, Greet them.
INP LET * Alice JJJ @=* 5 LET * Bob JJJ @!=* X LET @ Welcome, APP * OUT @ :X
Compressed: 54 bytes.
i =* Alice j@=* 5 =* Bob j@!=* X =@ Welcome, a* o@ :X
Checks whether input is a leap year or not. Includes compressed version (82 bytes).
INP LET * @ MOD 400 JJJ @=0 T LET @ * MOD 100 JJJ @=0 F LET @ * MOD 4 JJJ @!=0 F :T LET @ 1 JJJ 1 X :F LET @ 0 :X OUT @
i =* @ MOD 400 j@=0 10 =@ * MOD 100 j@=0 12 =@ * MOD 4 j@!=0 12 =@ 1 j1 13 =@ 0 o@
Does not terminate.
LET @ 0 RPN *,15,% JJJ @=0 XV LET @ 0 RPN *,5,% JJJ @=0 V LET @ 0 RPN *,3,% JJJ @=0 III OUT * :Z MMS 1 JJJ 1 0 :III OUT Fizz JJJ 1 Z :V OUT Buzz JJJ 1 Z :XV OUT FizzBuzz JJJ 1 Z
Compressed: 111 bytes.
=@ 0 r*,15,% j@=0 16 =@ 0 r*,5,% j@=0 14 =@ 0 r*,3,% j@=0 12 o* s1 j1 0 oFizz j1 10 oBuzz j1 10 oFizzBuzz j1 10
Imperfect, but acceptable. Terminates.
LET @ 99 OUT @ OUT bottles of beer on the wall, OUT @ OUT bottles of beer! Take one down, pass it around, RPN 1,~ OUT @ OUT bottles of beer on the wall! JJJ @!=0 1 OUT No more bottles of beer on the wall, no more bottles of beer! OUT Go to the store and buy some more, 99 bottles of beer on the wall!
Compressed: 271 bytes.
=@ 99 o@ obottles of beer on the wall, o@ obottles of beer! Take one down, pass it around, r1,~ o@ obottles of beer on the wall! j@!=0 1 oNo more bottles of beer on the wall, no more bottles of beer! oGo to the store and buy some more, 99 bottles of beer on the wall!
Alternate.
LET * 99 LET @ * APP bottles of beer on the wall, APP * APP bottles of beer! Take one down, pass it around, MMS -1 APP * APP bottles of beer on the wall! OUT @ MOV 1 JJJ @!=* 1 LET @ No more bottles of beer on the wall, no more bottles of beer! APP Go to the store and buy some more, 99 bottles of beer on the wall! OUT @
Compressed: 279 bytes.
=* 99 =@ * a bottles of beer on the wall, a* a bottles of beer! Take one down, pass it around, s-1 a* a bottles of beer on the wall! o@ m1 j@!=* 1 oNo more bottles of beer on the wall, no more bottles of beer! Go to the store and buy some more, 99 bottles of beer on the wall!
This code outputs its first line.
FAA 19,19,0,14 OUT X
My failed 235487th attempt, outputs first line still, but strangely takes ages to terminate.
FAA 40,40,32,39 FAA 36,36,00,32 OUT <br>
This code outputs itself, but as an error, along with other errors:
error: "e" not valid shortcut @ Line 0 error: