"""
UNIT 2: Logic Puzzle

You will write code to solve the following logic puzzle:

1. The person who arrived on Wednesday bought the laptop.
2. The programmer is not Wilkes.
3. Of the programmer and the person who bought the droid,
   one is Wilkes and the other is Hamming. 
4. The writer is not Minsky.
5. Neither Knuth nor the person who bought the tablet is the manager.
6. Knuth arrived the day after Simon.
7. The person who arrived on Thursday is not the designer.
8. The person who arrived on Friday didn't buy the tablet.
9. The designer didn't buy the droid.
10. Knuth arrived the day after the manager.
11. Of the person who bought the laptop and Wilkes,
    one arrived on Monday and the other is the writer.
12. Either the person who bought the iphone or the person who bought the tablet
    arrived on Tuesday.

You will write the function logic_puzzle(), which should return a list of the
names of the people in the order in which they arrive. For example, if they
happen to arrive in alphabetical order, Hamming on Monday, Knuth on Tuesday, etc.,
then you would return:

['Hamming', 'Knuth', 'Minsky', 'Simon', 'Wilkes']

(You can assume that the days mentioned are all in the same week.)
"""

import itertools

def day_after(first, second):
    return first - 1 == second

def logic_puzzle():
    days = [ monday, tuesday, wednesday, thursday, friday ] = [ 0, 1, 2, 3, 4 ]
    orderings = list(itertools.permutations(days))
    people = ('Wilkes', 'Minsky', 'Hamming', 'Knuth', 'Simon')

    order = next((Wilkes, Minsky, Hamming, Knuth, Simon)

        for (laptop, droid, tablet, iphone, _) in orderings
        for (Wilkes, Minsky, Hamming, Knuth, Simon) in orderings
        for (programmer, writer, manager, designer, _) in orderings

        if wednesday == laptop
        if programmer != Wilkes
        if (programmer == Wilkes and droid == Hamming) or (programmer == Hamming and Wilkes == droid)
        if writer != Minsky
        if tablet != manager and Knuth != manager
        if thursday != designer
        if designer != droid
        if friday != tablet
        if day_after(Knuth, manager)
        if day_after(Knuth, Simon)
        if (Wilkes == monday and laptop == writer) or (laptop == monday and Wilkes == writer)
        if iphone == tuesday or tablet == tuesday
        )

    result = []
    print order
    for pers in range(5):
        

    return result


print logic_puzzle()
result.append(people[order[pers]])