You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In section 4.4, in the last exercise (the one where it recommends use of FixedBitSet for storing alive/dead state).
Describe what about it does not make sense
During the adjustments in that answer, it doesn't touch the impl fmt::Display for Universe block, so it can't compile as that block needs updating or removal to still work.
Why does it not make sense?
It isn't clear that the impl fmt::Display for Universe block should be removed or tampered (it makes only a passing mention "Also, instead of rendering Unicode text, we'll switch to using the Canvas API.").
How could we improve it?
I have two ideas:
Recommended This can be fixed during the "Rendering to Canvas Directly from Memory" section. We could add somewhere in that section to remove said block
We could include how to fix the code:
use std::fmt;impl fmt::DisplayforUniverse{fnfmt(&self,f:&mut fmt::Formatter) -> fmt::Result{for row in0..self.height{// changedfor col in0..self.width{// changedlet idx = self.get_index(row, col);// changedlet cell = self.cells[idx];// changedlet symbol = if cell {'◼'}else{'◻'};// changedwrite!(f, "{}", symbol)?;}write!(f, "\n")?;}Ok(())}}
I recommend solution 1 over 2 because the effected code is dead code.
The text was updated successfully, but these errors were encountered:
Where in the docs did you come across this?
In section 4.4, in the last exercise (the one where it recommends use of
FixedBitSet
for storing alive/dead state).Describe what about it does not make sense
During the adjustments in that answer, it doesn't touch the
impl fmt::Display for Universe
block, so it can't compile as that block needs updating or removal to still work.Why does it not make sense?
It isn't clear that the
impl fmt::Display for Universe
block should be removed or tampered (it makes only a passing mention "Also, instead of rendering Unicode text, we'll switch to using the Canvas API.").How could we improve it?
I have two ideas:
I recommend solution 1 over 2 because the effected code is dead code.
The text was updated successfully, but these errors were encountered: