COS 512 Knight Chess Assignment

[ad_1]

COS 512 Knight Chess Assignment

Question A

On a 8×8 chessboard we use the predicate sq(X,Y) to identify a position (where X, Y are the corresponding square’s co-ordinates).  A chess knight can move two squares in a left-right or front-back direction and then one square in a vertical fashion (https://en.wikipedia.org/wiki/Knight_(chess)).

We have defined the knightpath/1 predicate in the following incomplete Prolog program, which succeeds if invoked with a list of squares which are a valid position sequence for a chess knight.

Fill in the (ten) blanks to complete the program.

Then, show a Prolog query which succeeds by invoking knightpath/1 with a list of at least four successive legal knight moves.

knightpath([sq(X,Y)]) :-

inboard(X),

___1___.

knightpath([S1,S2|R]) :-

jump(___2___),

knightpath(___3___).

jump(sq(X1,Y1),sq(X2,Y2)) :-

___4___,

inboard(Y1), move(Dx,Dy),

direction(Sx),

___5___,

X2 is X1+Sx*Dx,

___6___.

move(1,2).

move(___7___).

direction(1).

___8___.

___9___ (C) :-

0 < C,

___10___   .

COS 512 Knight Chess Assignment

Question Β

Consider the following as expressed in FOL:

Convert the above in CNF and use resolution (and refutation) to prove that:

Question C

The “Towers of Hanoi” is a legendary problem (https://en.wikipedia.org/wiki/Tower_of_Hanoi).

A token implementation of how to solve that problem in Prolog appears at:

http://www.cs.cornell.edu/courses/cs4700/2011fa/lectures/16_FirstOrderLogic.pdf.

An interesting approach to formulating this problem via FOL appears at pages 165-168 of a seminal book on AI, by Barr and Feigenbaum, which was published in the very early 80s and is now available at:

https://archive.org/details/handbookofartific01barr

Study both approaches to the problem and describe how you would try to map the Prolog approach to the FOL approach and/or vice-versa. COS 512 Knight Chess Assignment

Need Help with a similar Assignment?

The post COS 512 Knight Chess Assignment appeared first on oneacademyessays.

[ad_2]

Source link

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp