bug fix + more waterlike + more detail

This commit is contained in:
madmaurice 2016-02-16 19:37:50 +01:00
parent 359e7accb2
commit ed32bba8c6

View file

@ -12,7 +12,7 @@ class WaterSim(Game):
def init_data(self, middle):
self.C = [50] * self.N
for i in range(middle - self.N//4,middle + self.N//4):
if i < 0 or i > self.N: continue
if i < 0 or i >= self.N: continue
self.C[i] += (1-math.cos(2 * math.pi * (i - middle + self.N//4) / (self.N//2))) * 100
self.C1 = [0] * self.N
@ -30,7 +30,7 @@ class WaterSim(Game):
C2[-1] = 100 * (self.C[-2] - self.C[-1]) * 100/self.N
for i in range(1,self.N-1):
C2[i] = 100 * (self.C[i+1] + self.C[i-1] - 2*self.C[i]) * 0.5 * 100 /(self.N)
C2[i] = 1000 * (self.C[i+1] + self.C[i-1] - 2*self.C[i]) * 0.5 * 100 /(self.N)
for i in range(0,self.N):
self.C1[i] = (self.C1[i] + C2[i] * dtime)
@ -60,4 +60,4 @@ class WaterSim(Game):
prev_point = new_point
if __name__ == '__main__':
WaterSim(100).on_execute()
WaterSim(50).on_execute()