Floored

Floored

Easy

Introduction

Amara, Björn, Cora, Dale, and Emiko reside in a five-story building. Occasionally, the receptionists have trouble recalling the specific floors each person lives on. However, they should be able to deduce who lives on which floor based on the snippets of information they do remember.

Instructions

Figure out who lives on what floor based on the following information:

  1. There are five floors: 1 (bottom), 2, 3, 4 and 5 (top)
  2. Each tenant lives on a different floor
  3. Amara does not live on the top floor
  4. Björn does not live on the bottom floor
  5. Cora does not live on either the top or the bottom floor
  6. Dale lives on a higher floor than Björn
  7. Emiko does not live on a floor adjacent to Cora's
  8. Cora does not live on a floor adjacent to Björn's
Edit via GitHub The link opens in a new window or tab
Prolog Exercism

Ready to start Floored?

Sign up to Exercism to learn and master Prolog with 109 exercises, and real human mentoring, all for free.