0

I've tried to use this technique, in a query: Checking all of facts in prolog . And seen this which is probably the same as my question. Reporting *why* a query failed in Prolog in a systematic way .

Specifically I am trying to define chess rules. I want to say:

there is no king capture, that can't be blocked by a pawn or a ray with the same move.

hello(X, F, T) :-
   turn_king(K),
   \+ (\+ (  block_ray_move(X, K, F, T)
          ;  block_pawn_move(X, K, F, T)
          ),
          cnt r_king_captures(X)
      ).

I haven't tested this, but I am assuming it is logically correct. One problem might be, this fails either there is no king captures, or there is no block to a king capture.

So how should I restructure the logic, so I can tell between the two possibilities.

false
  • 10,533
  • 12
  • 98
  • 192
eguneys
  • 5,648
  • 7
  • 27
  • 51

0 Answers0