Skip to content

Instantly share code, notes, and snippets.

@cbrwn
Last active June 14, 2022 09:03
Show Gist options
  • Save cbrwn/10449729 to your computer and use it in GitHub Desktop.
Save cbrwn/10449729 to your computer and use it in GitHub Desktop.
Green Eggs and Ham in Brainfuck
--[----->+<]>-----<[-]>>[-]<<-[--->>>++++++++++[<++++>-]<<<]>>-------<<[-]
>>>>[-]<<<<+++[>>>>+++++++++++<<<<-]++[>>++++<<-]>>.>>-.<<<.<++[>++++++<-]
>.>>.>.<<<<++[>>+++++<<-]>>.<<++[>------<-]>.<++[>++++++<-]>.<++++++++++..
[-]++[>>-----<<-]>>.>>.<<<<+++[>----<-]>.<+++[>++++<-]>.>>.>.<<<<++[>>++++
+<<-]>>.<<++[>------<-]>.<++[>++++++<-]>.<++++++++++.[-]>>.<<+++[>----<-]>
.<+++[>++++<-]>.>>>.<<<<++[>>-----<<-]>>.>>.<<<<+++[>----<-]>.<++[>++++++<
-]>.<++++++++++..[-]++[>>+++++<<-]>>+.<-----.<++[>---<-]>-.<+++[>++++++<-]
>+.>>>.<<-.<<++++[>-----<-]>+.<+++[>++++<-]>.<+++[>>>>++++<<<<-]>>>>+.<<<<
++[>>-----<<-]>>.>>.<<<<+++[>----<-]>.<+++[>++++<-]>.<+++[>>>>----<<<<-]>>
>>.<<<<++++++++++.[-]++[>>+++++<<-]>>+.<-----.<++[>---<-]>-.<+++[>++++++<-
]>+.>>>-.<<-.<<++++[>-----<-]>+.<+++[>++++<-]>.<+++[>>>>++++<<<<-]>>>>+.<<
<<++[>>-----<<-]>>.>>.<<<<+++[>----<-]>.<+++[>++++<-]>.<+++[>>>>----<<<<-]
>>>>.<<<<++++++++++.[-]>>.>>-.<<<<++[>----<-]>-.<++[>+++++<-]>+.>>>.<<<-.+
.+++++.>>>.<<<<++[>----<-]>.---.++.------.<++++++++++.[-]+++[>+++++<-]>.<+
++[>----<-]>.<++[>---<-]>-.<+++[>++++++<-]>+.>>>.<<<<++[>>+++++<<-]>>.<<++
+[>------<-]>-.<+++[>++++<-]>.<+++[>>>>++++<<<<-]>>>>+.<<<<++[>>-----<<-]>
>.>>.<<<<+++[>----<-]>.<+++[>++++<-]>.<+++[>>>>----<<<<-]>>>>.<<<<++++++++
++..[-]>>-----.<++.>>>-.<<<<++[>+++++<-]>.<++[>-----<-]>.<++[>+++<-]>.>>>.
<<<<++[>-----<-]>+.---.++.<++[>---<-]>.<++++++++++.[-]>++.<++[>+++++<-]>+.
<+++[>----<-]>-..<++[>++++<-]>+.>>>.<<<<++[>----<-]>-.++..<+++[>++++<-]>.>
>>.<<<<++++[>-----<-]>++.<+++[>++++<-]>+.<++[>-----<-]>.>>>.<<<++++.<++[>-
--<-]>-.<+++[>++++<-]>.>-----.<<++++++++++..[-]++[>>+++++<<-]>>.>>.<<<<++[
>----<-]>-.<++[>+++++<-]>+.>>>.<<<-.+.+++++.>>>.<<<<++[>----<-]>.---.++.<+
+[>---<-]>.>>>.<<<<+++[>+++++<-]>.<+++[>----<-]>.---.<++[>++++<-]>.<+++[>>
>>++++<<<<-]>>>>.<<<<++++++++++.[-]++[>>+++++<<-]>>.<<+++[>----<-]>.<+++[>
++++<-]>.>>>+.<<<<++[>>-----<<-]>>.>>.<<<<+++[>----<-]>.<+++[>++++<-]>.>>>
+.<<<<++++++++++.[-]>>.<<+++[>>>>----<<<<-]>>>>--.<<<<++[>----<-]>-.<+++[>
++++<-]>-.>>>.<<<-.+.+++++.>>>.<<<<++[>----<-]>.---.++.------.<++++++++++.
[-]>++.<+++[>++++<-]>-.<+++[>----<-]>-..<++[>++++<-]>+.>>>.<<<<++[>----<-]
>-.++..<+++[>++++<-]>.>>>.<<<<++++[>-----<-]>++.<+++[>++++<-]>+.<++[>-----
<-]>.>>>.<<<++++.<++[>---<-]>-.<+++[>++++<-]>.<++[>>>>+++++++<<<<-]>>>>.<<
[- Section of Dr Seuss' "Green Eggs and Ham"
Written by Cameron Brown : quentin(dot)sx
Output(; represents period/comma and _ represents hyphen):
"I am Sam
I am Sam
Sam I am
That Sam_I_am!
That Sam_I_am!
I do not like
that Sam_I_am!
Do you like
green eggs and ham?
I do not like them;
Sam_I_am;
I do not like
green eggs and ham;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment