1
\$\begingroup\$

This question already has an answer here:

The Setup
Jim the student who attempts to use Stack Overflow to do his homework has asked how to get his program to say "Hello World" in under 100 lines of code, you decide mere mortal trolling is not enough...

The Challenge
You need to provide Jim with a program less than 100 lines long that outputs a satisfactory answer in another language. Bonus points for additional languages.

The Rules
1. Max 100 lines of code
2. 10 points for successfully outputting the answer in another language
3. +1 point for every additional language answer is provided for
4. Honorable mentions will be given to the most creative, most evil, and most unorthodox answers
5. Challenge ends 23:59pm GMT 3/14/2014 (results provided a few hours post challenge)

The winner is Michael who converted between six languages first

I also will give an honorable mention for cleverness to McMillin for using one command that works in several languages

I also give an honorable mention to Comintern... I don't actually know if brownies is a language, but I think we can agree it was unorthodox.

I don't think any of the answers qualifies as evil, but for the sake of it everyone who used brainfuckery will be considered recipients.

\$\endgroup\$

marked as duplicate by Jonathan Van Matre, grovesNL, Gareth, Peter Taylor, manatwork Mar 14 '14 at 8:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Welcome to PPCG. We reserve the code-golf tag for challenges strictly scored by least number of bytes/characters. Code-trolling also fails to apply here since the task you have set up is a straightforward polyglot. The only trolling involved is introduced by your backstory. Look at some past code-trolling questions; usually the aim is to do a simple task in a way that embodies/parodies common programming pitfalls, easily missed bugs, abuse of paradigms, non-idiomatic coding, etc. At its best, code-trolling should be about showing your skill by astute parody of the unskilled approach. \$\endgroup\$ – Jonathan Van Matre Mar 13 '14 at 20:50
  • 1
    \$\begingroup\$ My apologies, I thought it fit code-trolling section, I'll be more careful about future tagging. \$\endgroup\$ – RualStorge Mar 13 '14 at 20:54
  • 1
    \$\begingroup\$ By another language you mean? A programming language or natural langauge? Also, what about languages that share the same keyword to print (e.g. 'print' in several languages) \$\endgroup\$ – Hunter McMillen Mar 13 '14 at 20:58
  • \$\begingroup\$ Well my intended purpose was from one programming language to another, but also different natural languages would be even more trollish. Shared solutions... since I didn't specify so long as you properly credit that you covered the language I'll count it. \$\endgroup\$ – RualStorge Mar 13 '14 at 21:02
  • \$\begingroup\$ I think you should clarify your rule as programming language. I posted my answer only because I thought it would be funny, I didn't even expect you to consider it a valid answer. \$\endgroup\$ – ace Mar 13 '14 at 21:41
10
\$\begingroup\$

JavaScript to C to PHP to JavaScript to Brainfuck to HQ9+

atob("bWFpbigpe3B1dHMoImVjaG8gXCJjb25zb2xlLmxvZygnKysrKysrWz4rKysrKysrKysrKys8LV0+LicpO1wiOyIpO30=")

This outputs :

main(){puts("echo \"console.log('++++++[>++++++++++++<-]>.');\";");}

Which outputs :

echo "console.log('++++++[>++++++++++++<-]>.');";

Which outputs :

console.log('++++++[>++++++++++++<-]>.');

Which outputs :

++++++[>++++++++++++<-]>.

Which outputs :

H

Which outputs :

Hello World!
\$\endgroup\$
15
\$\begingroup\$

Bash

echo Bonjour tout le monde

Outputs "Hello World" in a language called French.

\$\endgroup\$
  • \$\begingroup\$ Oops... I thought it was a code-trolling question. I just realised this was retagged. Apologies if you think this is not an answer. \$\endgroup\$ – ace Mar 13 '14 at 20:59
  • 6
    \$\begingroup\$ French language? Is it a LISP dialect? \$\endgroup\$ – gilbertohasnofb Mar 13 '14 at 21:35
5
\$\begingroup\$

C# -> Chef -> German\Brownies

using System;
using System.Text;

namespace Greetings
{
    class Program
    {
        static string[] ingredients = {" vegetable oil "," eggs "," boiling water "," vanilla "," cocoa powder "," flour "," sugar "," baking soda "," salt "};
        static string[] measures = {" tablespoons"," dashes"," heaped tablespoons",""," pinches"};
        static int[] amounts = {154,32,157,127,110,145,164,141,154};
        static int[] units = {0,3,0,1,2,2,2,4,4};
        static int[] steps = {4,7,0,8,2,1,3,5,0,6};

        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder("Fudge Brownies.\n\nThis recipe makes an absurd amount of brownies for one person.\n");
            sb.Append("\nPre-heat oven to 175 degrees Celsius.\n\nIngredients.\n");

            for (int i = 0; i < ingredients.Length; i++)
            {
                sb.Append(amounts[i]);
                sb.Append(measures[units[i]]);
                sb.Append(ingredients[i]);
                sb.Append("\n");
            }

            sb.Append("\nMethod.\n");

            for (int i = 0; i < steps.Length; i++)
            {
                sb.Append("Put");
                sb.Append(ingredients[steps[i]]);
                sb.Append("into the mixing bowl.\n");
            }

            sb.Append("Liquefy contents of the mixing bowl.\nPour contents of the mixing bowl into the baking dish.\n");
            sb.Append("\nCooking time: time 40 minutes.\n\nServes 1.");
            Console.WriteLine(sb);
        }
    }
}

The C# code above outputs the Chef code below (which is also a pretty tasty brownie recipe).

Fudge Brownies.

This recipe makes an absurd amount of brownies for one person.

Pre-heat oven to 175 degrees Celsius.

Ingredients.
154 tablespoons vegetable oil
32 eggs
157 tablespoons boiling water
127 dashes vanilla
110 heaped tablespoons cocoa powder
145 heaped tablespoons flour
164 heaped tablespoons sugar
141 pinches baking soda
154 pinches salt

Method.
Put cocoa powder into the mixing bowl.
Put baking soda into the mixing bowl.
Put vegetable oil into the mixing bowl.
Put salt into the mixing bowl.
Put boiling water into the mixing bowl.
Put eggs into the mixing bowl.
Put vanilla into the mixing bowl.
Put flour into the mixing bowl.
Put vegetable oil into the mixing bowl.
Put sugar into the mixing bowl.
Liquefy contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.

Cooking time: time 40 minutes.

Serves 1.

The hardest part was doing the unit conversions on the recipe, and it really does make an absurd amount of brownies, even for a whole bunch of people. When run through a Chef interpreter, it outputs:

Hallo Welt

Or, "Hello World" in German. I'm not sure if "brownies" technically constitutes a language. If it does, it probably isn't Turing complete.

\$\endgroup\$
2
\$\begingroup\$

Fortran 95 to Batch back to Fortran 95

open(unit=11,file="FOO.BAT")
write(11,"(A)") "@ECHO OFF"
write(11,"(A)") 'ECHO print*, "Hello World!"; end > BAR.F95'
call SYSTEM("FOO.BAT")
call SYSTEM("gfortran BAR.F95 -o BAR.EXE")
call SYSTEM("BAR.EXE")
end

This code produces a file named FOO.BAT, and then executes it automatically. This .BAT file will generate another file named BAR.F95, which is a Fortran code. This code is automatically compiled and executed, finally producing the phrase "Hello World!"

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you mean Batch, not Bash. \$\endgroup\$ – ace Mar 13 '14 at 21:33
  • \$\begingroup\$ Yep, thanks for the correction. \$\endgroup\$ – gilbertohasnofb Mar 13 '14 at 21:34
1
\$\begingroup\$

C++/JavaScript/Python 3

A oneliner:

int main(){puts("alert(\"print(\\\"Hello World!\\\")\")");}

Output is a program in JavaScript that outputs the basic Hello World program in Python 3.

\$\endgroup\$
1
\$\begingroup\$

Perl/Ruby/Python(2)/Fortran/SML

print "Hello World";
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.