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

Home > Logic
Fourteen Neighbor Nuance (Posted on 2023-10-06) Difficulty: 3 of 5
The following fourteen people live on the same block:

The girls:
• Alice, Ann, Caroline, Louise, Mary, Martha, Rose.

The boys:
• Andrew, Charles, David, John, Paul, Peter, Richard.

There are seven houses on each side of the street. Each person lives alone in one of them. If the following additional information is also known:

  1. Mary lives next to a girl.
  2. John lives diagonally across from two boys.
  3. Richard lives next to Charles.
  4. Ann and Martha live on different sides of the street.
  5. Caroline lives between two boys.
  6. There are more boys than girls on the side where David lives.
  7. Rose lives across from Ann.
  8. Alice lives on a corner.
  9. Charles lives mid-block.
  10. Andrew lives across from Alice.
  11. Paul lives across from Mary.
  12. Martha lives diagonally across from Caroline.
  13. Richard lives across from Martha.
  14. Louise lives as close to Rose, as Charles to Andrew.
  15. Mary and Caroline live on the same side of the street.
  16. Ann lives on a corner.
Who lives across from Peter?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer-aided solution | Comment 1 of 6
Taking these four clued first, as they define who lives at the two ends of the street. This reduces the set that has to be permuted to 10 from 14. I should have also done Charles at the middle of the block, but I didn't think that far ahead.

Ann lives on a corner.
Rose lives across from Ann.
Alice lives on a corner.
Andrew lives across from Alice.

and the remaining clues:

Mary lives next to a girl.                                        +
John lives diagonally across from two boys.                       +
Richard lives next to Charles.                                    +
Ann and Martha live on different sides of the street.             +
Caroline lives between two boys.                                  +
There are more boys than girls on the side where David lives.     +
Charles lives mid-block.                                          +
Paul lives across from Mary.                                      +
Martha lives diagonally across from Caroline.                     +
Richard lives across from Martha.                                 +
Louise lives as close to Rose, as Charles to Andrew.              
Mary and Caroline live on the same side of the street.            +

The clue concerning Louise was not included in the code, so that left some manual comparison among several street layouts.

%Assume Ann on NW, Rose on SW
%       Alice and Andrew at East end

girls=["Alice" "Ann" "Caroline" "Louise" "Mary" "Martha" "Rose"];
boys=["Andrew" "Charles" "David" "John" "Paul" "Peter" "Richard"];
inner=setdiff([girls boys],["Ann" "Rose" "Alice" "Andrew"]);

layouts=perms(inner);
endsets=["Ann","Alice","Rose","Andrew";"Ann","Andrew","Rose","Alice" ];
sz=[7,2];
for i=1:length(layouts)
  for ends=1:2
    layout=[endsets(ends,1) layouts(i,1:5) endsets(ends,2); ...
              endsets(ends,3) layouts(i,6:10) endsets(ends,4)];
    layout=layout';
    mary=find(layout=="Mary");
    
    if ismember(layout(mary-1),girls) || ismember(layout(mary+1),girls)
      john=find(layout=="John");
      [row,col]=ind2sub(sz,john);
      if ismember(layout(row-1,3-col),boys) && ...
          ismember(layout(row+1,3-col),boys)
        richard=find(layout=="Richard");
        charles=find(layout=="Charles");
        if abs(richard-charles)==1
          if charles==4 || charles==11
            paul=find(layout=="Paul");
            mary=find(layout=="Mary");
            if abs(paul-mary)==7
%               ann=find(layout=="Ann");
              martha=find(layout=="Martha");
              if martha>7
                caroline=find(layout=="Caroline");
                if ismember(layout(caroline-1),boys) && ...
                    ismember(layout(caroline+1),boys)
                  if abs(martha-caroline)==6 || ...
                      abs(martha-caroline)==8
                    if abs(richard-martha) ==7
                      [~,c1]=ind2sub(sz,mary);
                      [~,c2]=ind2sub(sz,caroline);
                      if c1==c2
                        david=find(layout=="David");
                        [~,side]=ind2sub(sz,david);
                        boycount=sum(ismember(layout(:,side),boys));
                        if boycount>3
       disp(layout)
       disp(' ')
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
    
  end
end

does not implement 

           Louise lives as close to Rose, as Charles to Andrew,

as that might be ambiguous depending on the width of the street,
           
and it finds the following eight layouts of the street:

    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "Louise"      "Peter" 
    "Charles"     "David" 
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "Louise"      "David" 
    "Charles"     "Peter" 
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "David"       "Peter" 
    "Charles"     "Louise"
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "David"       "Peter" 
    "Charles"     "John"  
    "Richard"     "Martha"
    "Caroline"    "Louise"
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "David"       "Louise"
    "Charles"     "Peter" 
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"      
    "Mary"        "Paul"  
    "David"       "Louise"
    "Charles"     "John"  
    "Richard"     "Martha"
    "Caroline"    "Peter" 
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Louise"      "Peter" 
    "Mary"        "Paul"  
    "Charles"     "David" 
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
    "Ann"         "Rose"  
    "Louise"      "David" 
    "Mary"        "Paul"  
    "Charles"     "Peter" 
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
Only in the third layout above does Louise and Rose's distance apart unambiguously match the distance of Charles from Andrew (3 houses away on the same side of the street):

    "Ann"         "Rose"  
    "Mary"        "Paul"  
    "David"       "Peter" 
    "Charles"     "Louise"
    "Richard"     "Martha"
    "Caroline"    "John"  
    "Andrew"      "Alice" 
    
and it's David who lives across from Peter.    

  Posted by Charlie on 2023-10-06 09:24:24
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 (0)
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