Skip to main content
Commonmark migration
Source Link

Use Brainfuck

#Use Brainfuck PrettyPretty much all BF implementations cast out chars that aren't +-<>[].,, which just so happens to work in our favor!

BF is probably one of the easiest languages to work into a polyglot because of this feature, as long as you write the BF part first. Once you have your BF code written out, it's just a matter of modeling whatever other code you have around the BF structure.

Here's a really simple example:

.+[.+] 

This pretty much increments and charcode-outputs "forever" (depending on runtime settings). Now if you wanted to write a random piece of code, say, in JS, you could do:

x=>"asdf".repeat(+x)[x*Math.random()*2+1|0] 

Notice how the JS is molded around the BF.

Be sure to know that this works best if you are really set on starting with BF; it's decently harder to start with another language and try to incorporate BF.

#Use Brainfuck Pretty much all BF implementations cast out chars that aren't +-<>[].,, which just so happens to work in our favor!

BF is probably one of the easiest languages to work into a polyglot because of this feature, as long as you write the BF part first. Once you have your BF code written out, it's just a matter of modeling whatever other code you have around the BF structure.

Here's a really simple example:

.+[.+] 

This pretty much increments and charcode-outputs "forever" (depending on runtime settings). Now if you wanted to write a random piece of code, say, in JS, you could do:

x=>"asdf".repeat(+x)[x*Math.random()*2+1|0] 

Notice how the JS is molded around the BF.

Be sure to know that this works best if you are really set on starting with BF; it's decently harder to start with another language and try to incorporate BF.

Use Brainfuck

Pretty much all BF implementations cast out chars that aren't +-<>[].,, which just so happens to work in our favor!

BF is probably one of the easiest languages to work into a polyglot because of this feature, as long as you write the BF part first. Once you have your BF code written out, it's just a matter of modeling whatever other code you have around the BF structure.

Here's a really simple example:

.+[.+] 

This pretty much increments and charcode-outputs "forever" (depending on runtime settings). Now if you wanted to write a random piece of code, say, in JS, you could do:

x=>"asdf".repeat(+x)[x*Math.random()*2+1|0] 

Notice how the JS is molded around the BF.

Be sure to know that this works best if you are really set on starting with BF; it's decently harder to start with another language and try to incorporate BF.

Source Link
Mama Fun Roll
  • 10k
  • 1
  • 38
  • 47

#Use Brainfuck Pretty much all BF implementations cast out chars that aren't +-<>[].,, which just so happens to work in our favor!

BF is probably one of the easiest languages to work into a polyglot because of this feature, as long as you write the BF part first. Once you have your BF code written out, it's just a matter of modeling whatever other code you have around the BF structure.

Here's a really simple example:

.+[.+] 

This pretty much increments and charcode-outputs "forever" (depending on runtime settings). Now if you wanted to write a random piece of code, say, in JS, you could do:

x=>"asdf".repeat(+x)[x*Math.random()*2+1|0] 

Notice how the JS is molded around the BF.

Be sure to know that this works best if you are really set on starting with BF; it's decently harder to start with another language and try to incorporate BF.