def initial_values(self): """ Set the initial grid. """ self.value=[0,1,2,3,4,5,6,7] self.prob=[self.probSusceptible, (1-self.probSusceptible)*self.probInfected+self.probSusceptible, 1] self.matrix=[] for i in range(self.height): self.matrix.append([]) for j in range(self.width): self.matrix[i].append(probability.initial(self.value,self.prob))
def initial_values(self): ''' Set the initial grid. ''' self.value = [0, 1, 2, 3, 4, 5, 6, 7] self.prob = [ self.probSusceptible, (1 - self.probSusceptible) * self.probInfected + self.probSusceptible, 1 ] self.matrix = [] for i in range(self.height): self.matrix.append([]) for j in range(self.width): self.matrix[i].append( probability.initial(self.value, self.prob)) print self.probSusceptible #initially set Mary into one of the cells randomly self.RowOfMary = random.randint(0, self.height - 1) self.ColumnOfMary = random.randint(0, self.width - 1) self.matrix[self.RowOfMary][self.ColumnOfMary] = 8