\ Untitled - /g/pasta 2.4
From Capacious Marmoset, 4 Years ago, written in Python.
Embed
  1. from itertools import permutations as perm
  2.  
  3. for country in perm('ESUNJ'):
  4.   if country[0] != 'N':
  5.     continue
  6.   for color in perm('RGIYB'):
  7.     if color[country.index('E')] != 'R':
  8.       continue
  9.     if color.index('G') != color.index('I') + 1:
  10.       continue
  11.     if abs(country.index('N') - color.index('B')) != 1:
  12.       continue
  13.     for pet in perm('DSFHZ'):
  14.       if pet[country.index('S')] != 'D':
  15.         continue
  16.       for beverage in perm('CTMOW'):
  17.         if beverage[color.index('G')] != 'C':
  18.           continue
  19.         if beverage[country.index('U')] != 'T':
  20.           continue
  21.         if beverage[2] != 'M':
  22.           continue
  23.         for cigarettes in perm('OKCLP'):
  24.           if pet[cigarettes.index('O')] != 'S':
  25.             continue
  26.           if cigarettes[color.index('Y')] != 'K':
  27.             continue
  28.           if abs(cigarettes.index('C') - pet.index('F')) != 1:
  29.             continue
  30.           if abs(cigarettes.index('K') - pet.index('H')) != 1:
  31.             continue
  32.           if beverage[cigarettes.index('L')] != 'O':
  33.             continue
  34.           if cigarettes[country.index('J')] != 'P':
  35.             continue
  36.           print('country   ', country)
  37.           print('color     ', color)
  38.           print('pet       ', pet)
  39.           print('beverage  ', beverage)
  40.           print('cigarettes', cigarettes)
  41.