How to use the cellular-automaton.conways_game_of_life.Cell.from_str function in cellular-automaton

To help you get started, we’ve selected a few cellular-automaton examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AllAlgorithms / python / cellular-automaton / conways_game_of_life.py View on Github external
    @classmethod
    def from_str(cls, string):
        non_empty_lines = (
            line for line in string.splitlines()
            if len(line) > 0
        )
        parsed_grid = [
            [Cell.from_str(char) for char in line]
            for line in non_empty_lines
        ]
        return cls(grid=parsed_grid)