book icon indicating copy to clipboard operation
book copied to clipboard

[nit] Simplify game of life rules

Open kunalb opened this issue 7 years ago • 0 comments

✋ A similar PR may already be submitted! Please search 🔎 among the [open pull requests][open-prs] before creating one. -> Searched, I didn't see anything similar.

Updating the Game of Life tutorial's code? Also send a PR to rustwasm/wasm_game_of_life! -> Will update with a link to the PR.

Now that you've checked, it's time to create your PR. 📝 Thanks for submitting! 🙏

For more information, see the [contributing guide][contributing]. 👫

Summary

Thank you for creating and maintaining the WASM book – I really enjoyed working through it.

I was a bit distracted by the complex Game of Life rules implementation, and thought it might make the code & logic simpler to collapse them based on the next state – any cells with 3 neighbors, or alive cells with 2 neighbors survive to the next iteration.

I adjust the match statement and the answer to the bitwise solution accordingly in this pull request.

(My editor also stripped some trailing whitespace; I can strip that from the PR if that's too noisy).

Thanks!

kunalb avatar Dec 08 '18 17:12 kunalb