Why I can't get an answer for the Ship Puzzle with Prolog?

后端 未结 2 2002
感情败类
感情败类 2021-01-20 05:01

I need to solve the Ship Puzzle problem with using Prolog. Here are the facts.

There are 5 ships.

  1. The Greek ship leaves at six and
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 05:30

    The number of arguments to the term ship(...) in the second line (after solution predicate) is wrong. It is:

    middleShip(ship(_,_,_,_,'Black',_),Shipes),
    

    while it should be:

    middleShip(ship(_,_,_,'Black',_),Shipes),
    

    I haven't checked if this works, but this is causing your solver to fail for sure.

提交回复
热议问题