Pentominos.PointSet
include sig ... end
type elt = Knights_tour.Point.t
val empty : t
val is_empty : t -> bool
val cardinal : t -> int
val min_x : t -> int
Find the smallest x
coordinate in a pointset.
val max_x : t -> int
Find the largest x
coordinate in a pointset.
val min_y : t -> int
Find the smallest y
coordinate in a pointset.
val max_y : t -> int
Find the largest y
coordinate in a pointset.
val of_string : string -> t
Takes a 'string image' of a pointset and parses it. A string image is just a multiline string where each character indicates whether or not the square/point at the corresponding location is part of the set.
Leading and trailing whitespace on each line are ignored. The remaining characters are interpreted as follows:
.
means the corresponding square is b not
in the setval to_string : t -> string
Gets the set of adjacent points. A point is adjacent if it satisfies both:
Translates the pointset so that all points x
and y
coordinates are greater or equal to 0; and have the smallest possible values given these conditions (i.e there is at least one point with x = 0
, and one point (possibly a different one) with y = 0
))
Gets all 'variants' of a given PointSet. A variant is similar shape obtained by applying rotation and mirroring transformations; and then applying normalize_translation
.
Gets a canonical representation of a pointset that can be used to represent all variants.
val translate : Knights_tour.Point.t -> t -> t
Move all points an equal distance in both x and y coordinates