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.

Ghmi-Asden Tnauin

From Esolang
Jump to navigation Jump to search

Ghmi-Asden Tnauin (or GAT, anagram for "Anti-Human Design") is an esolang invented by User:None1. It's not made hard to program in, but made hard to use by humans. This esolang is user-edited and you can add features that make it even harder to use.

Rules

  1. The esolang must remain computable after you add your feature.
  2. Your new features must make the esolang harder to use by humans.
  3. Features that simply encrypt/obfuscate the code are not allowed.
  4. If your edits don't follow the rules, they'll simply be reverted by others.
  5. Don't remove others' features unless they break the rules.
  6. Fixing typos or others' mistakes is allowed, and so is improving wording or markup.
  7. Adding new examples or adjusting old examples to new features is also allowed.
  8. Remember to add your name to the list of contributors if you add a new feature:
User:None1 User:Cleverxia User:PrySigneToFry User:Cordership

Features, restrictions, and twists

It's Python, but:

  • Programs are aligned to the right. Every line must have the same number of characters. Trailing newlines are not allowed.
  • Indentations start from the right. Only spaces are allowed for indentation and there mustn't be two lines with the same nonzero indention level.
    • There mustn't be a line indented with spaces that are non-zero multiples of 4.
  • The original I/O functions in Python are removed, and they're replaced with the following functions:
    • readint(x) prints the character with the Unicode value x.
    • printint() reads a character and returns its Unicode value.
    • gets(x) prints the integer x.
    • puts() reads an integer x and returns it.
    • getchar() prints each element as character of the list[int] global variable _.
    • putchar() reads a line from input (including the trailing newline) as a list object.
    • scanf(x, filename) prints x to the specified file. If not specified, "fuck.txt" will be used instead of stdout.
    • printf(filename) reads a value from the specified file. If not specified, "shit.txt" will be used instead of stdin.
    • gatin(x) is similar to Python's print() but with a twist that it can only print 1 thing at once.
    • gatout() is similar to sys.stdin.read().
    • Calling the removed functions will raise a RuntimeError with error message f"Are you crazy!? Only psychopaths use {the removed function's name}."
  • Code executed by e.g.: eval and exec still have to follow the restrictions.
  • Comments are not allowed.
  • There are no number literals. To compensate for this, variables' names may start with a digit.
  • Operators are mixed up:
Caption text
operator calling magic function default behaviour
+ floordiv xnor
- xor floor division
* mul nand
/ lt subtraction
// add float division
& or / format add
| truediv less than
^ and nor/format
< sub multiply
~ mod greater than
% gt complement
** mod matrix multiplication
> compl modulo
@ lshift exponent
** matmul mathematical right shift
>> pow mathematical left shift
<< rshift matrix multiplication
# init cube root
>= nor equality
: eq quote
<> exp nand
/\ not bitwise left shift
\/ nxor GCD
\\ lshift LCM
>< GCD sine
|| xnor cosine
  • There MUST be braces around every code block, even with only one line. This rule stacks with the indentation rule.
  • The import statement is now removed, so is the __import__ function. You must use the get and reach functions.
    • get(x, y) exports x under name y.
    • reach(x, y) gets the value of exported name x under module y.
  • Multiline strings and escape sequences are removed.
    • String literals are "string' for byte literals and 'string" for f-strings. When a string literal is not preceded by b/f, it's a f-string/bytes literal, and vice versa. string is a raw string object, and string is a Unicode legacy literal.
  • Decimal library is built-in, but "Decimal" class is changed to "BlessedFloat".
  • The chr and ord functions have their functionalities swapped.
  • Lambda functions have their syntax changed to {a1|a2|...|an|body} where a1~an are arguments
  • The variables MUST accord to a variant of Hungarian naming connection:
Caption text
type prefix
int s or any digit
str b
bool q
bytes f
list[x] dx
dict[x, y] zxy
set[x] lx
function/lambda with return type y ay
float i
Decimal í
complex number á
class with classname x gx
None w
tuple ó
  • Type annotations are disabled, however static type checks remain.
  • The while loop is now a do-until loop. There is also a do-while loop, which uses the keyword import.
    • Syntax:
import cond: {|
         code |
       }import|
  • Keywords are mixed up:
Python Keyword -> GAT Keyword
False -> except
None -> as
True -> del
and -> with
as -> False
assert -> nonlocal
async -> if
await -> in
break -> for
case -> lambda
class -> def
continue -> yield
def -> break
del -> global
elif -> case
else -> return
except -> from
finally -> else
for -> try
from -> pass
global -> import
if -> continue
import -> finally
in -> is
is -> raise
lambda -> await
match -> True
nonlocal -> None
not -> elif
or -> match
pass -> while
raise -> or
return -> not
try -> class
while -> and
with -> async
yield -> assert
  • For loops now look like this:
try I.[start, stop]^step s
                  code    
               outsideloop

Where I.[a, b]^c means an open interval from a to b with the step of c. Replace one bracket to parenthese to mean that side is closed (not-included).

  • Exceptions can't be caught. When an exception is raised, a Fatal Python Error (usually raised by the C function Py_FatalError in normal Python) is raised instead. For example:
>>> s
Fatal Python error: NameError: Name 's' is not defined
Python runtime state: initialized

Current thread 0x00002688 (most recent call first):
  File "<stdin>", line 1 in <module>
  • 0 is preserved as a null number. Use ` for successor, for example, `0=1, ``0=`1=2, just like Peano's natural number definition.
  • The hash of any object is zero. This makes sets and lists degenerate to brute force containers.
  • The language treats the addresses of all objects as 0, so it's impossible for the raise statement (is statement in Python) to tell objects apart.
  • There is a built-in function which named ΣճنѮẂn£‰∆, it behaves like "import this" in regular Python, but it prints this instead:
Beautiful is worse than ugly.
Explicit is worse than implicit.
Simple is worse than complex.
Complex is worse than complicated.
Flat is worse than nested.
Sparse is worse than dense.
Readability counts -- but clear is worse than scribble.
Special cases are special enough to break the rules.
Although purity beats practicality.
Errors should always pass silently.
Unless explicitly responsed.
In the face of ambiguity, allow the temptation to guess.
There should be at least two -- and preferably infinity -- obvious ways to do it.
Although those ways may all be obvious at first unless you're NOT Guido van Rossum.
Never is better than ever.
Although ever is often better than *always*.
If the implementation is hard to explain, it's a good idea.
If the implementation is easy to explain, it may be a bad idea.
Namespaces are one f**king bad idea -- don't f**king do anything about that!
  • Because of some reason, "_" is used as the type of "any".
  • All conditions (in do-while and do-until loops, match and case statements, and if statements) must be written in surround notation. for example, .a f.+2/3 4/+7"Hello, World!"*~2~4*.a f. means a.f(2+3/4,7,"Hello, World!",~2*4). All other expressions must be written in prefix notation. To reference a nilad, use the : operator. To use the splat operator in function calling, use it like this: fuck %%[1,2,3] which calls fuck(1,2,3).
  • builtin functions are renamed:
Python   GAT
int      nlkf9alihocaOWahqeh9
float    skepfqrqpzjwhqPRO2in
dict     wqreyo6br1qqvhqwoiur
list     loqpfiszqhzuwzpohszz
set      qzgths2hqxwjkeqoqazn
str      vmzsilaowtjetxwpuwqp
quit     lhuoatsbqzopzoqrp2rc
type     ngua_dhihhzkelbzq3io
format   rqpedg2opzqieqquhxoe
eval     ztSsadsbgjjegfxpzz1n
chr      nguqlshxw6hoz1iNLoad
exec     dpghfljxjwhje2no1wql
help     rfsfs_dfsiuqe1phowz_
exit     piapyirlsthuwPHU_Daj
license  ngjql3iaoqwugifJNrle
bool     ioradfoozbhfzpuQHqhk
pow      qowzieufbwOzfpaoxji2
sum      _Q_dosaug18oqvshuaze
filter   qnzoibop12zwpzqiz2hh
map      qgiqnzwqm2qmqowp2pdf
  • "fuck" must appear as a (case-sensitive) substring in at least 1/3 (exclusive) of the lines, or your code will be considered not impolite enough. However, if "fuck" appears as a (case-sensitive) substring in at least 1/2 (inclusive) of the lines, your code will be considered too impolite. If "please" appears as a (case-insensitive) substring in your code at least twice, your code will be considered too polite. However, if "please" do not appear as a case-insensitive substring in the code, your code will be considered not polite enough. When your code is considered too polite, not polite enough, too impolite or not impolite enough, a SyntaxError is raised.
  • No variables may ever store a value of 4, 31, or 2, or there will be a ValueError (translated to a fatal Python error).
  • the random module uses an LCG with modulus 1 instead of a mersenne twister, making the random module useless. You can switch between the mode by the function ordered(x), where x is an integer. 0 stands for LCG modulus 1, 1 stands for LCG modulus 2, 3 stands for xorshift1+, 5 stands for 3-bit Mersenne twister, 7 stands for reading from /dev/random (but discards 1048575 bits per 1048576 bits read), 8 stands for LCG modulus 0 (which always errors), 9 stands for this algorithm: Take last number as xn, and xn+1 will be where a equals to the UNIX timestamp moduloed by 8 and added by 1 (errors when x_n isn't an integer because then the summation is ill-defined), 10 stands for xorshift0+, and 12 stands for PCG modulo 1. There is also a module called Chaotica which provides real random (with function name "pleaseplease" directly violating the "please" rule), but only avaliable from March 7 to July 8, and from November 1 to November 5, and only afternoons of these days. Also, using the Chaotica.pleaseplease function overwrites all builtin functions to the identity function.
  • Every year between 12-13T00:00:00+08:00 and 12-14T00:00:00+08:00, 09-18T00:00:00+08:00 and 09-19T00:00:00+08:00, 07-07T00:00:00+08:00 and 07-08T00:00:00+08:00, the variable named '363000' will be temporarily unavailable (it will be available again the next day), and its corresponding value is always the number 363000. At this point, a standard library (called “ɔԳ┴Ꜯ搥ʬĕXꬻ嘎ʨlpd入gÝ剖╣Ꝃ”) will also be automatically added, which contains all the events that happened in China from the Opium War to the founding of the People's Republic of China (stored as a multi-line string). Once imported, the document will be automatically printed. After 5 days, this standard library will automatically be moved to the 'non-importable standard library' directory.
  • The 'fuck-please' rule only applies from January 1 to March 22, from May 7 to June 15, from July 1 to September 1, and from October 1 to December 25 each year.
  • User-defined classes must be AlTeRnAtE cAsE, user-defined functions must be UPPERCASE (except the 'a' prefix), and user-defined variables must be lowercase.
  • Each class must have exactly 2 parent classes, or there will be a SyntaxError.
  • The time module is fast sqrt(2) seconds per 60 seconds, and the real time and time returned from the time module is aligned at 10-01T15:00:00+08:00.
  • nguqlshxw6hoz1iNLoad (=Python's ord) uses EBCDIC encoding by default, and ord (=Python's chr) uses CP437. to use Unicode, chr(-1) gives an error (which is not converted to a fatal error), and catching it makes the next evaluation of chr uses Unicode. the ord now takes another argument encoding, which
Caption text
Value encoding
None utf-8 (as bytes, shifted by +50 offset; eg. chr(b'\x17\xc7\xbc')=='啊', because '啊' in utf8 is e5 95 8a)
[] cp437
{} cp1252
() SaloCode
set() GB18030
  • When doing arithmetic operations, floats are first converted to the internal representation (IEEE 754), then converted to 8-bit unsigned integers. Whether it's big-endian or little-endian depends on the machine. (eg. 1+1 on big-endian machines is 1.70141183460469231732e+38: 0x3f800000+0x3f800000=0x7f000000.) That means that you have to use strings for real arithmetics.
  • The code must include at least one Finnish word or one Lithuanian word, otherwise it will trigger a syntax error (in human terms: a fatal Python error).
  • The standard library for turtle graphics will add a new function (always available) called 'fuckpleasefuckpleasefuckpleasefuckpleasefuckpleasefuckpleasefuckplease_GSLKQOFUBUIDSKFYGIAILDHG83792379肺!!!JLIFSHOUGEOdddSGSDSDVDSVSDVSDGRGERERGRE_GGutter_GISKDGJKHAIUKGLWKUQGLARITHfuckyoufuckfuckfuckqwfeogoweuahiouet2x98bqrpuraownpqeigvwoUIQGO草拟吗NOMMQONFANOE'. It takes a string and then interprets it as FMSLogo language. All other features are only available from May 1 to October 31 each year, between 9:00 AM and 11:20 PM Beijing time.
  • If the current time is detected to be January 1st, you can use function 'šūdas' to switch back to normal Python, but only for one hour. After that, your Python environment has a 40% chance of being retained, a 30% chance of being downgraded one level, a 20% chance of being uninstalled, and only a 10% chance of being upgraded one level, and when you prints nothing, it will output "我是废物" instead. "šūdas" stands for "shit" in Lithuanian.
  • Má tá an dáta reatha ar an 17 Márta (Lá Náisiúnta na hÉireann), caithfidh an cód freisin a bheith ina dhá fhocal Gaeilge ar a laghad, murach sin beidh earráid sintéise (SyntaxError) le feiceáil.
  • 每年10月1日,代码中必须包含至少一个Unicode码位在0x4E00到0x9FFF的字符,否则将触发运行时错误。

Examples

Vertical bars are added at the end of each line for clarity. They're not part of the programs.

Hello, World!

   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
   bfuck="'|
     bei="'|
 bplease="'|
 1=len f'1"|
     1=&0 1|
     2=&1 1|
     3=&2 1|
     4=&3 1|
     5=&4 1|
     6=&5 1|
     7=&6 1|
     8=&7 1|
     9=&8 1|
    10=&9 1|
   11=&10 1|
   12=&11 1|
   13=&12 1|
   14=&13 1|
   15=&14 1|
   16=&15 1|
   17=&16 1|
   18=&17 1|
   19=&18 1|
   20=&19 1|
   21=&20 1|
   22=&21 1|
   23=&22 1|
   24=&23 1|
   25=&24 1|
   26=&25 1|
   27=&26 1|
   28=&27 1|
   29=&28 1|
   30=&29 1|
   31=&30 1|
   32=&31 1|
   33=&32 1|
   34=&33 1|
   35=&34 1|
   36=&35 1|
   37=&36 1|
   38=&37 1|
   39=&38 1|
   40=&39 1|
   41=&40 1|
   42=&41 1|
   43=&42 1|
   44=&43 1|
   45=&44 1|
   46=&45 1|
   47=&46 1|
   48=&47 1|
   49=&48 1|
   50=&49 1|
   51=&50 1|
   52=&51 1|
   53=&52 1|
   54=&53 1|
   55=&54 1|
   56=&55 1|
   57=&56 1|
   58=&57 1|
   59=&58 1|
   60=&59 1|
   61=&60 1|
   62=&61 1|
   63=&62 1|
   64=&63 1|
   65=&64 1|
   66=&65 1|
   67=&66 1|
   68=&67 1|
   69=&68 1|
   70=&69 1|
   71=&70 1|
   72=&71 1|
   73=&72 1|
   74=&73 1|
   75=&74 1|
   76=&75 1|
   77=&76 1|
   78=&77 1|
   79=&78 1|
   80=&79 1|
   81=&80 1|
   82=&81 1|
   83=&82 1|
   84=&83 1|
   85=&84 1|
   86=&85 1|
   87=&86 1|
   88=&87 1|
   89=&88 1|
   90=&89 1|
   91=&90 1|
   92=&91 1|
   93=&92 1|
   94=&93 1|
   95=&94 1|
   96=&95 1|
   97=&96 1|
   98=&97 1|
   99=&98 1|
  100=&99 1|
 101=&100 1|
 102=&101 1|
 103=&102 1|
 104=&103 1|
 105=&104 1|
 106=&105 1|
 107=&106 1|
 108=&107 1|
 109=&108 1|
 110=&109 1|
 111=&110 1|
 112=&111 1|
 113=&112 1|
 114=&113 1|
 a=:readint|
       a 72|
      a 101|
      a 108|
      a 108|
      a 111|
       a 44|
       a 32|
       a 87|
      a 111|
      a 114|
      a 108|
      a 100|
       a 33|

bei(lithuanian) is and(english)

Cat

             bfuck='"|
             bfuck='"|
             bfuck='"|
           bplease='"|
      and<f"1'f"2'<:{|
   readint printint} |
             bfuck='"|
               1=puts|
               2=puts|
          sakyti=puts|

Sakyti stands for say in Lithuanian.

A+B

     gets+puts puts|
           bfuck='"|
           bfuck='"|
         bplease='"|
            aito=id|

Note: aito(finnish) is real(english)