Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 17 lines (12 sloc) 0.471 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import itertools


floors = range(5)
b, c, f, m, s = range(5)
fletcher_range = range(1, 4)

def valid(arrangement):
    return (arrangement[b] != 4 and
            arrangement[c] != 0 and
            arrangement[f] in fletcher_range and
            arrangement[m] > arrangement[c] and
            abs(arrangement[s] - arrangement[f]) > 1 and
            abs(arrangement[c] - arrangement[f]) > 1)

assert filter(valid, itertools.permutations(floors)) == [(2, 1, 3, 4, 0)]
Something went wrong with that request. Please try again.