Разработка программы для игры в морской бой с игровым полем 10х10 позиций, страница 8

           hod(XB,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),3)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           YA<>25,not(mycmp(X,YA,5)),not(mycmp(X,YA,5)),

           hod(X,YA,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),3)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           YB<>14,not(mycmp(X,YB,3)),not(mycmp(X,YB,5)),

           hod(X,YB,F),mykill,still(F).

% для четырехпалубного

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           pl(kletka(pole(XXX,YYY),4)),

           X=XX,X=XXX,Y<>YY,Y<>YYY,YY<>YYY,

           min(Y,YY,B),min(B,YYY,Z),max(Y,YY,BB),max(BB,YYY,ZZ),

           YA=ZZ+1,YB=Z-1,

           YA<>25,not(mycmp(X,YA,5)),not(mycmp(X,YA,4)),

           hod(X,YA,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           pl(kletka(pole(XXX,YYY),4)),

           X=XX,X=XXX,Y<>YY,Y<>YYY,YY<>YYY,

           min(Y,YY,B),min(B,YYY,Z),max(Y,YY,BB),max(BB,YYY,ZZ),

           YA=ZZ+1,YB=Z-1,

           YB<>14,not(mycmp(X,YB,5)),not(mycmp(X,YB,3)),

           hod(X,YB,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           pl(kletka(pole(XXX,YYY),4)),

           Y=YY,Y=YYY,X<>XX,X<>XXX,XX<>XXX,

           min(X,XX,B),min(B,XXX,Z),max(X,XX,BB),max(BB,XXX,ZZ),

           XA=ZZ+1,XB=Z-1,

           XA<>10,not(mycmp(XA,Y,5)),not(mycmp(XA,Y,4)),

           hod(XA,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           pl(kletka(pole(XXX,YYY),4)),

           Y=YY,Y=YYY,X<>XX,X<>XXX,XX<>XXX,

           min(X,XX,B),min(B,XXX,Z),max(X,XX,BB),max(BB,XXX,ZZ),

           XA=ZZ+1,XB=Z-1,

           XB<>-1,not(mycmp(XB,Y,5)),not(mycmp(XB,Y,4)),

           hod(XB,Y,F),mykill,still(F).  

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           X=XX,Y<>YY,min(Y,YY,Z),max(Y,YY,ZZ),

           YA=ZZ+1,YB=Z-1,

           YA<>25,not(mycmp(X,YA,5)),not(mycmp(X,YA,4)),

           hod(X,YA,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           X=XX,Y<>YY,min(Y,YY,Z),max(Y,YY,ZZ),

           YA=ZZ+1,YB=Z-1,

           YB<>14,not(mycmp(X,YB,5)),not(mycmp(X,YB,3)),

           hod(X,YB,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           Y=YY,X<>XX,min(X,XX,Z),max(X,XX,ZZ),

           XA=ZZ+1,XB=Z-1,

           XA<>10,not(mycmp(XA,Y,5)),not(mycmp(XA,Y,4)),

           hod(XA,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),pl(kletka(pole(XX,YY),4)),

           Y=YY,X<>XX,min(X,XX,Z),max(X,XX,ZZ),

           XA=ZZ+1,XB=Z-1,

           XB<>-1,not(mycmp(XB,Y,5)),not(mycmp(XB,Y,4)),

           hod(XB,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           XA<>10,not(mycmp(XA,Y,4)),not(mycmp(XA,Y,5)),

           hod(XA,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           XB<>-1,not(mycmp(XB,Y,4)),not(mycmp(XB,Y,5)),

           hod(XB,Y,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           YA<>25,not(mycmp(X,YA,4)),not(mycmp(X,YA,5)),

           hod(X,YA,F),mykill,still(F).

hod_think:-pl(kletka(pole(X,Y),4)),XA=X+1,XB=X-1,YA=Y+1,YB=Y-1,

           YB<>14,not(mycmp(X,YB,4)),not(mycmp(X,YB,5)),

           hod(X,YB,F),mykill,still(F).

% убийство двойного корабля

mykill:-pl(kletka(pole(X,Y),2)),pl(kletka(pole(XX,YY),2)),

        X=XX,Y<>YY,

        min(Y,YY,Z),max(Y,YY,ZZ),

        XA=X+1,XB=X-1,YA=Z-1,YB=ZZ+1,

        mychange(X,Y,7),mychange(XB,Y,5),mychange(XA,Y,5),

        mychange(X,YY,7),mychange(XB,YY,5),mychange(XA,YY,5),

        mychange(X,YB,5),mychange(XB,YB,5),mychange(XA,YB,5),

        mychange(X,YA,5),mychange(XB,YA,5),mychange(XA,YA,5),

        retract(pl(kletka(pole(X,Y),_)),pole),