Skip to content

Commit

Permalink
safeguards main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lele394 committed Jun 13, 2023
1 parent d6692d2 commit 98c9246
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
24 changes: 12 additions & 12 deletions CellularAutomaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
os.environ['CUDA_HOME'] = r'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7' #install cuda toolkit from nvidia and put the correct path here (should not really change much tho, except v11.7)

#custom vars
perc = 30/100 #for custom starting frame
perc = 3/100 #for custom starting frame

#IMG SIZE
_SHOWSIMULATION = True
_SIZE = (120, 120) #size of the output image inverse of the resolution you want i.e: 1920x1080 => (1080, 1920)
_STEPS = 15 #number of steps to simulate
_SIZE = (1000, 1000) #size of the output image inverse of the resolution you want i.e: 1920x1080 => (1080, 1920)
_STEPS = 10000 #number of steps to simulate
_LOOPPAUSETIME = 1 #pause between each calculations (indirectly fps)
_SKIPONEFRAME = True #renders 2 frames but only show one (epilepsy brrrrr)
_SKIPTWOFRAME = False #renders 3 frames but only show one (works only if _SKIPONEFRAME = True)(epilepsy brrrrr)
Expand All @@ -42,14 +42,14 @@


#SIM
_CUSTOMFRAME = True #whether or not to use the custom function for starting frame
RandomStartingFrame = True #generates a random image to start
_CUSTOMFRAME = False #whether or not to use the custom function for starting frame
RandomStartingFrame = False #generates a random image to start
RandomIntStartingFrame = True #generates a random image to start with only 1 and 0
ZerosStartingFrame = False #blank 0 frame
_LOOP = False
@cuda.jit
def ActFunction(x):
#return x*x
return x*x
#return -1./pow(2., (0.6*pow(x, 2.)))+1. #worms
#return -1./(0.9*pow(x, 2.)+1.)+1. #Mitosis
#return -1./(0.89*pow(x, 2.)+1.)+1. #slime
Expand All @@ -63,13 +63,13 @@ def ActFunction(x):
return 0
"""

"""
#cave generator
if x>4:
return 1
else:
return 0
"""
"""
#Chose your filter / make a new one
"""
NCA_Filter = np.array([ [0.1 , -0.1 , 0.3 ],
Expand Down Expand Up @@ -121,12 +121,12 @@ def ActFunction(x):
NCA_Filter = np.array([ [0.565 , -0.716 , 0.565 ],
[-0.716 , 0.627 , -0.716 ],
[0.565, -0.716 , 0.565 ]])
"""
#Super cool growing spaceships, use x*x activ function
NCA_Filter = np.array([[-0.8300993, -0.44785473, 0.979766 ],
[-0.47983372, 0.07656833, -0.35514032],
[ 0.53823346, 0.43503127, 0.2492277 ]])
"""
#Conway game of life
NCA_Filter = np.array([ [1 , 1 , 1 ],
[1 , 9 , 1 ],
Expand All @@ -137,12 +137,12 @@ def ActFunction(x):
[ 0.82367216, 0.31695098, 0.82367216],
[-0.99038735, 0.82367216, -0.99038735]])
"""
#cave generator
NCA_Filter = np.array([[1, 1, 1],
[1, 0, 1],
[1, 1, 1]])

"""



Expand Down Expand Up @@ -357,6 +357,6 @@ def NextStep(input, filter, activFunction):




os.system("pause")

#
Binary file modified __pycache__/CellularAutomaton.cpython-39.pyc
Binary file not shown.
Binary file modified __pycache__/main.cpython-39.pyc
Binary file not shown.
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@



#https://317070.github.io/python/



Expand All @@ -36,8 +35,13 @@ def MakeFrame(input):



if __name__ == "__main__":
print("Please use CellularAutomaton.py")


"""
#https://317070.github.io/python/
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
required = parser.add_argument_group('required arguments')
Expand All @@ -59,7 +63,7 @@ def MakeFrame(input):
videostream.send_video_frame(StreamFrame)

"""



Expand Down

0 comments on commit 98c9246

Please sign in to comment.