Example #1
0
from Viewer import Viewer
from VideoAnalyzer import VideoAnalyzer
from Constants import *
import time, pygame
import os

os.environ['SDL_VIDEO_CENTERED'] = '1'  # Set the window in the center

vw = Viewer()
va = VideoAnalyzer(vw)

vw.start()
va.start()
Example #2
0
from Viewer import Viewer
from VideoAnalyzer import VideoAnalyzer
from Constants import *
import time, pygame
import os

os.environ['SDL_VIDEO_CENTERED'] = '1'      # Set the window in the center

vw = Viewer()
va = VideoAnalyzer(vw)

vw.start()
va.start()
        if self.is_within_bounds(x, y):
            image[x][y] = self.dict['color_func'](x, y)

    def kill_cell(self, image, x, y):
        """
        Kills the specified cell 
        :param image: a reference to a cell grid to modify
        :params x, y: x and y coordinates of the living cell in the provided cell grid
        """
        if self.is_within_bounds(x, y):
            image[x][y] = 0


def color_function(x, y):
    """
    This is a fork of my original automata project, and color should be left 255 (white).
    """
    #setting a return of 255 defaults automaton to simple black and white (dead and alive)
    return 255


#Create a new Automaton Object
new_automaton = Automaton(200, 200, color_function)

#There are three methods to choose from for generating an initial state:
new_automaton.initialize_with_noise(12)

#Initializes the pygame viewer object and starts
viewer = Viewer(new_automaton.update, (900, 900))
viewer.start()