HomeHome More SamplesMore Samples
///////////////////////////////////////////////////////////////////////////////
//
// Title: Historic Homes
// Author: Chris Perton
// Publication: Dell Logic Puzzles
// Issue: April, 1998
// Page: 11
// Stars: 2
// 
// Each year the Glendale Women's Club sponsors a Historic Homes Tour in which
// five old houses are (with the owners' permission, of course) opened to the 
// public. This year the five homes are on different streets (Azalea Drive, 
// Crepe Myrtle Court, Jasmine Boulevard, Magnolia Street, and Oleander Road),
// and each was built in a different year (1860, 1870, 1890, 1900, and 1920). 
// Can you give the order in which the tour visited the five homes (identifying 
// them by street) and match each with its year?
// 
// 1. The home on Jasmine is 20 years older than the one on Azalea.
// 2. The third home on the tour was built in 1860.
// 3. The tour visited the home on Magnolia sometime before the one built in 1890.
// 4. The tour visited the home on Oleander (which wasn't the last of the five to
//    be built) sometime before it visited the one on Jasmine, which in turn was
//    seen sometime before the one built in 1900.
// 
///////////////////////////////////////////////////////////////////////////////
//
// query: 
//          all HistoricHomes(order, age)
//
///////////////////////////////////////////////////////////////////////////////
//
// result:
//    
// order = [ {Azalea_Drive} 2, {Crepe_Myrtle_Court} 5, {Jasmine_Boulevard} 4, 
//           {Magnolia_Street} 1, {Oleander_Road} 3]
//
// age =   [ {Azalea_Drive} 1890, {Crepe_Myrtle_Court} 1900, 
//           {Jasmine_Boulevard} 1870, {Magnolia_Street} 1920, 
//           {Oleander_Road} 1860]      
//
///////////////////////////////////////////////////////////////////////////////

local Street = Azalea_Drive | Crepe_Myrtle_Court | Jasmine_Boulevard |
               Magnolia_Street | Oleander_Road 

local Order = Street->>[1..5]
local Age = Street->>[1860..1920]

pred HistoricHomes(order::Order, age::Age) iff
    age(_) = 1860 &
    age(_) = 1870 &
    age(_) = 1890 &
    age(_) = 1900 &
    age(_) = 1920 &

// 1. The home on Jasmine is 20 years older than the one on Azalea.
    age(Jasmine_Boulevard) = age(Azalea_Drive) - 20 &

// 2. The third home on the tour was built in 1860.
    age(house1860) = 1860 & order(house1860) = 3 & 

// 3. The tour visited the home on Magnolia sometime before the one built in 1890.
    age(house1890) = 1890 &
    order(Magnolia_Street) < order(house1890) &

// 4. The tour visited the home on Oleander (which wasn't the last of the five to
//    be built) sometime before it visited the one on Jasmine, which in turn was
//    seen sometime before the one built in 1900.
    age(Oleander_Road) <> 1920 &
    order(Oleander_Road) < order(Jasmine_Boulevard) &
    age(house1900) = 1900 & order(Jasmine_Boulevard) < order(house1900)

 


This page was created by F1toHTML