From 98c9246650eb830e4dcecdb82a3e487ecfab0158 Mon Sep 17 00:00:00 2001 From: lele394 Date: Tue, 13 Jun 2023 14:21:44 +0200 Subject: [PATCH] safeguards main.py --- CellularAutomaton.py | 24 +++++++++---------- __pycache__/CellularAutomaton.cpython-39.pyc | Bin 3853 -> 3779 bytes __pycache__/main.cpython-39.pyc | Bin 1401 -> 820 bytes main.py | 8 +++++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CellularAutomaton.py b/CellularAutomaton.py index 827be0e..54c7d65 100644 --- a/CellularAutomaton.py +++ b/CellularAutomaton.py @@ -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) @@ -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 @@ -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 ], @@ -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 ], @@ -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]]) - +""" @@ -357,6 +357,6 @@ def NextStep(input, filter, activFunction): - + os.system("pause") # diff --git a/__pycache__/CellularAutomaton.cpython-39.pyc b/__pycache__/CellularAutomaton.cpython-39.pyc index 9c72e7d6df9af5ff40611317ae1ad432df5e1cbc..1acc9f5935c2101f826bda2cb0bac60dcb3937e4 100644 GIT binary patch delta 859 zcmY+BZAep57{|}KcW-XqImL3*Y3ioib;|-@YU;LBoJ1f-k+NQVJE!ZG({-ld?1f09 zhz823s4wCSDuap=K@2kJOGFeA7)&V&imbqoQATv`q8IPw{?BuN&vX9IJxC~k7B`&uA53^5f!Rc`b!6m;&Ho}_Q>f3$>U9P}h#Xu!G&A9Bjp2<`&n zMtXzq6le2Jf8IGe?%geN%O80Fh>DFXV6XwO3|Zu3SSCb6%M>-`8WtX7cP3y4uxW}( z0uB;Eu8`$>Lw(i0=4gL+UvGYx^aXKOe}uY}4V@fI0*)A%ioCSC;O=&gewvpaAGr1I z+SJm#M9Ei|$G_rb$)$&L$1l&ko|j&B)dg0sOnasK%5O);=N9H!a)>|IUg3J{l^UP4 z;@GQ2uT;9yK6LlPbMN#W`v0zLgd2{86;mt z1z~3g357%gD4~pWcZ4x9&_zu?)YBiD@->dtDK*ee2UA`MNka`W%Ql&GkJioj1+7(8 zC<6<9pxwJ>qgCgCm9$xxW5{L&Y;=l9U>IJoW=$*};>V@`t^IW3i4af-%kQ#uU(7nl}{776DU>EdkavLBu2)khqWrt7z z_U8F*0aqXgK_Qq5($!0nVBY0JBariO6crDb<>49f0eFE%zJP|_hq~Mx?00i0+7JMT zTDN(89|d5vQVTt==20NghJ_$wSt#ZYj00)-)lr}O(Y z+8-=Y*l%M1C?qM(80;VkG5)NBhEM6s^CE76{456rIz?(`TdOJ>9Rt(l(v!?;z|?Y? zBGSrPtzcx4B^g<*rX>LM2C(iC&p zfK8kED6@iaJ6V@CaEdhK3nv_Z$Z;@CypC_GWhi4GGwdY49SO>hD}Kq(h(YpDSvZmS zSqY7du`+TxUCbDzbeeX=aVL{UNlgC)_fm~AqG_xl9bg~PoN1??Y}!iI;>s$mPFvt+Dgw~w_4yP2&rGd-0~8ifkNxQDUB49194^|Zy<0p2L$3C4v;RGkOi qQz4sSpC)tYt diff --git a/__pycache__/main.cpython-39.pyc b/__pycache__/main.cpython-39.pyc index d04cc03a457f1b77f8b71f5be974f311db2db822..872e18d23b9a8b94b8ef007bb4c864de72b7ef8a 100644 GIT binary patch delta 170 zcmey#wS`S5k(ZZ?0SMUQJ5t)&7#JRdILLqr$Z-JT;s}O`Ize2`jEoE^%)tzr+?%}^ za~Xv#oULL4DoZl*^Ark-^0QKtONu9-WAaw6k`Ks9O)O4TC(vtk# z#FG3xy@EfXJtJzo!iZb&`CabV2ONjw(;bG)q#wu#W-<=J_2ReH(UWCM!b*$~TnlqT(^^&L}09x57Ll^^Kq3dUW&f_~rSh z2xN5Lg)Tfle+^Mb^}~s6ycubm^PcMmoY$#N35Xif50&2!hIt8>17Cuuxw1LvL7<|c zaS#nt2M3Xo;PyK3WtdghzG}2;_sqw-p%X3WhT6XK*OM$4%Xlo~=+wz;U#Ql$wp!pf zTS}W=80nQOkQaT7YUB5)?@g|ZuOkc?xIN%puO0ml^3Ij0(JP#beghj;7!!F{2!5BA zH)Vei$`Ve}>E(uY7V^0;(up~;)%*M`b>$1_$F;;CXGC<;lNdmoexS5-dVIuB{I0_1 zTV8ypp0>R~(3l?^t2ROL#SFf%@r!}yfy7sL6=?euKC3eYAxoVt4)J6@nq?yh#Ij2k sF!ll_)GR%FidCAXsXgCjg5qAcO*`Wt=g>TIRijAvs6{O!ZLFc{AL?o17XSbN diff --git a/main.py b/main.py index 2c16bd6..e2fca16 100644 --- a/main.py +++ b/main.py @@ -17,7 +17,6 @@ -#https://317070.github.io/python/ @@ -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') @@ -59,7 +63,7 @@ def MakeFrame(input): videostream.send_video_frame(StreamFrame) - +"""