InfSt

From Esolang
Jump to: navigation, search
InfSt
Paradigm(s) IDK, sorry
Designed by User:GiratronKode
Appeared in 2018
Computational class Unknown
Reference implementation See below
Influenced by The Infinity Stones - Marvel
File extension(s) .ist


Hello, I'm GiratronKode and this is my first attempt to do an esolang, please have that in mind.

Usage

InfSt has 3 commands:

 search stones => searches for an infinity stone.
 repeat search => to repeat the search instead of writing search stones again.
 snap fingers => to make Thanos snap his fingers to try and destroy half the population of the universe.

Basic Program

Always a program looks like this:

 search stones
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 repeat search
 snap fingers

And the output is random but one of the possible outputs is:

Stones Got: POWER REALITY TIME

Interpreter

Python 3

 #Colors
 from colorama import *
 
 init(autoreset=True, convert=True)
 
 def colorize(text, Tcolor=None, Bcolor=None, style=None):
 	if Tcolor == None:
 		Tcolor="RESET"
 	if Bcolor == None:
 		Bcolor="RESET"
 	if style == None:
 		style="RESET_ALL"
 	return getattr(Style, style.upper()) + getattr(Fore, Tcolor.upper()) + getattr(Back, Bcolor.upper()) + text
 
 import sys, random as rand, time
 toks=[]
 
 def open_file(f):
 	if not f.endswith("ist"):
 		raise NameError("It needs to be a .ist file")
 	else:
 		data=open(f).read()
 		return data
 
 def stoneList():
 	stones=[]
 	for i in toks:
 		if i != "NOLUCK":
 			stones.append(i)
 	print("Stones Got: ",end="")
 	for i in stones:
 		if i == "SPACE":
 			print(colorize(i,Tcolor="blue",style="bright"),end=" ")
 		elif i == "MIND":
 			print(colorize(i,Tcolor="yellow",style="bright"),end=" ")
 		elif i == "REALITY":
 			print(colorize(i,Tcolor="red",style="bright"),end=" ")
 		elif i == "POWER":
 			print(colorize(i,Tcolor="magenta",style="dim"),end=" ")
 		elif i == "TIME":
 			print(colorize(i,Tcolor="green",style="bright"),end=" ")
 		elif i == "SOUL":
 			print(colorize(i,Tcolor="yellow",style="dim"),end=" ")
 
 	print("",end="\n")
 
 def lex(data):
 	tok=""
 	for char in list(data):
 		tok+=char
 		if tok==" ":
 			tok=""
 		elif tok=="\n":
 			tok=""
 		elif tok.lower()=="search stones":
 			stone=rand.randint(1,15)
 			if stone==1 and "SPACE" not in toks:
 				toks.append("SPACE")
 			elif stone==2 and "REALITY" not in toks:
 				toks.append("REALITY")
 			elif stone==3 and "POWER" not in toks:
 				toks.append("POWER")
 			elif stone==4 and "MIND" not in toks:
 				toks.append("MIND")
 			elif stone==5 and "TIME" not in toks:
 				toks.append("TIME")
 			elif stone==6 and "SOUL" not in toks:
 				toks.append("SOUL")
 			elif stone>=7:
 				toks.append("NOLUCK")
 			tok=""
 		elif tok.lower()=="repeat search" and len(toks)!=0:
 			lex("search stones")
 			tok=""
 		elif tok.lower()=="snap fingers" and ("SPACE" in toks and "REALITY" in toks and "POWER" in toks and "MIND" in toks and "TIME" in toks and "SOUL" in toks):
 			print(colorize("Thanos is going to snap his fingers.",style="bright"))
 			time.sleep(2)
 			print(colorize("Thanos WINS",style="bright"))
 			tok=""
 	return
 
 
 def run():
 	data=open_file(sys.argv[1])
 	lex(data)
 	time.sleep(1)
 	stoneList()
 run()