use bernoulli distribution for random start

matplotlib
Tom Weber 2 years ago
parent c52542cff7
commit de6b1d9f44

@ -3,12 +3,12 @@
import copy import copy
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
from anime import PltAnimation from conway.anime import PltAnimation
from anime import PlotlyAnimation from conway.anime import PlotlyAnimation
class State(object): class State(object):
def __init__(self, depth: int, width: int, coords=None): def __init__(self, depth: int = 100, width: int = 100, coords=None):
# Coords: tuple of ints or list of tuple of ints # Coords: tuple of ints or list of tuple of ints
self.width = width self.width = width
self.depth = depth self.depth = depth
@ -90,7 +90,10 @@ class State(object):
alive += 1 alive += 1
return alive return alive
def get_anime(size=100, steps=100, start="random"):
state = State(size, size, start)
anime = PlotlyAnimation(state, steps)
return anime.animation
def main(): def main():

@ -0,0 +1,19 @@
from setuptools import setup
setup(
name='conway',
version='0.1.0',
description="A conway's game of life implementation",
url='https://git.weber.codes/tom/conwaysgameoflife',
author='Tom Weber',
author_email='mail@weber.codes',
license='BSD 2-clause',
packages=['conway'],
install_requires=['wheel',
'numpy',
'pandas',
'matplotlib',
'plotly'
],
)
Loading…
Cancel
Save