We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

hatemath

From Esolang
Jump to navigation Jump to search

hatemath is an esoteric programming language that was created by Saketh Suresh in 2018. The language uses 8 commands, 1 for printing, 3 for telling the type of variable and the other 4 for manipulating the variable.

How it works

hatemath works with only one variable called X. The 4 commands for the manipulation of X depend on its type.

Commands

The 8 commands used in hatemath are:

Command Description
[ sets the type of X to a Nonevalue (there are no operations for this type of variable)
< sets the type of X to a character with default value being ' '
> sets the type of X to an integer with default value being 0
+ increments X by 1 if the type of X is an integer
- decrements X by 1 if the type of X is an integer
* moves 1 character forward if the type of X is a character (eg. ' ' -> 'a' -> 'b' and so on)
/ moves 1 character backward if the type of X is a character (eg. 'a' -> ' ' -> 'z' and so on)
] prints the current value of X

Note: In hatemath the whole code is written in one line.

Examples

A simple program that prints "6 abb"

[>++++++]<]*]*]]

Hello, World!

[<********]///]*******]]***]<]////]////////]***]//////]////////]

Python 3 interpreter

import sys
code = ""
while code != "q":
	code = input()
	for a in code:
		if a == "[":
			x = None
		if a == ">":
			x = 0
		if a == "+":
			x += 1
		if a == "-":
			x -= 1
		if a == "]":
			sys.stdout.write(str(x))
		if a == "<":
			x = " "
		if a == "*":
			if x == " ":
				x = "a"
			elif x == "a":
				x = "b"
			elif x == "b":
				x = "c"
			elif x == "c":
				x = "d"
			elif x == "d":
				x = "e"
			elif x == "e":
				x = "f"
			elif x == "f":
				x = "g"
			elif x == "g":
				x = "h"
			elif x == "h":
				x = "i"
			elif x == "i":
				x = "j"
			elif x == "j":
				x = "k"
			elif x == "k":
				x = "l"
			elif x == "l":
				x = "m"
			elif x == "m":
				x = "n"
			elif x == "n":
				x = "o"
			elif x == "o":
				x = "p"
			elif x == "p":
				x = "q"
			elif x == "q":
				x = "r"
			elif x == "r":
				x = "s"
			elif x == "s":
				x = "t"
			elif x == "t":
				x = "u"
			elif x == "u":
				x = "v"
			elif x == "v":
				x = "w"
			elif x == "w":
				x = "x"
			elif x == "x":
				x = "y"
			elif x == "y":
				x = "z"
			elif x == "z":
				x = " "

		if a == "/":
			if x == " ":
				x = "z"
			elif x == "z":
				x = "y"
			elif x == "y":
				x = "x"
			elif x == "x":
				x = "w"
			elif x == "w":
				x = "v"
			elif x == "v":
				x = "u"
			elif x == "u":
				x = "t"
			elif x == "t":
				x = "s"
			elif x == "s":
				x = "r"
			elif x == "r":
				x = "q"
			elif x == "q":
				x = "p"
			elif x == "p":
				x = "o"
			elif x == "o":
				x = "n"
			elif x == "n":
				x = "m"
			elif x == "m":
				x = "l"
			elif x == "l":
				x = "k"
			elif x == "k":
				x = "j"
			elif x == "j":
				x = "i"
			elif x == "i":
				x = "h"
			elif x == "h":
				x = "g"
			elif x == "g":
				x = "f"
			elif x == "f":
				x = "e"
			elif x == "e":
				x = "d"
			elif x == "d":
				x = "c"
			elif x == "c":
				x = "b"
			elif x == "b":
				x = "a"
			elif x == "a":
				x = " "

External resources