On page 303, the struct Pento.Game.Shape
was defined as defstruct color: :blue, shape: :x, points: []
but the code listing on page 305 calls it as %__MODULE__{points: points, color: color(name), name: name}
.
Based on the IEx output just below the listing, I believe that the call should be adjusted to %__MODULE__{points: points, color: color(name), shape: name}
, or maybe even better, all instances of the variable name
should be replaced to shape
in the constructor, for the sake of consistency.
(By the way, is there a reason that I might discover later why the struct
is initialized with default values rather than as a defstruct [:color, :points, :shape]
?)