H๐ŸŒ+

From Esolang
Jump to navigation Jump to search

H๐ŸŒ+ (Or HWorld+) is a joke esoteric programming language that is an extension of H๐ŸŒ. The extended parts were made by Cinnamony.

Commands

h - Prints out "Hello!".
w - Prints out "World!".
hw - Prints out "Hello, world!".
hh - Prints out "Hello, hello!".
wh - Prints out "World, hello!".
ww - Prints out "World, world!".
hww - Prints out "Hello, world, world!".
hwh - Prints out "Hello, world, hello!".
hhw - Prints out "Hello, hello, world!".
hhh - Prints out "Hello, hello, hello!".
whh - Prints out "World, hello, hello!".
whw - Prints out "World, hello, world!".
wwh - Prints out "Word, word, hello!".
www - Prints out "World, world, world!".
hwww - Prints out "Hello, world, world, world!".

I'm pretty sure you can figure out the pattern by now. All incorrect commands (not made of h or w) repeat themselves. There is also:

q - Terminates the program.

Quine

THIS IS A QUINE

The uppercase "Q" does not terminate the program, and the uppercase "H" does not print "Hello," in the code. Or, a more simple quine:

a

Hello World

hwq

World world hello world world world hello hello hello world

wwhwwwhhhwq

Nop

q

Interpreter

Here is an interpreter in C++ by User:None1:

#include<string>
#include<iostream>
using namespace std;
string s,o;
signed main(){
	getline(cin,s);
	int last=-1,first=-1;
	for(int i=0;i<s.size();i++){
		if(s[i]=='q') break;
		if(s[i]=='h'||s[i]=='w'){
			first=i;
			break;
		}
	}
	for(int i=0;i<s.size();i++){
		if(s[i]=='q') break;
		if(s[i]=='h'||s[i]=='w'){
			last=i;
		}
	}
	for(int i=0;i<s.size();i++){
		if(s[i]=='q') break;
		else if(s[i]=='h'){
			if(last==i&&first==i) o+="Hello!";
			else if(last==i) o+="hello!";
			else if(first==i) o+="Hello, ";
			else o+="hello, ";
		}
		else if(s[i]=='w'){
			if(last==i&&first==i) o+="World!";
			else if(last==i) o+="world!";
			else if(first==i) o+="World, ";
			else o+="world, ";
		}else{
			o+=s[i];
		}
	}
	cout<<o<<endl;
	return 0;
}