IThinkMyComputerIsDrunk

From Esolang
Jump to navigation Jump to search

iThinkMyComputerIsDrunk is an esolang, created by RandomIdiot. At some point, iThinkMyComputerIsDrunk is the opposite of jQuery because its concept is "write more, do less". Important tip: this article is as strange as the esolang. You will find out what this means later.

Writing Programms in iThinkMyComputerIsDrunk

Booleans

(You will see why this is the first thing you get to know)
To set a Boolean, you write the name of the Boolean and in new line the value. Values are:

  • of course (=true)
  • hell nah wtf man no (=false)


Booleans you can set are:

  • ohio (are we in ohio?)
  • shift (i will explain its use later)

How to start a programm

ohio
hell nah wtf man no
prepare

If you don't start with this, the programm won't work. So, what you are telling the interpreter is, that we are not in ohio (so it can do things normaly) and that it should prepare for further instructuons.

The lazy interpreter

At least every fourth line, you must tell the interpreter to continue. You can do that by writing

go on

Simple, right? Don't get used to it.

The mainmode

To produce output or get input, you must set the mainmode to "out" or "in". You can do that by writing

out

or

in

Simple again?! Yes. Let me fix that...

Out

If you set the mainmode to out, you can use these functions:

  • add:

Write a Number behind it to a letter to your output storage. Not that simple, is it?!

Code Added Letter
add 1 a
add 2 b
add 3 c

...
27 is a space.

  • clear:

Clear the output storage.

  • shift (BOOLEAN!!!)

If shift is true, the letters you add are uppercase. If false, they are lowercase.
You can set shift to true with this:

shift
of course

To false:

shift
hell nah wtf man no

Normaly, shift is false.

In

There are no special functions for this mainmode. Check out "use".

Use

Use is a keyword. With it, you "activate" the mainmode.

For mainmode Out

If the mainmode is set to out, you can just write use to print the output storage.

use

Thats it! Simple... A little too simple...
Uh Oh, hard mechanic incoming.

You can print variables. Yes, you heard that right, variables! You can't edit them. But print them. [...]

use #varname

For mainmode In

If you want to get a text-input, it looks like this:

use varname

So basicly, you create a variable called varname, store the input in it, and show it as "Question".
What does this mean?
Idk. Idc. Try.

Exit the programm

Use this code to exit your programm:

shut up

Jump to line

ln 3

I hope this answers your question.

Loop

loop[2]{add 1}
  • execute twice ([2]=two times executed)
  • "add 1" is executed twice
  • Don't try to put multiple actions in the loops body

Error Messages

They follow one rule: they are useless.
[...]


Did you think I will explain them?


You are wrong.

Examples

Hello World

ohio
hell nah wtf man no
prepare
go on
in
use test
out
go on
use #test
shift
of course
go on
add 8
shift
hell nah wtf man no
go on
add 5
loop[2]{add 12}
add 15
go on
add 27
go on
shift
of course
add 23
go on
shift
hell nah wtf man no
add 15
go on
add 18
add 12
add 4
go on
use
shut up

Interpreter

Here is an interpreter in Python.

path=input("What is the path to your codefile?\n")
f=open(path,"r")
c=f.read()
f.close()
c=c.split("\n")

def grey(text):
    return "\x1b[30m"+text+"\x1b[0m"

def error(ln,msg):
    print(grey("You messed up at line "+ln+".")+"\n"+msg)
    exit()

def list_to_2d(l):
    #only works if content is 100% strings
    l=str(l).replace("[","").replace("]","")
    return l.split(",")

if c[0]!="ohio":
    error("1","Don't start like that.\nI need to know if we are in ohio.")
if c[1]=="of course":
    error("2","Hell nah im outta here")
if c[1]!="hell nah wtf man no":
    error("2","What u talkin about man ?")

last_go_ahead=0
go_ons=0
for x in range(len(c)):
    if c[x]=="go on":
        last_go_ahead=0
        go_ons+=1
    else:
        last_go_ahead+=1
    if last_go_ahead>=4:
        error(str(x)+" (roundabout)","You did'nt said i should go on...")

for x in range(go_ons):
    c.remove("go on")

c.pop(0)
c.pop(0)

if c[-1]!="shut up":
    error("[Last Line]","Bro i'm waiting :(")
else:
    c.pop(-1)

letters=list("abcdefghijklmnopqrstuvwxyz ")

prepared=False
mainmode="nothing"
shift=False
outp=""
inps={}
ignoreNext=False

for x in range(len(c)):
    if ignoreNext:
        ignoreNext=False
        continue

    if c[x].startswith("ln "):
        c[x]=c[int(c[x].split(" ")[1]-1)]
    

    times=1
    if c[x].startswith("loop["):
        q=c[x].split("[")
        for y in range(len(q)):
            q[y]=q[y].split("]")
        q=list_to_2d(q)
        if len(q)>3:
            error("[who knows]","More than 1 [ and / or 1 ] in your loop...")
        else:
            times=int(q[1].replace(" ","").replace("'",""))
        
        q=c[x].split("{")
        for y in range(len(q)):
            q[y]=q[y].split("}")
        q=list_to_2d(q)
        if len(q)>3:
            error("[who knows]","More than 1 { and / or 1 } in your loop...")
        else:
            c[x]=q[1].replace("'","")[1:len(q[1].replace("'",""))] # [1:-1] selects everything except the first letter (which is a space)

    for y in range(times):
        if c[x]=="prepare":
            prepared=True
        elif c[x] in ["out","in"]:
            if not prepared:
                error("[I don't know, just look where you first changed mainmode]","I'm not ready for this.\nOh and it's probably line "+str(x+1))
            else:
                mainmode=c[x]
        elif c[x]=="clear":
            outp=""
        elif c[x].startswith("add "):
            if mainmode=="out":
                q=c[x].split(" ")[1]
                q=int(q)
                q=letters[q-1]
                if shift:
                    q=q.upper()
                outp+=q
        elif c[x].startswith("use"):
            if mainmode=="nothing":
                error("[just look where you wrote 'use']","Use what?")
            elif mainmode=="out":
                if len(c[x])>4 and c[x][4]=="#":
                    print(inps[c[x].split("#")[1]])
                else:
                    print(outp)
            elif mainmode=="in":
                inps[c[x].split(" ")[1]]=input(c[x].split(" ")[1])
        elif c[x].replace(" ","")=="":
            continue
        elif c[x]=="shift":
            ignoreNext=True
            if c[x+1] == "of course":
                shift=True
            elif c[x+1] == "hell nah wtf man no":
                shift=False
            else:
                error("[just look for your mistake lol]","Boolean can only be 'of course' or 'hell nah wtf man no'")
        else:
            print(c)
            print(x)
            error("[just look for your mistake lol]","What u talkin about man ?")

If you read this, I owe you a cookie


Just kidding ahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha

Funny.