...

/

Grouping Points Together in Shapes

Grouping Points Together in Shapes

Let's learn how to group multiple points to make a shape in Phoenix LiveView.

The Shape module is responsible for modeling pentomino shapes. It will wrap up the attributes that describe a shape and implement some functions that manage the behavior of shapes. In this lesson, we’ll define the Shape module and implement its constructor function. We’ll use the Point.prepare/4 function we just built to prepare a shape for rendering in the correct location, given some input.

Representing Shape attributes

Let’s begin with the attributes that describe a shape. Each shape will have a distinct color and a list of points. The Shape ...