use bernoulli distribution for random start

matplotlib
Tom Weber 2 years ago
parent 377ace5e29
commit c52542cff7

@ -1,6 +1,5 @@
#!/usr/bin/env python
import random
import copy
import matplotlib.pyplot as plt
import numpy as np
@ -31,13 +30,8 @@ class State(object):
)
def randomBoard(self):
for idx, i in enumerate(self.board):
for jdx, j in enumerate(i):
if random.randint(1, 2) == 1:
self.board[idx, jdx] = 1
else:
self.board[idx, jdx] = 0
self.board = np.random.binomial(1, 0.5, (self.width, self.depth))
return self.board
def terminal_render(self):
print("-" * (self.width + 2))
for i in self.board:

Loading…
Cancel
Save