rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.73k stars 208 forks source link

Move universe.tick() to after the drawing of cells and grid. #119

Closed jwir3 closed 5 years ago

jwir3 commented 5 years ago

Summary

The code that governs universe updates (i.e. universe.tick()) is moved to after the display functions in index.js.

Explain the motivation for making this change. What existing problem does the pull request solve? 🤔

It was difficult to discern what was happening to my game of life simulation, because I didn't realize the initial state was not being shown. Instead, the second frame of the animation was being shown, which led me to have difficulty when trying to complete the exercises at the end of the second (i.e. the "create a single spaceship as an initial starting point").

jwir3 commented 5 years ago

I accidentally based this off of my master branch, which is not what I wanted to do. I'm going to close and reopen a new PR.