diff --git a/conway/__init__.py b/conway/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/anime.py b/conway/anime.py similarity index 100% rename from anime.py rename to conway/anime.py diff --git a/main.py b/conway/gameoflife.py similarity index 91% rename from main.py rename to conway/gameoflife.py index 5951bae..9a9114f 100644 --- a/main.py +++ b/conway/gameoflife.py @@ -3,12 +3,12 @@ import copy import matplotlib.pyplot as plt import numpy as np -from anime import PltAnimation -from anime import PlotlyAnimation +from conway.anime import PltAnimation +from conway.anime import PlotlyAnimation 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 self.width = width self.depth = depth @@ -90,7 +90,10 @@ class State(object): alive += 1 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(): diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d7d296a --- /dev/null +++ b/setup.py @@ -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' + ], + +)