:
11.09.17

14.08.17

26.06.17

17.06.17

09.06.17
?
17.05.17
-?
04.05.17
:
29.04.17
:
26.04.17

17.04.17

.2017
.......
  12345
6789101112
13141516171819
20212223242526
27282930   
!!!
!!!
.
.
, .

, , , : Prolog

! () . , Word, , , ( pic), , , .., .

Prolog

1.

, .

predicates

hello.

goal

hello.

clauses

hello:-

makewindow(1,7,7," ",4,56,14,22),

nl, write(" ,n"," Enter."),

cursor(4,6),

readln(Name),nl,

write(" n PDC Prolog,n","",Name,"!").

: PDC Prolog, Vladimir!

, .

predicates

hello.

goal

hello.

clauses

hello:-

makewindow(1,7,7," ",4,56,14,22)

nl, write(" ,n"," Enter."),

cursor(4,6),

readln(Name)nl,

write(" n PDC Prolog,n",",Name,!").

: 423 Syntax eror.

2.

. .

predicates

book(symbol,symbol,symbol,integer).

clauses

book(" ..","IBM PC ","",1988).

book(" .."," ","",1984).

book(" ..","- ","",1987).

book(" .."," ","",1989).

book(" ..","PDC Prolog","",2000).

book(" .."," ","",1997).

book(" .."," ","",1999).

: X= Proektirovanie OR BD, Y=SUDOSTROENIE, Z=1984

X=Object models of DATA, Y=SZPI, Z=1987

X=Modelirovanie CMO, Y=SZPI, Z=1989

X=PDC Prolog, Y=SZPI, Z=2000

4 Solutions

X= Proektirovanie OR BD

X=Object models of DATA

X=Modelirovanie CMO

X=PDC Prolog

4 Solutions

E=Petuchov O.A., X=Object models of DATA, Z=1987

E=Petuchov O.A., X=Modelirovanie CMO, Z=1989

E=Petuchov O.A., X= PDC Prolog, Z=2000

E=Ankudinov G.I., X=Automat theory, Z=1997

E=Nikolaev V.I., X=Diskretniye struktury, Z=1999

5 Solutions

3.

:

domains

name=symbol

year_in, year_out = integer

predicates

parents(name,name)

woman(name)

man(name)

offspring(name,name)

father(name,name)

mother(name,name)

parent_parents(name,name)

brother(name,name)

grandfather(name,name)

grandmother(name,name)

emperor(name,year_in,year_out)

emperor_was(name,integer)

clauses

parents(" III"," I").

parents(" II"," I").

parents(" I"," I").

parents(" I"," I").

parents(" I"," II").

parents(" II"," III").

parents(" III"," II").

woman(" II").

man(" III").

man(" I").

man(" I").

man(" I").

man(" II").

man(" III").

man(" II").

offspring(Y,X):-parents(X,Y).

father(X,Y):-parents(X,Y),man(X).

mother(X,Y):-parents(X,Y),woman(X).

parent_parents(X,Z):-parents(X,Y),parents(Y,Z).

brother(X,Y):-parents(Z,X),parents(Z,Y),man(X),X<>Y.

grandfather(X,Y):-father(X,Z),father(Z,Y).

grandmother(X,Y):-mother(X,Z),father(Z,Y).

emperor(" III",1761,1762).

emperor(" II",1762,1796).

emperor(" I",1796,1801).

emperor(" I",1801,1825).

emperor(" I",1825,1855).

emperor(" II",1855,1881).

emperor(" III",1881,1894).

emperor(" II",1894,1917).

emperor_was(X,Y):-emperor(X,A,B),Y>=A,Y<=B.

: Y=aleksandr I X=petr III, A=1761, B=1762 X=pavel I

1 Solution X=ekaterina II, A=1762, B=1769 1 Solution

X=pavel I, A=1796, B=1801

X=aleksandr I, A=1801, B=1825

X=nikolay I, A=1825, B=1855

X=aleksandr II, A=1855, B=1881

X=aleksandr III, A=1881, B=1894

X=nikolay II, A=1894, B=1917

8 Solutions

4.

:

domains

name=symbol

predicates

star(name)

planet(name)

revolve(name,name)

satellite(name,name).

goal

satellite(X,""),

write(X," ."),

nl.

clauses

star("").

planet("").

planet("").

revolve("","").

revolve("","").

revolve("","").

revolve("","").

revolve("","").

satellite(X,Y):-planet(Y),revolve(X,Y).

: .

: , . .

domains

name=symbol

predicates

men(name)

mama(name)

sons(name,name)

doughter(name,name)

deda(name,name)

brother(name,name).

goal

doughter(Z,Y),

write(Z,Y),

nl.

clauses

men(Vaciliy).

men(Michail).

men(Maxim).

mama(Olga).

sons(Michail,Olga).

sons(Maxim,Olga).

doughter(Olga,Vasiliy).

deda(X,Y) :--men(X),men(Y),sons(X,Y),doughter(Z,Y).

brother(X,Y) :--men(X),men(Y), sons(X,Z),sons(Y,Z),X<>Y.

: Olga, Vaciliy

5.

: 0 1.

goal

random(X),

Z=X,

write(" 0 1 : ",Z),

nl.

: 0,64823988962

0 10 10 35.

goal

random(10,X),

Z=X,

write(" 0 10 : ",Z),

nl.

: 5

goal

random(25,X),

Z=X++10,

write(" 10 35:,Z),

nl.

: 21

6.

     Prolog
! () . , Word, , , ( pic), , , ..,
: 20.08.10 | [ + ]   [ - ]  
: 109
: 0
20.08.10
20.08.10
20.08.10
20.08.10
20.08.10
{dnmbottom}
70 000 , , , .