I fuck, you fuck

From Esolang
Jump to navigation Jump to search

I fuck, you fuck is a pseudonatural esolang used for insulting others doing Project Euler problems. It is invented by User:None1.

It is case insensitive.

Data Storage

Variables with unbounded unsigned integers are used.

Commands

Variable definition

There's a fucker named X

Define a variable named X, initially zero. The names You, me and I are reserved.

Increment and decrement

I fuck X

Increment X.

I unfuck X

Decrement X, if the result is less than zero, then result in zero.

I/O

You fuck X

Get an integer from user input and store it into X.

You fuck X again

Get a character from user input and store its ASCII into X.

X fucks you

Output X as decimal.

X fucks you again.

Output X as ASCII.

Termination

Fuck you

Terminate the program.

Arithmetic

X fucks Y

Add Y by X.

X unfucks Y

Subtract Y by X, if the result is less than zero, result in zero.

X fucks Y again

Multiply Y by X.

X fucks Y over and over

Let Y be XY.

X unfucks Y again

Let Y be the quotient of X/Y.

X unfucks Y over and over

Let Y be the remainder of X/Y.

Comment

Fuck! Any text

Is a comment, the space is MANDATORY.

Control flow

While loop

while X is fucked
CODE
end fuck

While X is not zero, do CODE.

while X is unfucked
CODE
end fuck

While X is zero, do CODE.

while X is more fucked than the Y 
CODE
end fuck

While X is greater than Y, do CODE.

while X is less fucked than the Y 
CODE
end fuck

While X is less than Y, do CODE.

Conditonal statement

It is like the while loop, just replace the while with if.

The if-else statement is allowed:

Any if statement
CODE1
else fuck
CODE2
end fuck

For instance:

If A is fucked
A fucks you
else fuck
You fuck A
end fuck

Assuming that the variable A is defined, this program outputs A if it is nonzero, otherwise, it reads A.

Literals

Fuck X integer times

Add X by integer.

String output

fuck "Base64 of any text"

Outputs the corresponding text without spaces or line feeds after it.

Example programs

Hello World

fuck "SGVsbG8sIFdvcmxkIQ=="

Project Euler

16

There's a fucker named a
Fuck a 1000 times
There's a fucker named b
Fuck b 2 times
b fucks a over and over
b unfucks b
There's a fucker named c
while a is fucked
c unfucks c
Fuck c 10 times
a unfucks c over and over
c fucks b
c unfucks c
Fuck c 10 times
a unfucks c again
a unfucks a
c fucks a
end fuck
b fucks you

20

There's a fucker named a
There's a fucker named b
Fuck b 100 times
Fuck a 1 times
while b is fucked
b fucks a again
I unfuck b
end fuck
There's a fucker named c
while a is fucked
c unfucks c
Fuck c 10 times
a unfucks c over and over
c fucks b
c unfucks c
Fuck c 10 times
a unfucks c again
a unfucks a
c fucks a
end fuck
b fucks you

Truth Machine

There's a fucker named x
You fuck x
if x is fucked
while x is fucked
x fucks you
end fuck
else fuck
x fucks you
end fuck

Cat Program

There's a fucker named x
you fuck x again
while x is fucked
x fucks you again
you fuck x again
end fuck

Intepreters

Currently none. Here's a compiler in python to C:

#End with "fucker ends fucking", case insensitive
from base64 import b64decode as dc
lic=['#include<stdio.h>\n#define int unsigned long long\nsigned main(){\nint FUCK_YOU=0,FUCK_ME,i,you,me;']
def sw(x,y):return x[:len(y)]==y
def ew(x,y):return x[-len(y):]==y
def swl(x,y,z):return sw(x,y)and len(x)==len(y)+z
def ewl(x,y,z):return ew(x,y)and len(x)==len(y)+z
while True:
    _=input().casefold()
    if _=='':continue
    if _=="fucker ends fucking":
        print('\n'.join(lic),end='\n}\n//Generated by automated IFUF->C python program')
        break
    cmds=_.split()
    if swl(cmds,['i','fuck'],1):lic.append(cmds[2]+'='+cmds[2]+'+1;')
    if swl(cmds,["there's","a",'fucker','named'],1):
        lic.append('int '+cmds[4]+'=0;')
    if swl(cmds,['i','unfuck'],1):
        lic.append('%s=%s-1;if(%s<0)%s=0;'%((cmds[2],)*4))
    if swl(cmds,['you','fuck'],1):
        lic.append('scanf("%lld",&'+cmds[2]+');')
    if swl(cmds,['you','fuck'],2)and cmds[3]=='again':
        lic.append(cmds[2]+'=getchar();')
    if ewl(cmds,['fucks','you'],1):
        lic.append('printf("%lld",'+cmds[0]+');')
    if ewl(cmds,['fucks','you','again'],1):
        lic.append('printf("%c",(char)('+cmds[0]+'%256));')
    if _=='fuck you':lic.append('return 0;')
    if len(cmds)==3 and cmds[1]=='fucks':
        lic.append('%s=%s+%s;'%(cmds[2],cmds[2],cmds[0]))
    if len(cmds)==3 and cmds[1]=='unfucks':
        lic.append('%s=%s-%s;if(%s<0)%s=0;'%(cmds[2],cmds[2],cmds[0],cmds[2],cmds[2]))
    if len(cmds)==4 and cmds[1]=='fucks'and cmds[3]=='again':
        lic.append('%s=%s*%s;'%(cmds[2],cmds[2],cmds[0]))
    if len(cmds)==4 and cmds[1]=='unfucks'and cmds[3]=='again':
        lic.append('%s=%s/%s;'%(cmds[2],cmds[2],cmds[0]))
    if cmds[1]=='unfucks'and ewl(cmds,['over','and','over'],3):
        lic.append('%s=%s%%%s;'%(cmds[2],cmds[2],cmds[0]))
    if cmds[1]=='fucks'and ewl(cmds,['over','and','over'],3):
        lic.append('''FUCK_YOU=1;
for(FUCK_ME=1;FUCK_ME<%s;FUCK_ME++)FUCK_YOU=FUCK_YOU*%s;
%s=FUCK_YOU;'''%(cmds[2],cmds[0],cmds[2]))
    if cmds[0]=='fuck!':lic.append('//'+_[6:])
    if _=='end fuck':lic.append('}')
    if cmds[0]=='if'or cmds[0]=='while':
        if ewl(cmds,['is','fucked'],2):
            lic.append(cmds[0]+'('+cmds[1]+'){')
        if ewl(cmds,['is','unfucked'],2):
            lic.append(cmds[0]+'(!'+cmds[1]+'){')
        if ewl(cmds[:-1],'is more fucked than the'.split(),2):
            lic.append(cmds[0]+'('+cmds[1]+'>'+cmds[7]+'){')
        if ewl(cmds[:-1],'is less fucked than the'.split(),2):
            lic.append(cmds[0]+'('+cmds[1]+'<'+cmds[7]+'){')
    if _=='else fuck':lic.append('}else{')
    if len(cmds)==4 and cmds[0]=='fuck'and cmds[3]=='times':
        lic.append(cmds[1]+'='+cmds[1]+'+'+str(int(cmds[2]))+';')
    if len(cmds)==2 and cmds[0]=='fuck':
        __=cmds[1]
        if len(__)>2 and __[0]=='"'and __[-1]=='"':
            lic.append('printf("%s","'+dc(bytes(__[1:-1],'ascii')).decode('ascii')+'");')

Here is a more correct interpreter in C++, based on the compiler to C. It can compile all the examples correctly. You need this bignum package to compile the C++ code:

#End with "fucker ends fucking", case insensitive
from base64 import b64decode as dc
lic=['#include<iostream>\n#include"bn_cpp.h"\nusing std::cin;\nusing std::cout;\nint main(){\nbn_cpp::bn FUCK_YOU(0),FUCK_ME(0),i(0),you(0),me(0);\nchar _;']
def sw(x,y):return x[:len(y)]==y
def ew(x,y):return x[-len(y):]==y
def swl(x,y,z):return sw(x,y)and len(x)==len(y)+z
def ewl(x,y,z):return ew(x,y)and len(x)==len(y)+z
class FuckingError(Exception):
    pass
while True:
    fk=input()
    _=fk.casefold()
    if _=='':continue
    if _=="fucker ends fucking":
        print('\n'.join(lic),end='\n}\n//Generated by automated IFUF->C++ python program')
        break
    cmds=_.split()
    if swl(cmds,['i','fuck'],1):
        lic.append(cmds[2]+'++')
        continue
    if swl(cmds,["there's","a",'fucker','named'],1):
        lic.append('bn_cpp::bn '+cmds[4]+'(0);')
        continue
    if swl(cmds,['i','unfuck'],1):
        lic.append('%s--;if(%s<bn_cpp::bn(0))%s=bn_cpp::bn(0);'%((cmds[2],)*3))
        continue
    if swl(cmds,['you','fuck'],1):
        lic.append('cin>>'+cmds[2]+';')
        continue
    if swl(cmds,['you','fuck'],2)and cmds[3]=='again':
        lic.append('_=getchar();'+cmds[2]+'=((~_)?_:0);')
        continue
    if ewl(cmds,['fucks','you'],1):
        lic.append('cout<<'+cmds[0]+"<<'\\n';")
        continue
    if ewl(cmds,['fucks','you','again'],1):
        lic.append('cout<<char('+cmds[0]+'.to_int()&255);')
        continue
    if _=='fuck you':
        lic.append('return 0;')
        continue
    if len(cmds)==3 and cmds[1]=='fucks':
        lic.append('%s=%s+%s;'%(cmds[2],cmds[2],cmds[0]))
        continue
    if len(cmds)==3 and cmds[1]=='unfucks':
        lic.append('%s=%s-%s;if(%s<bn_cpp::bn(0))%s=bn_cpp::bn(0);'%(cmds[2],cmds[2],cmds[0],cmds[2],cmds[2]))
        continue
    if len(cmds)==4 and cmds[1]=='fucks'and cmds[3]=='again':
        lic.append('%s=%s*%s;'%(cmds[2],cmds[2],cmds[0]))
        continue
    if len(cmds)==4 and cmds[1]=='unfucks'and cmds[3]=='again':
        lic.append('%s=%s/%s;'%(cmds[2],cmds[0],cmds[2]))
        continue
    if cmds[1]=='unfucks'and ewl(cmds,['over','and','over'],3):
        lic.append('%s=%s%%%s;'%(cmds[2],cmds[0],cmds[2]))
        continue
    if cmds[1]=='fucks'and ewl(cmds,['over','and','over'],3):
        lic.append('''FUCK_YOU=bn_cpp::bn(1);
for(FUCK_ME=bn_cpp::bn(0);FUCK_ME<%s;FUCK_ME++)FUCK_YOU=FUCK_YOU*%s;
%s=FUCK_YOU;'''%(cmds[2],cmds[0],cmds[2]))
        continue
    if cmds[0]=='fuck!':
        lic.append('//'+_[6:])
        continue
    if _=='end fuck':
        lic.append('}')
        continue
    if cmds[0]=='if'or cmds[0]=='while':
        if ewl(cmds,['is','fucked'],2):
            lic.append(cmds[0]+'('+cmds[1]+'.to_bool()){')
            continue
        if ewl(cmds,['is','unfucked'],2):
            lic.append(cmds[0]+'(!'+cmds[1]+'.to_bool()){')
            continue
        if ewl(cmds[:-1],'is more fucked than the'.split(),2):
            lic.append(cmds[0]+'('+cmds[1]+'>'+cmds[7]+'){')
            continue
        if ewl(cmds[:-1],'is less fucked than the'.split(),2):
            lic.append(cmds[0]+'('+cmds[1]+'<'+cmds[7]+'){')
            continue
    if _=='else fuck':
        lic.append('}else{')
        continue
    if len(cmds)==4 and cmds[0]=='fuck'and cmds[3]=='times':
        lic.append(cmds[1]+'='+cmds[1]+'+bn_cpp::bn('+str(int(cmds[2]))+');')
        continue
    if len(cmds)==2 and cmds[0]=='fuck':
        __=fk.split()[1]
        if len(__)>2 and __[0]=='"'and __[-1]=='"':
            for i in dc(bytes(__[1:-1],'ascii')):
                lic.append(f'cout<<char({i});')
        continue
    raise FuckingError('What The Fuck!')