All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
A Timely Manner (Posted on 2004-01-11) Difficulty: 4 of 5
After the second formal dance the friends had attended, they got ready for this dance, which was based on an article called "Miraculous Melons".

The four friends looked in their closet and decided that they wanted to mix things up. They each picked out one shirt, tie and suspenders from what the four had accumulated. (They had accumulated red, blue, green and white of each.)

When the four friends decided to meet at the dance, they all arrived at slightly different times, and as a result some people got to the dance earlier than others.

After the dance, the old fifth friend (called A) came to visit and asked someone who went (called B) about the dance. Based on the conversation, can you figure out what shirt, tie and suspenders were worn by each person, and in what order they came in?


A: When did everyone arrive at the dance?

B: Well, I know that the only person that came in between the person with the red shirt and the person with the green suspenders (in no particular order) was wearing a white tie.

A: What else did you notice about the time people came in?

B: Well, I know that the person wearing the green shirt came in just before the person wearing the red suspenders, and he came in just before the person wearing the red tie.

A: What did they do do when you were at the dance?

B: We took a picture of all four of us. It showed three of us standing: the person with the blue shirt on the left, the person with the blue tie in the middle, and the person with the white suspenders on the right. The other person was sitting down in the middle because he arrived last of all four of us.

A: I have one more question. I heard that you took off your green tie and gave it to a girl you liked. Did anything happen?

B: I am planning on taking her and I hope to wear the same shirt as I did this year. It was a red or blue shirt, I don't remember which.

A: I have to go now, bye!

See The Solution Submitted by Gamer    
Rating: 3.8000 (10 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution with logic analyzer Comment 44 of 44 |

Just for kicks, I wrote up the following scenario to solve the problem using the Alloy modeling language:

abstract sig article {}
abstract sig Shirt,Tie,Suspenders extends article {}
one sig rtie,btie,gtie,wtie extends Tie {}
one sig rshirt,bshirt,gshirt,wshirt extends Shirt {}
one sig rsus,bsus,gsus,wsus extends Suspenders {}

sig Friend { outfit:set article, next:set Friend }
one sig lf { l:Friend }

fact { all f:Friend | one Tie&f.outfit && one Shirt&f.outfit && one Suspenders&f.outfit }
fact { all a:article | some f:Friend | a in f.outfit }
fact {
    no lf.l.next
    all f:Friend-lf.l | one f.next && lf.l in f.^next
    all f:Friend, g:Friend-f | f.next != g.next
}

pred wearing[f:Friend,a:article] { a in f.outfit }
fun wearer[a:article]:Friend {{ f:Friend | f.wearing[a] }}
pred s [a,b:article] { a.wearer.wearing[b] }

pred clues {
// clue 1
    not s[rshirt,gsus]
    not s[rshirt,wtie]
    not s[gsus,wtie]
    (rshirt.wearer.next = wtie.wearer && wtie.wearer.next = gsus.wearer) ||
        (gsus.wearer.next = wtie.wearer && wtie.wearer.next = rshirt.wearer)

// clue 2
    not s[gshirt,rsus]
    not s[gshirt,rtie]
    not s[rsus,rtie]
    gshirt.wearer.next = rsus.wearer
    rsus.wearer.next = rtie.wearer
// clue 3
    not s[bshirt,btie]
    not s[bshirt,wsus]
    not s[btie,wsus]
//    some last:Friend | no last.next
    some last:Friend | no last.next && not last.wearing[bshirt] 
&& not last.wearing[btie] && not last.wearing[wsus]
// clue 4
    s[gtie,rshirt] || s[gtie,bshirt]
}
run clues for 4 but exactly 4 Friend

This did indeed come up with a unique solution.

The program output is graphical, and the results are the same match the intended solution:

First (B): blue shirt, green tie, green suspenders
Second: green shirt, white tie, white suspenders
Third: red shirt, blue tie, red suspenders
Last: white shirt, red tie, blue suspenders


  Posted by DJ on 2011-05-03 21:41:02
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information