Back
Close

BrainFuck part 8 - JS/C#/BF Multi quine

DPAmar
2,180 views

BF tempalte

And now, the BF template. The data.Add(...) or data[...]=... parts have been encoded in a quick and dirty way

Note that we need to start our code far from memory initial cell, to leave some space needed for code to decimal printing

/** HEADERS **/
>>>>>>>>>>>>>>>>                              16 empty cells
/** DATA **/
++++++++++++++++++++++++++++++++++            B
++++++++++++++++++++++++++++++++>              ** part 2**
++++++++++++++++++++++++++++++++++++          F
++++++++++++++++++++++++++++++++++>            ** part 2**
>
/** BF code goes here **/
>
++++++++++++++++++++++++++++++++++            C
+++++++++++++++++++++++++++++++++>             ** part 2**
++++++++++++++++++++++++++++++++++++++++++    S
+++++++++++++++++++++++++++++++++++++++++>     ** part 2 **
>
/** CS code goes here **/
>
++++++++++++++++++++++++++++++++++++++        J
++++++++++++++++++++++++++++++++++++>          ** part 2**
++++++++++++++++++++++++++++++++++++++++++    S
+++++++++++++++++++++++++++++++++++++++++>     ** part 2 **
>
/** JS code goes here **/
>
/** CODE **/
,>++++++++[-<-------->]+<---                  read input; set else flag; test if=C
[-------                                      not C: test J
  [[-]>-<                                     not J: default case (BF)
    /** BF headers block goes here **/
	<[<]>[.>]<[[-]<]                          print BF headers
    <<[[<]<]                                  go 2 cells before map
	<++++++++[->+++++>++++++++<<]>+++>--      generate 43 and 62
	>[                                        for each map entry or key
	  [[-<<<+>.>>]<.[->+<]<[->+<]>>>]         write 43 and 62 as needed and move these values
	<.[->+<]<[->+<]>>>]                       process next map entry or key
	<[-]<[-]<<<[[<]<]>>[>]>[.>]               print BF code
	>[[>]>]>>>                                go back to loop original position
  ]>[-<                                        J (so JS)
    /** JS headers block goes here **/
	<[<]>[.>]<[[-]<]                          print JS headers
	<<[[<]<]>>                                go to first map entry
	[                                         for each entry
	  <<++++++++[->++++<]>.+[-<+++>]<+.---    data addition syntax in JS
	  .+++++++++++++++++++.---------------     ** part 2 **
	  ----.------.[-]+++++[->++++++++<]>-.     ** part 3 **
	  [-]>[.[-<<<<<<<<<<<<<<+>>>>>>>>>>>>>>]>]key (leave space for code to decimal conversion)
	  +++++[-<++++++++>]<-.--------[->+++<    data addition syntax in JS after key
	  ]>.[---<++>]<-.-[-->+++<]>+.             ** part 2 **
	  [-]>[                                   value
	    [-<<<<<<<<<<<<+<<+>>>>>>>>>>>>>>]     print each decimal code
		<<<<<<<<<<<<[>>>>++++++++++<<<<[->     ** with a comma **
		+>>+>-[<-]<[->>+<<<<[->>>+<<<]>]<<]    ** if there is another number **
		>+[-<+>]>>>[-]>[-<<<<+>>>>]<<<<]<[>    ** continued **
		++++++[<++++++++>-]<-.[-]<]>>>>>>>     ** continued **
		>>>>>>+>[<++++++[-<++++++>]<++.[-]>    ** continued **
		]<[-<]>>                               ** continued **
	  ]                                       end of value
	  ++++[-<++++++++>]<-[-<+++>]<.[--->++<   data addition syntax in JS after value
	  ]>---.[-]++++++++++.[-]>>                 ** part 2 **
	]                                         map creation is over
	<<<<<<<<<<<<<<<<[<]>[.>]                  print JS code
	>>>>>>>>>>>>>>>                           go back to loop original position
  >]<]>[-                                      C (so CS)
    /** CS headers block goes here **/
	<[<]>[.>]<[[-]<]                          print CS headers
	<<[[<]<]>>                                go to first map entry
	[                                         for each entry
	  <<++++++++[->++++<]>........+[-<+++>]   data addition syntax in CS
	  <+.---.+++++++++++++++++++.----------    ** part 2 **
	  ---------.-----[-->+<]>.++[---<++++>]    ** part 3 **
	  <+.+[-->+++<]>+..[--<+>]<----------.-    ** part 4 **
	  -----.[-]>>                              ** part 5 **
	  [.[-<<<<<<<<<<<<<<+>>>>>>>>>>>>>>]>]    key (leave space for code to decimal conversion)
	  ++++++++[-<++++>]<++.++++++++++.-----   data addition syntax in CS after key
	  -------.+++++[->+++<]>-.---------.+++    ** part 2 **
	  +++++++++++++++.+[----<+>]<++.+++[->+    ** part 3 **
	  ++<]>.+++++.++++++.[----<+++>]<++++.+    ** part 4 **
	  +.[--->++++<]>-.                         ** part 5 **
	  [-]>[                                   value
	    [-<<<<<<<<<<<<+<<+>>>>>>>>>>>>>>]     print each decimal code
		<<<<<<<<<<<<[>>>>++++++++++<<<<[->     ** with a comma **
		+>>+>-[<-]<[->>+<<<<[->>>+<<<]>]<<]    ** if there is another number **
		>+[-<+>]>>>[-]>[-<<<<+>>>>]<<<<]<[>    ** continued **
		++++++[<++++++++>-]<-.[-]<]>>>>>>>     ** continued **
		>>>>>>+>[<++++++[-<++++++>]<++.[-]>    ** continued **
		]<[-<]>>                               ** continued **
	  ]                                       end of value
	  +++++[-<+++++>]<[->+++++<]>.--[---<+>   data addition syntax in JS after value
	  ]<.-[--<+++>]<-.[-]++++++++++.[-]>>>     ** part 2 **
	]                                         map creation is over
	<<<<<<<<<<<<<<<<[<]<[<]<[<]>[.>]          print CS code
	>>>>>>>>>>>>>>>>>>>>>>>                   go back to loop original position
]                                                 the end

Minified version

/** HEADERS **/>>>>>>>>>>>>>>>>/** DATA **/+++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>/** BF code goes here **/>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>
>/** CS code goes here **/>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++>>/** JS code goes here **/>/** CODE **/,>++++++++[-<-------->]+<---[-------[[-]>-</*
* BF headers block goes here **/<[<]>[.>]<[[-]<]<<[[<]<]<++++++++[->+++++>++++++++<<]>+++>
-->[[[-<<<+>.>>]<.[->+<]<[->+<]>>>]<.[->+<]<[->+<]>>>]<[-]<[-]<<<[[<]<]>>[>]>[.>]>[[>]>]>>
>]>[-</** JS headers block goes here **/<[<]>[.>]<[[-]<]<<[[<]<]>>[<<++++++++[->++++<]>.+
[-<+++>]<+.---.+++++++++++++++++++.-------------------.------.[-]+++++[->++++++++<]>-.[-]>
[.[-<<<<<<<<<<<<<<+>>>>>>>>>>>>>>]>]+++++[-<++++++++>]<-.--------[->+++<]>.[---<++>]<-.-[-
->+++<]>+.[-]>[[-<<<<<<<<<<<<+<<+>>>>>>>>>>>>>>]<<<<<<<<<<<<[>>>>++++++++++<<<<[->+>>+>-[<
-]<[->>+<<<<[->>>+<<<]>]<<]>+[-<+>]>>>[-]>[-<<<<+>>>>]<<<<]<[>++++++[<++++++++>-]<-.[-]<]>
>>>>>>>>>>>>+>[<++++++[-<++++++>]<++.[-]>]<[-<]>>]++++[-<++++++++>]<-[-<+++>]<.[--->++<]>-
--.[-]++++++++++.[-]>>]<<<<<<<<<<<<<<<<[<]>[.>]>>>>>>>>>>>>>>>>]<]>[-/** CS headers block
 goes here **/<[<]>[.>]<[[-]<]<<[[<]<]>>[<<++++++++[->++++<]>........+[-<+++>]<+.---.+++++
++++++++++++++.-------------------.-----[-->+<]>.++[---<++++>]<+.+[-->+++<]>+..[--<+>]<---
-------.------.[-]>>[.[-<<<<<<<<<<<<<<+>>>>>>>>>>>>>>]>]++++++++[-<++++>]<++.++++++++++.--
----------.+++++[->+++<]>-.---------.++++++++++++++++++.+[----<+>]<++.+++[->+++<]>.+++++.+
+++++.[----<+++>]<++++.++.[--->++++<]>-.[-]>[[-<<<<<<<<<<<<+<<+>>>>>>>>>>>>>>]<<<<<<<<<<<<
[>>>>++++++++++<<<<[->+>>+>-[<-]<[->>+<<<<[->>>+<<<]>]<<]>+[-<+>]>>>[-]>[-<<<<+>>>>]<<<<]<
[>++++++[<++++++++>-]<-.[-]<]>>>>>>>>>>>>>+>[<++++++[-<++++++>]<++.[-]>]<[-<]>>]+++++[-<++
+++>]<[->+++++<]>.--[---<+>]<.-[--<+++>]<-.[-]++++++++++.[-]>>>]<<<<<<<<<<<<<<<<[<]<[<]<[<
]>[.>]>>>>>>>>>>>>>>>>>>>>>>>]
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants