CutNotFail 5 - Tic-tac-toe Is the o-player forced to put o...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Tic-tac-toe Is the o-player forced to put o in a particular position (is x-player threatening to win on its next move?) b(B1, B2, B3, B4, B5, B6, B7, B8, B9) represents the board For example: b(e,x,o, e,x,e, e,e,e) We can define line(B, X,Y,Z) to instantiate X,Y, Z to positions that make up a line: line( b(X,Y,Z, _,_,_, _,_,_), X,Y,Z). line( b(_,_,_, X,Y,Z, _,_,_), X,Y,Z). line( b(_,_,_, _,_,_, X,Y,Z), X,Y,Z). line( b(X,_,_, Y,_,_, Z,_,_), X,Y,Z). ... line( b(X,_,_, _,Y,_, _,_,Z), X,Y,Z). ... York University- CSE 3401- V. Movahedi 21 07_CutNotFail
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Tic-tac-toe (cont.) threatening(e, x, x). threatening(x, e, x). threatening(x, x, e). forced_move(Board) :- line(Board, X, Y, Z), threatening (X, Y, Z), ! . Generator: line(Board, X, Y, Z) generates possible lines Tester: threatening(X, Y, Z) checks if the line has a threatening pattern If the generated line is not threatening, backtracking occurs and another line is generated If threatening does not succeed on any line, “
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

CutNotFail 5 - Tic-tac-toe Is the o-player forced to put o...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online