Proyect Based in LEGO constructions
They are arranged for LEGO constructions. These parts can be rectangles or squares. The pieces are defined
by a compound term
part / 4, where the first argument represents the width of the piece (number of nails), the second argument the
height of the workpiece, the third argument depth (number of nails) and the last argument color piece.
• The workpiece dimensions (width, height and depth) are represented as numbers Peano.
• Colors that are available are: red (r), blue (a), green (v) and yellow (am).
• Example : (S (s (s (s (0)))), s (0), s (s (0)), r)
Available parts may be supported on the ground or on another piece assembled, forming a construction. The
constructions, they are composed of at least one piece, can be of two types:
• Tower: each level of the building has a single piece. In addition, each piece can only be assembled over
an equal or larger than she part (the length and width of the bottom piece must be greater or equal to the
same dimensions of the top piece).
• Building: each level of the building may consist of several pieces (always the same depth and height 1),
which can be assembled in any way.
The constructions type tower They are represented as lists, where the last part of the tower is the head of the
list. The constructions building type They are represented by a matrix (a list of lists) showing the elevation of
the building. In said matrix, each row (each inside list) represents a level of construction (building) and each
cell (element of internal list) represents a nail one piece by using the color of the piece that is in said instead of
the elevation. The number of rows in the array is the number of levels of the building, and the number of
columns is the number of nails wider level. The cells of the matrix not including nails parts are represented by
the constant 'b'.
You are asked to define the following predicates for tower type buildings:
• esTorre / 1 ( esTorre (Construction)): predicate checks whether Construction meets the conditions for
• alturaTorre / 2 ( alturaTorre (Built, A)): predicate that tests whether the first argument (Construction)
is a tower, and the second argument (A) is the height of the tower.
• coloresTorre / 2 ( coloresTorre (Construction, colors)): predicate verifies if the first argument
(construction) is a tower and the second argument (Color) is a list with the colors of the tower.
• coloresIncluidos / 2 (ColoresIncluidos (Construction1, Construction2)):
predicate is verified if (a) both predicates are towers and (b) all colors of Construction1 are also in the
You are asked to define the following predicates for building construction type:
• esEdificioPar / 1 ( esEdificioPar (Construction)): predicate that is true if construction is a building that
meets each level has an even number of nails.
• esEdificioPiramide / 1 ( esEdificioPiramide (construction): predicate that checks whether
construction is a building that meets each level has a strictly higher than the level above wide.
Hola soy programador experto en prolog, la mayoria de proyectos que he realizado en freelancer han sido proyectos en prolog, puedes verificar mi reputación