From b2d52e234ac791d4e930ec913ba291167b5062f3 Mon Sep 17 00:00:00 2001 From: Jacob Schneider <82042695+wacksientrist@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:21:24 -0400 Subject: [PATCH] Add files via upload --- Orchid_2.0.2/Makefile | 9 ++++ Orchid_2.0.2/Orchid/Comp/Instance.py | 50 ++++++++++++++++++ Orchid_2.0.2/Orchid/Comp/Instrc_n.txt | 0 Orchid_2.0.2/Orchid/Comp/Instrc_r.txt | 1 + Orchid_2.0.2/Orchid/Comp/Instrc_s.txt | 1 + Orchid_2.0.2/Orchid/Comp/start.sh | 1 + Orchid_2.0.2/Orchid/Public/Orchid.py | 42 +++++++++++++++ .../Public/__pycache__/Orchid.cpython-311.pyc | Bin 0 -> 2796 bytes Orchid_2.0.2/Orchid/Sample.py | 12 +++++ Orchid_2.0.2/Orchid/int.sh | 3 ++ Orchid_2.0.2/README.md | 26 +++++++++ Orchid_2.0.2/Setup.py | 18 +++++++ 12 files changed, 163 insertions(+) create mode 100644 Orchid_2.0.2/Makefile create mode 100644 Orchid_2.0.2/Orchid/Comp/Instance.py create mode 100644 Orchid_2.0.2/Orchid/Comp/Instrc_n.txt create mode 100644 Orchid_2.0.2/Orchid/Comp/Instrc_r.txt create mode 100644 Orchid_2.0.2/Orchid/Comp/Instrc_s.txt create mode 100644 Orchid_2.0.2/Orchid/Comp/start.sh create mode 100644 Orchid_2.0.2/Orchid/Public/Orchid.py create mode 100644 Orchid_2.0.2/Orchid/Public/__pycache__/Orchid.cpython-311.pyc create mode 100644 Orchid_2.0.2/Orchid/Sample.py create mode 100644 Orchid_2.0.2/Orchid/int.sh create mode 100644 Orchid_2.0.2/README.md create mode 100644 Orchid_2.0.2/Setup.py diff --git a/Orchid_2.0.2/Makefile b/Orchid_2.0.2/Makefile new file mode 100644 index 0000000..98540a9 --- /dev/null +++ b/Orchid_2.0.2/Makefile @@ -0,0 +1,9 @@ +Build: + mkdir Build + mkdir Build/Public + cp -R Orchid/Public/ Build/Public/ + cp Orchid/Sample.py Build/ + python3 Setup.py +Install: + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew install python3 \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Comp/Instance.py b/Orchid_2.0.2/Orchid/Comp/Instance.py new file mode 100644 index 0000000..79112a2 --- /dev/null +++ b/Orchid_2.0.2/Orchid/Comp/Instance.py @@ -0,0 +1,50 @@ +while True: + # check if theres a new command to process + + if open("Instrc_n.txt", 'r').read() == "n": + # read the commands + + fil1 = open("Instrc_r.txt", "r").read() + fil2 = open("Instrc_s.txt", "w") + + # format commands to variables + fil1 = fil1.split(" ") + A = fil1[0] + B = fil1[1] + Type = fil1[2] + + # execute the new command + if Type == "A": + Out = float(A)+float(B) + if Type == "S": + Out = float(A)-float(B) + if Type == "M": + Out = float(A)*float(B) + if Type == "D": + Out = float(A)/float(B) + if Type == "IF=": + print(A) + print(B) + if A == B: + Out = "T" + else: + Out = "F" + if Type == "IF!": + if A == B: + Out = "F" + else: + Out = "T" + if Type == "IF>": + if A > B: + Out = "T" + else: + Out = "F" + if Type == "IF<": + if A < B: + Out = "T" + else: + Out = "F" + + # return the output + fil2.write(str(Out)) + fil2.close() \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Comp/Instrc_n.txt b/Orchid_2.0.2/Orchid/Comp/Instrc_n.txt new file mode 100644 index 0000000..e69de29 diff --git a/Orchid_2.0.2/Orchid/Comp/Instrc_r.txt b/Orchid_2.0.2/Orchid/Comp/Instrc_r.txt new file mode 100644 index 0000000..3d101dc --- /dev/null +++ b/Orchid_2.0.2/Orchid/Comp/Instrc_r.txt @@ -0,0 +1 @@ +! 123 IF= \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Comp/Instrc_s.txt b/Orchid_2.0.2/Orchid/Comp/Instrc_s.txt new file mode 100644 index 0000000..c137216 --- /dev/null +++ b/Orchid_2.0.2/Orchid/Comp/Instrc_s.txt @@ -0,0 +1 @@ +F \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Comp/start.sh b/Orchid_2.0.2/Orchid/Comp/start.sh new file mode 100644 index 0000000..1e97325 --- /dev/null +++ b/Orchid_2.0.2/Orchid/Comp/start.sh @@ -0,0 +1 @@ +python3 Instance.py \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Public/Orchid.py b/Orchid_2.0.2/Orchid/Public/Orchid.py new file mode 100644 index 0000000..6bd069a --- /dev/null +++ b/Orchid_2.0.2/Orchid/Public/Orchid.py @@ -0,0 +1,42 @@ +import time + +class Node(): + def __init__(self, UUID): + self.UUID = UUID # Localize UUID variable + self.result = None + def Process(self, A, B, Type): + Input_File = open("Comp"+str(self.UUID)+"/Instrc_r.txt", "w") # open the input file + Output_File = open("Comp"+str(self.UUID)+"/Instrc_s.txt", "w") # open the output file for writing + Output_File.write("P") # Write Placeholder to overwrite previous output + Output_File.close() + Output_File = open("Comp"+str(self.UUID)+"/Instrc_s.txt", "r") # open output file + Input_File.write(str(A)+r" "+str(B)+r" "+str(Type)) # Send the Command to Be Processed + Input_File.close() + open("Comp"+str(self.UUID)+"/Instrc_n.txt", "w").write("n") # Inform the Node that there is a new command + while Output_File.read() == "P": # Wait until the Output File changes from The Placeholder to the new Output + time.sleep(0.01) + open("Comp"+str(self.UUID)+"/Instrc_n.txt", "w").write("") # Upon Receipt of Output Inform the Node there is no new command + def Read(self): + while(True): + Output_File = open("Comp"+str(self.UUID)+"/Instrc_s.txt", "r") + #time.sleep(0.01) + A_str = Output_File.read() + if A_str == "P": # Check Processing Status + Output_File.close() + continue + if A_str == "": # Check Processing Status + Output_File.close() + continue + if open("Comp"+str(self.UUID)+"/Instrc_n.txt", "r").read() == "n": # Check If file is ready for read + Output_File.close() + continue + if A_str == "F": # Check if its a boolean and return proper output + Output_File.close() + return False + elif A_str == "T": # Check if its a boolean and return proper output + Output_File.close() + return True + else: # Output is a number, to keep float and int, support return string + Output_File.close() + return A_str + \ No newline at end of file diff --git a/Orchid_2.0.2/Orchid/Public/__pycache__/Orchid.cpython-311.pyc b/Orchid_2.0.2/Orchid/Public/__pycache__/Orchid.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4e5fb05fcc8539858bb3a8f6adf993c6377a624 GIT binary patch literal 2796 zcmb_eO-vg{6rNe{0ydxwB{&cYS=%ke39$)OX;h)+#|TPLoU}lyl1MA!-L@vic4il) zp+@4sA%`4t3yo6Akx~i*svN1*Nw9YMMd3z{0rfXCWPEJG;!G2A@ zZ6uPx5QGU{rI9b9YVk|y33LZ~lu=DLN)y+nZ^fdKA{R*BV>OBrjYkbdnW^XN43t=& zFTEaM4&{!w-&Y?*@58eN0u(9bk~4f+_FfFYN608;2gEAoveHPQ$#M=BL2IR~Im2}Y z8+V;TdWU_<59o@O_W1BorTwDLiih4s)xQ3ul=O<7RPWviXzt8zdDDwPt(3X{u;aoC zYbtO1tdtV>Utz@w;>y*kPQKd;4WUxQ&cU2}ZD<1LXnoC6&{%gQ(1xT7BET zd$h~oSGqVRt4oyX+7th^{66nG^o@C)dtbYIm3FVF3o|j4m`cvn2Z!RiK_f~$V0>vX ze3#+)KSIid+hrZSpmU93x{c+}zdHK;;4d@t=Na-cQ?5@M4yEJNOOp3%3 zy2eDRO{h#XqEjH!W15!qS5clyhA%RFiHW24k{WXj#go&9G7ybvtoG`(QDSu7Fl2jB z=+TH(U!#eLrt33xcK<1ITuV3HYPPNiJCA z!Uh@0l7XLflMGvAI75av+dS!xwZ^5<)lZk(SKCeRd+SF`@8F9@v+au2cIBaKv)!9M zyXIR`SEI{;)qv?cw|>I(efYv>wui0u@Wa|1Y26^6Eb*j$Ch4$9M}~BiWhU`i#Frty z1GqW9LF6ovzimu^^wj;#y(B(uT^o7cuzY>>y6NeC-fw!&{nWTV`a{c)EvDy^NkSG0 zWk@JTiiRffTEv?n-kjUB;qJ(~J4|<{RYLd$qxtu9|DE~Q)l>0O={8;R6e-@|$!R_ET{-7~Z!U%eB$L|W$I!Gfu!l40RloC!h z0x&!eXt1o>V^GP{QpUOVoFmK z=2DcYggPDLbe*EynVyIhW~dW(M`aFg11uxk*vqOowJ|3 S=*19YFZ{`6f9*42NBA2vlP = Instance('')" +- to send a command to a node you can use "C.Process(, , '')" +- to read the output use "C.Read()" it will return either a boolean or a string containing your value + +# Operation Types +1. A is Add +2. S is subtract +3. M is multiply +4. D is divide +5. IF= is an if statement it will output a boolean \ No newline at end of file diff --git a/Orchid_2.0.2/Setup.py b/Orchid_2.0.2/Setup.py new file mode 100644 index 0000000..02fcf19 --- /dev/null +++ b/Orchid_2.0.2/Setup.py @@ -0,0 +1,18 @@ +import os + +inp = input("Computer Count: ") +content = open("Orchid/int.sh", "r").read() +content_snp = content +file = open("Orchid/int.sh", "w") + +file.write("#! /bin/sh \n") + +for i in range(1, int(inp)): + content = content_snp.replace("_", str(i))+"\n" + file.write(content) + os.system(f"mkdir Build/Comp{i}; cp -R Orchid/Comp/ Build/Comp{i}") +file.close() +os.system("cp Orchid/int.sh Build/") +file = open("Orchid/int.sh", "w") +file.write(content_snp) +file.close() \ No newline at end of file