【问题标题】:Solving ship puzzle using prolog使用 prolog 解决船舶难题
【发布时间】:2015-06-09 14:17:08
【问题描述】:

我需要使用 prolog 解决以下问题。
这些是提供的事实。

1. The Greek ship leaves at six and carries coffee.
2. The Ship in the middle has a black chimney.
3. The English ship leaves at nine.
4. The French ship with blue chimney is to the left of a ship that carries coffee.
5. To the right of the ship carrying cocoa is a ship going to Marseille.
6. The Brazilian ship is heading for Manila.
7. Next to the ship carrying rice is a ship with a green chimney.
8. A ship going to Genoa leaves at five.
9. The Spanish ship leaves at seven and is to the right of the ship going to Marseille.
10. The ship with a red chimney goes to Hamburg.
11. Next to the ship leaving at seven is a ship with a white chimney.
12. The ship on the border carries corn.
13. The ship with a black chimney leaves at eight.
14. The ship carrying corn is anchored next to the ship carrying rice.
15. The ship to Hamburg leaves at six.

Which ship goes to Port Said? Which ship carries tea?

我在网上搜索,但我无法使用 prolog 找到解决方案。
那么如何使用 prolog 解决这个问题?
谢谢。

【问题讨论】:

  • 尽量具体一点。这是作业吗?你还试过什么?你到底卡在哪里了?
  • 这是我的大学作业。这是互联网上非常有名的问题。实际上我什至不知道如何开始。

标签: prolog zebra-puzzle


【解决方案1】:

Zebra puzzle,又名爱因斯坦之谜,是一个需要通过程序解决的逻辑难题。

它有几个变体,都是你发布的那个形式。

剧透警告:以下链接包含谜题的序言解决方案

【讨论】:

  • 非常感谢..然后我将尝试将这种方法应用于我的问题。
猜你喜欢
  • 2022-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-19
  • 1970-01-01
  • 1970-01-01
  • 2014-06-06
相关资源
最近更新 更多