. , , ,

,,,

- " " Prolog — ,

N -8

" "

.. . -1-95.

1. :

- .

2. :

- , -

:

--------------------------------------------------------------------

|   |

--------------------------------------------------------------------

| | || 䠠 | ࠠ | 񠠠 |

|| || ||-----------------

| | | || | | |

--------------------------------------------------------------------

| | | | | | | |

,

.

, -

, -, , .

.

3. , :

3.1 , -

, , -

:

- ,

- ,

- ,

- ,

- ,

- .

3.2 :

- ,

- ,

- ,

- ,

- ,

- .

4. :

4.1

4.2 .

5. - :

1.

4.10.96

2. , ,

18.10.96

3.

25.10.96

4. -

15.11.96

5.

29.11.96

6. -

24.12.96

7.

25.12.96

/ ../

/ .. -1-95/

.

....................................

1.

...................

2. ...

3. ...............

4. ...........

5. :

5.1 START...............

5.2 PATCH.............

5.3 LOAD ......

5.4 PROCESS(0)

5.5 PROCESS(1) ..........

5.6 PROCESS(2) ..............

5.7 PROCESS(3) .........

5.8 PROCESS(4) .................

5.9 PROCESS(5) ........

5.10 PROCESS(6) ............

5.11 - PROCESS(7) .........

5.12 PROCESS(8) ..........

5.13 Select ..............

5.14 LOD ..........

5.15 SVE .......

5.16 Sel .................

6. ........................

7. ........................

8.

: ...................

.................................

..........................

Turbo Prolog v

2.0 ( ).

, -

- -

. -

. ,

- , - .. -

-

-

.

1. -

- - -, -

.

-

. -

-

.

, :

- -

.

- -

: , -

, -

.

-

-

.  

, .

2.

-

, -

, . -

: , -

. ,

.

, - , -

, - .

, -

, - , -

, - . -

.

3.

, -

start_patch.

,

.

:

0 - ... -

1 - -

2 - -

3 - -

4 - -

5 - -

6 - -

7 - -堠 - -

8 - -

.

5.

,

.

5.1 START

START GOAL -

. -

LOAD,

PATCH.

5.2 PATCH

, C.

PROCESS, -

C . -

Repeat, RUN

, C 8

.

5.3 LOAD

LOAD -

.

, -

"". LOAD

ilgiz.dat

existfile consult. -

.

5.4 PROCESS(0)

,

.

5.5 PROCESS(1)

process(1) -

, , .

SELECT,

,

.

.

X,

SEL, X. SEL

,

PROCESS(1) . process(1)

Repeat,

.

5.6 PROCESS(2)

-

. -

, .

SELECT, .

SELECT -

retract .

5.7 PROCESS(3)

PROCESS(3) .

PROCESS(3) MENU PROCESS(1)

Repeat.

5.8 PROCESS(4)

.

lod N,

. PROCESS(4)

Repeat.

5.9 PROCESS(5)

PROCESS(5) PROCESS(4).

SVE, ,

I.

5.10 PROCESS(6)

.

: SELECT

, SEL, -

.

, ,

fail.

, -

.

5.11 - PROCESS(7)

- .

:

, , .

,

, , .

. ,

.

5.12 ۠ PROCESS(8)

, -

.

PATCH, C=8,

.

5.13 SELECT

SELECT

, -

SEL.

5.15 LOD

.

existfile

consult.

, .

5.16 SVE

, : sve(1) -

, , sve(2) -

ilgiz.dat

save. .

5.17 SEL

SEL SELECT.

SELECT

SEL .

6.

CODE=12050

/* **************************

* ߠ *

* *

* *

**************************

*/

domains

i,c,d,f=integer

a,b,m,t=symbol

database -svod1

svod1(a,b,c,d,f,m,t)

database -lolo

lolo(a,b,c,d,f,m,t)

database -kuku

kuku(a,b,c,d,f,m,t)

database

svod(a,b,c,d,f,m,t)

predicates

start

patch

load

select(i)

sel(i,i)

process(i)

procedure(i)

sve(i)

lod(i)

repeat

goal

start.

clauses

/* */

start:-

makewindow(1,26,94," ",0,0,25,80),

clearwindow,

load,

patch.

/* */

patch:-

repeat,

cursor(7,0),

write(" 0 - pp... "),nl,

write(" 1 - "),nl,

write(" 2 - "),nl,

write(" 3 - "),nl,

write(" 4 - "),nl,

write(" 5 - "),nl,

write(" 6 - "),nl,

write(" 7 - "),nl,

write(" 8 - -"),nl,

write(" 9 - "),nl,

write(" =>"),

readint(Choice),

Choice >= 0,

Choice < 10,

clearwindow,

process(Choice),

clearwindow,

Choice = 9,

retractall(_),

removewindow.

/* */

load:-

existfile("ilgiz.dat"),

consult("ilgiz.dat"),

cursor(1,2),

write(" ").

load:-

makewindow(2,74,79,"",6,18,8,40),

cursor(2,10),

write(" "),

readchar(_),

removewindow,

!.

/*pp */

process(7):-

makewindow(1,2,7," ",0,0,25,80),

nl,

write(" ࠠ :"),readln(K),nl,

write(" 堠 :"),readln(O),nl,

write(" Ӡ :"),readint(I),nl,

write(" :"),readint(Y),nl,

write(" 蠠 :"),readint(T),nl,

write(" :"),readln(FF),nl,

write(" 󠠠 :"),readln(HH),nl,

N1=K,NA1=O,KO1=I,OB1=Y,PL1=T,FF1=FF,HH1=HH,

assertz(svod(N1,NA1,KO1,OB1,PL1,FF1,HH1)),

removewindow,

fail.

/* -*/

process(8):-

makewindow(1,2,7,"-",0,0,25,80),

nl,

write(" :"),readln(A),nl,nl,

svod(KY,NA,N,OB,PL,FFF,HHH),

A=KY,

write("䠠 :"),write(KY),nl,

write("堠 :"),write(NA),nl,

write(" Ӡ :"),write(N),nl,

write(" :"),write(OB),nl,

write(" 蠠 :"),write(PL),nl,nl,nl,

write(" :"),write(FFF),nl,

write("ࠠ :"),write(HHH),nl,

write(" "),

readchar(_),

removewindow,

!.

process(8):-

write(" ."),

write(" "),nl,nl,nl,

write(" :"),

readln(A),nl,

A=N1,

write(" 堠 :"),readln(F),nl,

write(" Ӡ :"),readint(Y),nl,

write(" :"),readint(J),nl,

write(" 蠠 :"),readint(G),nl,

write(" :"),readln(L),nl,

write(" 󠠠 :"),readln(M),nl,

NA1=F,KO1=Y,OB1=J,PL1=G,FF1=L,HH1=M,

assertz(svod(N1,NA1,KO1,OB1,PL1,FF1,HH1)),

removewindow,

fail.

/*pp pp*/

process(0):-

makewindow(1,27,30," pp...",0,0,25,80),nl,nl,

write(" p-p "),nl,nl,

write(" BSO"),nl,nl,

write(" -TURBO-PROLOG v.2.0. "),nl,nl,

write(" p: .. "),nl,nl,

write(" , p.-1-95 () 1996 . "),nl,

cursor(20,24),

write(" "),

readchar(_),

removewindow.

/* */

process(1):-

makewindow(1,2,7,"pp ",0,0,25,80),

nl,

select(N),

X=N,

svod(KY,NA,X,OB,PL,FFF,HHH),

write(" ࠠ :"),write(N),nl,

write("堠 :"),write(NA),nl,

write(" Ӡ :"),write(X),nl,

write(" :"),write(OB),nl,

write(" 蠠 :"),write(PL),nl,

write(" :"),write(FFF),nl,

write("ࠠ :"),write(HHH),nl,

nl,

write(" :"),readln(N1),

write(" :"),readln(NA1),nl,

write(" Ӡ :"),readint(KO1),nl,

write(" :"),readint(OB1),nl,

write(" :"),readint(PL1),nl,

write(" :"),readln(FF1),nl,

write(" :"),readln(HH1),nl,

retract(svod(KY,NA,KO,OB,PL,FFF,HHH)),

assert(svod(N1,NA1,KO1,OB1,PL1,FF1,HH1)),

!,

removewindow.

/* */

process(2):-

makewindow(1,2,7," ",0,0,25,80),

nl,

select(N),

X=N,

svod(KY,NA,X,OB,PL,FFF,HHH),

retract(svod(KY,NA,X,OB,PL,FFF,HHH)),!,

removewindow.

/* */

process(3):-

makewindow(1,2,7,"p ",0,0,25,80),

nl,

write("============================================================================="),nl,

write("|   |"),nl,

write("============================================================================="),nl,

write("| 䠠 | | | 䠠 |ࠠ | 񠠠 |"),nl,

write("| | | | ||----------------------"),nl,

write("| | | || | | |"),nl,

write("============================================================================="),nl,

svod(KY,NA,N,OB,PL,FFF,HHH),

cursor(Z,_),

cursor(Z,2),write(KY),

cursor(Z,12),write(NA),

cursor(Z,27),write(N),

cursor(Z,35),write(OB),

cursor(Z,46),write(PL),

cursor(Z,0),write("|"),

cursor(Z,56),write(FFF),

cursor(Z,67),write(HHH),

nl,

fail.

process(3):-

write("------------------------------------------------------------------------------"),

nl,

write(" "),

readchar(_),

removewindow.

/* */

process(4):-

nl,

makewindow(2,15,4,"",5,5,20,70),

write("1 - "),nl,

write("2 - ilgiz.dat"),nl,

write("3 - "),nl,

write("==>"),

readint(C),

C>0,C<4,

lod(C),

!,

removewindow.

/* */

process(5):-

nl,

makewindow(2,15,4,"",5,5,20,70),

write("1 - "),nl,

write("2 - ilgiz.dat"),nl,

write("3 - "),nl,

write("==>"),

readint(I),

I>0,I<4,

sve(I),!,

removewindow.

/* */

process(6):-

nl,

makewindow(3,2,7," ",0,0,25,80),

write("1 - 󠠠 "),nl,

write("2 - "),nl,

write("3 - "),nl,

write("4 - "),nl,

write("==>"),

readint(O),

O>0,O<5,

procedure(O),

removewindow.

process(_).

/* */

procedure(1):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,svod1),

nl,

write(" , "),

nl,

write(" :"),

readln(X),

svod(KY,NA,N,OB,PL,FFF,HHH),

S=KY,

S=X,

NA1=Na,KO1=N,OB1=OB,PL1=PL,FF1=FFF,HH1=HHH,

assert(svod1(S,NA1,KO1,OB1,PL1,FF1,HH1)),

fail.

procedure(1):-

write(" "),nl,

write("______________________________________________________________________________"),

write("   !"),

write("------------------------------------------------------------------------------"),

write("! ! ! !䠠 ! ࠠ ! 񠠠 !"),

write("! ! ! ! !! ----------------------"),

write("! ! ! !! ! ! ࠠ !"),

write("------------------------------------------------------------------------------"),

nl,

svod1(S,NA,N,OB,PL,FFF,HHH),

cursor(Z,_),

cursor(Z,2),write(S),

cursor(Z,12),write(NA),

cursor(Z,27),write(N),

cursor(Z,35),write(OB),

cursor(Z,46),write(PL),

cursor(Z,56),write(FFF),

cursor(Z,67),write(HHH),

nl,

fail.

procedure(1):-

write("------------------------------------------------------------------------------"),

save("not.dat",svod1),

nl,

write(" not.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(1):-

write("------------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

procedure(2):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,lolo),

nl,

write(" , "),nl,

write(" 䠠 :"),

readint(X),

svod(KY,NA,N,OB,PL,FFF,HHH),

S=OB,

S=X,

N1=KY,NA1=NA,KO1=N,PL1=PL,FF1=FFF,HH1=HHH,

assert(lolo(N1,NA1,KO1,S,PL1,FF1,HH1)),

fail.

procedure(2):-

write(" "),nl,

write("______________________________________________________________________________"),

write(" K   "),

write("-----------------------------------------------------------------------------!"),

write("! ! ! !䠠 ! ! 񠠠 !"),

write("! ! ! ! !!----------------------!"),

write("! ! ! !! ! ! ࠠ !"),

write("------------------------------------------------------------------------------"),

lolo(KY,NA,N,S,PL,FFF,HHH),

cursor(Z,_),

cursor(Z,2),write(KY),

cursor(Z,12),write(NA),

cursor(Z,27),write(N),

cursor(Z,35),write(S),

cursor(Z,46),write(PL),

cursor(Z,76),write("!"),

cursor(Z,56),write(FFF),

cursor(Z,67),write(HHH),

nl,

fail.

procedure(2):-

write("-----------------------------------------------------------------------------"),

save("not1.dat",lolo),

nl,

write(" not1.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(2):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

procedure(3):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,kuku),

nl,

write(" , "),

nl,

write(" :"),

readint(X),

svod(KY,NA,N,OB,PL,FFF,HHH),

S=PL,

S>=X,

N1=KY,NA1=NA,KO1=N,HH1=HHH,FF1=FFF,OB1=OB,

assert(kuku(N1,NA1,KO1,OB1,S,FF1,HH1)),

fail.

procedure(3):-

write(" "),nl,

write("_____________________________________________________________________________"),nl,

write("   !"),nl,

write("-----------------------------------------------------------------------------"),nl,

write("! ! ! ! 䠠 ! ! 񠠠 !"),nl,

write("! ! ! ! !!----------------------"),nl,

write("! ! ! !! ! ! !"),nl,

write("-----------------------------------------------------------------------------"),nl,

kuku(KY,NA,N,OB,S,FFF,HHH),

cursor(Z,_),

cursor(Z,2),write(KY),

cursor(Z,12),write(NA),

cursor(Z,27),write(N),

cursor(Z,35),write(OB),

cursor(Z,46),write(S),

cursor(Z,76),write("!"),

cursor(Z,56),write(FFF),

cursor(Z,67),write(HHH),

nl,

fail.

procedure(3):-

write("-----------------------------------------------------------------------------"),

save("not2.dat",kuku),

nl,

write(" not.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(3):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

/* */

sve(1):-

write(" :"),

readln(N),

save(N),

write(" "),

beep,

!.

sve(1):-

write(" , "),

readchar(_).

sve(2):-

save("ilgiz.dat").

sve(3).

/* */

lod(1):-

retractall(_),

write(" :"),

readln(N),

existfile(N),

consult(N),

write(" "),

beep,

!.

lod(1):-

nl,

write(" "),nl,

write(" "),

readchar(_).

lod(2):-

retractall(_),

existfile("ilgiz.dat"),

consult("ilgiz.dat"),

write(" "),

beep,

!.

lod(2):-

write(" ilgiz.dat "),nl,

write(" "),

readchar(_).

lod(3).

repeat.

repeat:- repeat.

/* */

select(N):-

nl,

write("1 - "),nl,

write("2 - "),nl,

write("3 - "),nl,

write("4 - "),nl,

write("5 - "),nl,

write("==>"),

readint(X),

sel(X,N).

sel(1,N):-

nl,

write(" 䠠 :"),

readln(M),

svod(M,_,Z,_,_,_,_),

N=Z.

sel(1,N):-

N=0.

sel(2,N):-

nl,

write(" :"),

readln(L),

svod(_,L,Z,_,_,_,_),

N=Z.

sel(2,N):-

N=0.

sel(3,N):-

nl,

write(" : "),

readint(F),

svod(_,_,F,_,_,_,_),

N=F.

sel(3,N):-

N=0.

sel(4,N):-

nl,

write(" :"),

readint(Q),

svod(_,_,Z,Q,_,_,_),

N=Z.

sel(4,N):-

N=0.

sel(5,N):-

nl,

write(" :"),

readint(W),

svod(_,_,Z,_,W,_,_),

N=Z.

7.

. -

. -

,

predicates .. , -

, -

.

, -

.

fail. . ,

- .

.

8.

:

" "

- .

,

.

, , , , ,

.

.

:

0 - ...

1 -

2 -

3 -

4 -

5 -

6 -

7 - -

8 -

-

. .

0 - ...

.

.

1 -

:

1 -

2 -

3 -

. (

) . -

, -

.

2 -

.

" " " " -

.

, . -

( -

), .

3 -

.

.

.

4 -

.

. ,

.

5 -

.

:

1 -

2 - ilgiz.dat

3 -

-

" ".

6 -

.

,

.

.

7 - -

-

.

, , . -

,

, .

.

"-".

.

8 -

--

.

. .

, ,

, .

.

- .

,

-

.

:

. "

"

. " - "

. " -

. 2.3"


[1]A*.FRM*.MAC
<

[1]A*.FRM                    

N -8 " " .. . -1-95. 1. :

 

 

 

! , , , .
. , :