Skip to content

Commit

Permalink
Mode and comments added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Chaignon committed Sep 18, 2013
1 parent 14aa5bf commit ea041cf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
19 changes: 19 additions & 0 deletions TP1/basemenu.pl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* TP Base Menu
* @author Clement GAUTRAIS
* @author Paul CHAIGNON
* @version Annee scolaire 2013/2014
*/

hors_d_oeuvre(artichauts_Melanie).
hors_d_oeuvre(truffes_sous_le_sel).
hors_d_oeuvre(cresson_oeuf_poche).
Expand Down Expand Up @@ -32,27 +39,39 @@


% Question 1.2

% plat_resistance(?)
plat_resistance(Plat):-
viande(Plat);
poisson(Plat).

% repas(?, ?, ?)
repas(Entree, Plat, Dessert):-
hors_d_oeuvre(Entree),
plat_resistance(Plat),
dessert(Dessert).

% bon_plat(?)
bon_plat(Plat):-
calories(Plat, Cal),
Cal > 200,
Cal < 400.

% plus_calorique_algues(?)
plus_calorique_algues(Plat):-
calories(bar_aux_algues, CalAlgues),
calories(Plat, Cal),
Cal > CalAlgues.

% total_calories(?, ?, ?, -)
total_calories(Entree, Plat, Dessert, Total):-
repas(Entree, Plat, Dessert),
calories(Entree, CalEntree),
calories(Plat, CalPlat),
calories(Dessert, CalDessert),
Total is CalEntree + CalPlat + CalDessert.

% repas_equilibre(?, ?, ?)
repas_equilibre(Entree, Plat, Dessert):-
total_calories(Entree, Plat, Dessert, Total),
Total < 800.
Expand Down
31 changes: 24 additions & 7 deletions TP1/basevalois.pl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
TP Base Valois - Famille de France
@author Prenom1 NOM1
@author Prenom2 NOM2
@version Annee scolaire 20__/20__
*/
* TP Base Valois - Famille de France
* @author Clement GAUTRAIS
* @author Paul CHAIGNON
* @version Annee scolaire 2013/2014
*/

homme(charles_V).
homme(charles_VI).
Expand Down Expand Up @@ -113,41 +112,59 @@


% Question 2.1
% enfant(?, ?)
enfant(E, P):-
pere(P, E);
mere(P, E).

% parent(?, ?)
parent(P, E):-
enfant(E, P).

% grand_pere(+, -)
grand_pere(G, E):-
pere(G, P),
parent(P, E).

% frere(+, -)
frere(F, E):-
pere(P, F),
pere(P, E),
mere(M, E),
mere(M, F),
homme(F),
E \= F.

% soeur(+, -)
soeur(S, E):-
parent(P, S),
parent(P, E),
femme(S),
E \= S.

% frere_ou_soeur(+, -)
frere_ou_soeur(FS, E):-
soeur(FS, E);
frere(FS, E).

% oncle(?, ?)
oncle(O, N):-
parent(P, N),
frere(O, P).
frere(P, O).

% cousin(?, ?)
cousin(C, E):-
parent(P, E),
frere_ou_soeur(P, FS),
enfant(C, FS).

% le_roi_est_mort_vive_le_roi(+, +, -)
le_roi_est_mort_vive_le_roi(R1, D, R2):-
roi(R1, _, _, D),
roi(R2, _, D, _).

% Question 2.2
% ancetre(+, -)
ancetre(X,Y):-
parent(X,Y).
ancetre(X,Y):-
Expand Down

0 comments on commit ea041cf

Please sign in to comment.