Back
Close

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

DPAmar
2,178 views

C# template

Even if you're not familiar with C#, it should be understandable :)

/** HEADERS **/
using System;
using System.Collections.Generic;
class MultiQuine
{
    static void Main(string[] args)
    {
        Dictionary<String, int[]> data = new Dictionary<String, int[]>();
        /** DATA **/
        data.Add("BF", new int[]{/** BF code goes here **/});
        data.Add("CS", new int[]{/** CS code goes here **/});
        data.Add("JS", new int[]{/** JS code goes here **/});
        /** CODE **/
        String language = "CS";
        if (args.Length > 0) language = args[0];
        switch (language)
        {
            case "BF":
                foreach (int i in new int[] {/** BF headers block goes here **/}) Console.Write((char)i);
                foreach (String l in new String[] { "BF", "CS", "JS" })
                {
                    foreach (char c in l) Console.Write(new string('+', (int)c) + ">");
                    Console.Write(">");
                    foreach (int i in data[l]) Console.Write(new string('+', i) + ">");
                    Console.Write(">");
                }
                break;
            case "CS":
                foreach (int i in new int[] {/** CS headers block goes here **/}) Console.Write((char)i);
                foreach (String l in new String[] { "BF", "CS", "JS" })
                    Console.Write("        data.Add(\"" + l + "\", new int[]{" + String.Join(",", data[l]) + "});"+(char)10);
                break;
            case "JS":
                foreach (int i in new int[] {/** JS headers block goes here **/}) Console.Write((char)i);
                foreach (String l in new String[] { "BF", "CS", "JS" })
                    Console.Write(" data['" + l + "']=[" + String.Join(",", data[l]) + "];"+(char)10);
                break;
        }
        foreach (int i in data[language]) Console.Write((char)i);
    }
}

Note: We already define here that

  • JS syntax to add data values will be data[language] = [array of integers]
  • and in BF, the language name as an array, encoded using "+" to have the final char, then ">"; followed by 0, array, separator, then all integers (all non null), followed by an array separator as well

We will make sure these syntaxes will be used.

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