We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Where in the docs did you come across this?
#![allow(unused_variables)] fn main() { extern crate web_sys; // A macro to provide `println!(..)`-style syntax for `console.log` logging. macro_rules! log { ( $( $t:tt )* ) => { web_sys::console::log_1(&format!( $( $t )* ).into()); } } }
diff --git a/src/lib.rs b/src/lib.rs index f757641..a30e107 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -123,6 +122,14 @@ impl Universe { let cell = self.cells[idx]; let live_neighbors = self.live_neighbor_count(row, col); + log!( + "cell[{}, {}] is initially {:?} and has {} live neighbors", + row, + col, + cell, + live_neighbors + ); + let next_cell = match (cell, live_neighbors) { // Rule 1: Any live cell with fewer than two live neighbours // dies, as if caused by underpopulation. @@ -140,6 +147,8 @@ impl Universe { (otherwise, _) => otherwise, }; + log!(" it becomes {:?}", next_cell); + next[idx] = next_cell; } }
How could we improve it?
The text was updated successfully, but these errors were encountered:
Issue rustwasm#255 - Attempt to make explanation in debugging section…
97a238a
… better
Successfully merging a pull request may close this issue.
Where in the docs did you come across this?
How could we improve it?
The text was updated successfully, but these errors were encountered: