HomeHome More SamplesMore Samples
///////////////////////////////////////////////////////////////////////////////
//
// Title: Four Islands
// Author: Humphrey Dudley
// Publication: Dell Logic Puzzles
// Issue: April, 1998
// Page: 9
// Stars: 1
// 
// A tiny nation in the South Pacific contains four islands connected by bridges
// as shown (see below). Each of the four islands (Pwana, Quero, Rayou, and Skern)
// boasts a different primary export (alabaster, bananas, coconuts, and durian
// fruit) and a different tourist attraction (hotel, ice skating rink, jai alai 
// stadium, and koala preserve). Can you find the name, export, and tourist 
// attraction of each island on the map?
// 
//   N
// W   E     *compass directions
//   S
// 
// A, B, C, D are the islands
// 
// (A) -- (B)
//  |      |
//  |      |
// (C) -- (D)
// 
// 
// 1. The island noted for its koala preserve is due south of Pwana.
// 2. The island with the largest alabaster quarry is due west of Quero.
// 3. The island with the resort hotel is due east of the one that exports 
//    durian fruit.
// 4. Skern and the island with the jai alai stadium are connected by a 
//    north-south bridge. 
// 5. Rayou and the island that exports bananas are connected by an east-west
//    bridge.
// 6. The islands noted for the South Pacific's largest ice skating rink and 
//    for the jai alai stadium are not connected by a bridge.
// 
// Determine: Island island -- Island name -- Export -- Tourist Attraction
//
///////////////////////////////////////////////////////////////////////////////
//
// query: 
//          all FourIslands(name,export,attraction)
//
///////////////////////////////////////////////////////////////////////////////
//
// result:
//    
// name       = [ {Pwana} B, {Quero} C, {Rayou} D, {Skern} A]
// export     = [ {Alabaster} Rayou, {Bananas} Quero, {Coconuts} Skern, 
//                {Durian_Fruit} Pwana]
// attraction = [ {Hotel} Skern, {Ice_Rink} Pwana, {Jai_Alai_Stadium} Quero, 
//                {Koala_Preserve} Rayou]  
//
///////////////////////////////////////////////////////////////////////////////

IslandNames = Pwana | Quero | Rayou | Skern
ExportNames = Alabaster | Bananas | Coconuts | Durian_Fruit
AttractionNames = Hotel | Ice_Rink | Jai_Alai_Stadium | Koala_Preserve
Location = A | B | C | D

Islands = IslandNames->>Location
Exports = ExportNames->>IslandNames
Attractions = AttractionNames->>IslandNames

pred FourIslands(island::Islands,export::Exports,attraction::Attractions) iff
{1} ((island(Pwana) = A & island(attraction(Koala_Preserve)) = C) | 
     (island(Pwana) = B & island(attraction(Koala_Preserve)) = D)) &

{2} ((island(export(Alabaster)) = B & island(Quero) = A) | 
     (island(export(Alabaster)) = D & island(Quero) = C)) &

{3} ((island(attraction(Hotel)) = A & island(export(Durian_Fruit)) = B) | 
     (island(attraction(Hotel)) = C & island(export(Durian_Fruit)) = D)) &

{4} ((island(Skern) = A & island(attraction(Jai_Alai_Stadium)) = C) | 
     (island(Skern) = B & island(attraction(Jai_Alai_Stadium)) = D) |
     (island(Skern) = C & island(attraction(Jai_Alai_Stadium)) = A) | 
     (island(Skern) = D & island(attraction(Jai_Alai_Stadium)) = B)) &

{5} ((island(Rayou) = A & island(export(Bananas)) = B) | 
     (island(Rayou) = B & island(export(Bananas)) = A) |
     (island(Rayou) = C & island(export(Bananas)) = D) | 
     (island(Rayou) = D & island(export(Bananas)) = C)) &

{6} ((island(attraction(Jai_Alai_Stadium)) = A & island(attraction(Ice_Rink)) = D) | 
     (island(attraction(Jai_Alai_Stadium)) = B & island(attraction(Ice_Rink)) = C) |
     (island(attraction(Jai_Alai_Stadium)) = C & island(attraction(Ice_Rink)) = B) | 
     (island(attraction(Jai_Alai_Stadium)) = D & island(attraction(Ice_Rink)) = A))






This page was created by F1toHTML