# Prolog Programmer 1

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.

(A)

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'.

FIRST PART

You are asked to define the following predicates for tower type buildings:

• esTorre / 1 ( esTorre (Construction)): predicate checks whether Construction meets the conditions for

a tower.

• 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

Construction2.

SECOND PART

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.

Tietoa työnantajasta:
( 0 arvostelua ) Madrid, Spain

Projektin tunnus: #18990658

## Myönnetty käyttäjälle:

rmendoza83

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

€60 EUR 5 päivässä
(11 Arvostelua)
4.3

## 2 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

HaryCoders

Hi sir , i can help you with this project if you want kindly contact me to discuss the details , thanks.

€500 EUR 20 päivässä
(7 arvostelua)
2.2