Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Life variants #1

Closed
peterhellberg opened this issue Mar 15, 2014 · 0 comments
Closed

Add Life variants #1

peterhellberg opened this issue Mar 15, 2014 · 0 comments
Assignees

Comments

@peterhellberg
Copy link
Owner

Add some of the variants from A selection of Life-like rules

Possibly by writing a parser for the rule short hand format.

Quick and dirty example:

    for y := 0; y < h; y++ {
        for x := 0; x < w; x++ {
            n := aliveNeighbours(x, y)

            if isAlive(x, y) {
                aliveCells++

                //if n < 2 || n > 3 { // Game of Life
                //if !(n == 3 || n == 4 || n == 6 || n == 7 || n == 8) { // Day & Night
                // if !(n == 2 || n == 3) { // HighLife
                killList = append(killList, Point{x, y})
                //}
            } else {
                //if n == 3 { // Game of Life
                //if n == 3 || n == 6 || n == 7 || n == 8 { // Day & Night
                // if n == 3 || n == 6 { // HighLife
                if n == 2 { // Seed
                    spawnList = append(spawnList, Point{x, y})
                }
            }
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant