Showing
4 changed files
with
5 additions
and
29 deletions
| 1 | [package] | 1 | [package] |
| 2 | -name = "wasm-game-of-life" | 2 | +name = "easel3d" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | authors = ["hopp@silpion.de"] | 4 | authors = ["hopp@silpion.de"] |
| 5 | edition = "2018" | 5 | edition = "2018" |
| 6 | 6 | ||
| 7 | -[lib] | ||
| 8 | -crate-type = ["cdylib", "rlib"] | ||
| 9 | - | ||
| 10 | -[features] | ||
| 11 | -default = ["console_error_panic_hook"] | ||
| 12 | - | ||
| 13 | [dependencies] | 7 | [dependencies] |
| 14 | -wasm-bindgen = "0.2" | ||
| 15 | lazy_static = "1.4.0" | 8 | lazy_static = "1.4.0" |
| 16 | 9 | ||
| 17 | -# The `console_error_panic_hook` crate provides better debugging of panics by | ||
| 18 | -# logging them with `console.error`. This is great for development, but requires | ||
| 19 | -# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for | ||
| 20 | -# code size when deploying. | ||
| 21 | -console_error_panic_hook = { version = "0.1.1", optional = true } | ||
| 22 | - | ||
| 23 | -# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size | ||
| 24 | -# compared to the default allocator's ~10K. It is slower than the default | ||
| 25 | -# allocator, however. | ||
| 26 | -# | ||
| 27 | -# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now. | ||
| 28 | -wee_alloc = { version = "0.4.2", optional = true } | ||
| 29 | - | ||
| 30 | [dev-dependencies] | 10 | [dev-dependencies] |
| 31 | -wasm-bindgen-test = "0.2" | ||
| 32 | 11 | ||
| 33 | [profile.release] | 12 | [profile.release] |
| 34 | -# Tell `rustc` to optimize for small code size. | ||
| 35 | opt-level = "s" | 13 | opt-level = "s" |
| @@ -63,18 +63,18 @@ where T: Add<Output = T> + Sub<Output = T> + Div<Output = T> | @@ -63,18 +63,18 @@ where T: Add<Output = T> + Sub<Output = T> + Div<Output = T> | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #[inline] | 65 | #[inline] |
| 66 | - pub fn same_x(&self, b :&Self) -> bool { | 66 | + pub fn same_column(&self, b :&Self) -> bool { |
| 67 | self.x == b.x | 67 | self.x == b.x |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | #[inline] | 70 | #[inline] |
| 71 | - pub fn same_y(&self, b :&Self) -> bool { | 71 | + pub fn same_line(&self, b :&Self) -> bool { |
| 72 | self.y == b.y | 72 | self.y == b.y |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | #[inline] | 75 | #[inline] |
| 76 | pub fn same_position(&self, b :&Self) -> bool { | 76 | pub fn same_position(&self, b :&Self) -> bool { |
| 77 | - self.same_x(b) && self.same_y(b) | 77 | + self.same_column(b) && self.same_line(b) |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | fn iter(self, b :Self, only_edges :bool) -> LineIterator<T> { | 80 | fn iter(self, b :Self, only_edges :bool) -> LineIterator<T> { |
| @@ -57,7 +57,7 @@ where T: Add<Output = T> + Sub<Output = T> + Div<Output = T> | @@ -57,7 +57,7 @@ where T: Add<Output = T> + Sub<Output = T> + Div<Output = T> | ||
| 57 | let mut min = cs.iter().enumerate().fold(None, fold).unwrap().0; | 57 | let mut min = cs.iter().enumerate().fold(None, fold).unwrap().0; |
| 58 | let mut next = self.step(min, d); | 58 | let mut next = self.step(min, d); |
| 59 | 59 | ||
| 60 | - while self.vertex(min).same_y(&self.vertex(next)) { | 60 | + while self.vertex(min).same_line(&self.vertex(next)) { |
| 61 | min = next; | 61 | min = next; |
| 62 | next = self.step(min, d); | 62 | next = self.step(min, d); |
| 63 | } | 63 | } |
Please
register
or
login
to post a comment