Setup

  • Names: Charles, Freya, Michelle, Rachel, Stephanie, Tristan
  • RRR, O?, Y, GGG, B, P
  • Apples x5, Kiwis x7, Oranges x3, Pumpkins x6, Strawberries x1, Tomatoes x2

On the subject of Houses

F (G), C (Y), R (B), S (O), T (R), M (P)

  1. x Both Freya and Tristan live next to Charles.
  2. x Charles has a yellow house.
  3. x Houses painted with complementary colors aren't neighbors.
  4. x Rachel lives as far away as possible from Stephanie.
  5. x Rachel's color mixed with Charles' color gives Freya's color.
  6. x Stephanie's house color is not blue.
  7. x The green house is next to Michelle's house, which she just painted purple.
  8. x The person in the blue house can see Charles' house to the right of Freya's.
  9. x There is one house of each color, and exactly one person lives in each house.
  10. x Tristan lives in the red house.

On the subject of Fruit

  1. x Freya has 3 oranges.
  2. If A's color mixed with B's color gives C's color, then the number of fruits that C has is equal to the number of fruits that A and B have together.
  3. Rachel has the fewest number of fruit, which are strawberries.
  4. The red house grows apples. There are fewer apples than kiwis.
  5. There are 24 fruits in all.
  6. There are double the number of pumpkins as oranges.
  7. x Tomatoes are a fruit.

On the subject of Roses

RYGPGRRGBP

  1. Exactly one green rose doesn't touch any red roses.
  2. x From left to right, these roses appear in this order, but not necessarily consecutively: Yellow, Green, Green, Blue, Purple.
  3. x One color of rose does not appear at all.
  4. x Red and green are the most common roses, and appear 3 times each.
  5. Red roses never border blue or purple roses.
  6. The roses in the middle of the left and right halves are both green.
  7. x The sequence Green, Red, Red, Green appears somewhere in the row of roses.
  8. There is one purple rose in the left half and one blue rose in the right half.

Solution

  • R Tristan T
  • Y Charles H
  • G Freya E
  • P Michelle L
  • G Freya E
  • R Tristan T
  • R Tristan T
  • G Freya E
  • B Rachel R
  • P Michelle L

In [14]:
import forge
from puzzle.puzzlepedia import puzzlepedia

# On the subject of Fruit.
puzzle = puzzlepedia.parse("""
A = variable(1, 20, 'A')
K = variable(1, 20, 'K')
O = variable(3, 4, 'O')
P = variable(1, 20, 'P')
S = variable(1, 20, 'S')
T = variable(1, 20, 'T')
x = variable(1, 20, 'x')
y = variable(1, 20, 'y')
z = variable(1, 20, 'z')

# x Freya has 3 oranges.
O == 3

# If A's color mixed with B's color gives C's color, then the number of fruits that C has is equal to the number of fruits that A and B have together.
S + x == 3
A + x == y
A + S == z
S < O
for free in [x, y, z]:
  free == K or free == P or free == T

# x Rachel has the fewest number of fruit, which are strawberries.
all(S < f for f in [A, K, O, P, T])

# x The red house grows apples. There are fewer apples than kiwis.
A < K

# x There are 24 fruits in all.
A + K + O + P + S + T == 24

# x There are double the number of pumpkins as oranges.
P == O * 2

# x Tomatoes are a fruit.

""".lower())

In [1]:
import forge
from puzzle.puzzlepedia import puzzlepedia


puzzle = puzzlepedia.parse("""
459601727585320977851323670
""")

In [ ]: