package knights_tour

  1. Overview
  2. Docs

Module Pentominos.PointSetSource

include sig ... end
Sourcetype t
Sourceval empty : t
Sourceval add : elt -> t -> t
Sourceval singleton : elt -> t
Sourceval remove : elt -> t -> t
Sourceval union : t -> t -> t
Sourceval inter : t -> t -> t
Sourceval disjoint : t -> t -> bool
Sourceval diff : t -> t -> t
Sourceval cardinal : t -> int
Sourceval elements : t -> elt list
Sourceval min_elt : t -> elt
Sourceval min_elt_opt : t -> elt option
Sourceval max_elt : t -> elt
Sourceval max_elt_opt : t -> elt option
Sourceval choose : t -> elt
Sourceval choose_opt : t -> elt option
Sourceval find : elt -> t -> elt
Sourceval find_opt : elt -> t -> elt option
Sourceval find_first : (elt -> bool) -> t -> elt
Sourceval find_first_opt : (elt -> bool) -> t -> elt option
Sourceval find_last : (elt -> bool) -> t -> elt
Sourceval find_last_opt : (elt -> bool) -> t -> elt option
Sourceval iter : (elt -> unit) -> t -> unit
Sourceval fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
Sourceval map : (elt -> elt) -> t -> t
Sourceval filter : (elt -> bool) -> t -> t
Sourceval filter_map : (elt -> elt option) -> t -> t
Sourceval partition : (elt -> bool) -> t -> t * t
Sourceval split : elt -> t -> t * bool * t
Sourceval is_empty : t -> bool
Sourceval mem : elt -> t -> bool
Sourceval equal : t -> t -> bool
Sourceval compare : t -> t -> int
Sourceval subset : t -> t -> bool
Sourceval for_all : (elt -> bool) -> t -> bool
Sourceval exists : (elt -> bool) -> t -> bool
Sourceval to_list : t -> elt list
Sourceval of_list : elt list -> t
Sourceval to_seq_from : elt -> t -> elt Seq.t
Sourceval to_seq : t -> elt Seq.t
Sourceval to_rev_seq : t -> elt Seq.t
Sourceval add_seq : elt Seq.t -> t -> t
Sourceval of_seq : elt Seq.t -> t
Sourceval min_x : t -> int

Find the smallest x coordinate in a pointset.

Sourceval max_x : t -> int

Find the largest x coordinate in a pointset.

Sourceval min_y : t -> int

Find the smallest y coordinate in a pointset.

Sourceval max_y : t -> int

Find the largest y coordinate in a pointset.

Sourceval 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 set
  • any other character means that it is.
Sourceval to_string : t -> string
Sourceval adjacent : t -> t

Gets the set of adjacent points. A point is adjacent if it satisfies both:

  • it is a 'neighbour of any one of the point in the input; and
  • it is not a point in the input itself
Sourceval normalize_translation : t -> t

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))

Sourceval variants : t -> t list

Gets all 'variants' of a given PointSet. A variant is similar shape obtained by applying rotation and mirroring transformations; and then applying normalize_translation.

Sourceval normalize : t -> t

Gets a canonical representation of a pointset that can be used to represent all variants.

Sourceval translate : Knights_tour.Point.t -> t -> t

Move all points an equal distance in both x and y coordinates

OCaml

Innovation. Community. Security.