Merge branch 'master' of ygdrassil:/mnt/data/git/master
[master.git] / ar / assignments / 4.py
1
2 if __name__ == '__main__':
3 frontier = [(0, [], range(1, 8))]
4 oldlen = 0
5 iterations = 0
6
7 while frontier:
8 it, moves, a = frontier.pop(0)
9 iterations += 1
10
11 if len(moves) > oldlen:
12 oldlen = len(moves)
13 print oldlen
14 h50 = [x for x in a if x > 50 and a.count(x) > 1]
15 if h50:
16 break
17 for i in range(1, len(a)-1):
18 aa = a[:]
19 aa[i] = a[i-1]+a[i+1]
20 moves2 = moves[:]
21 frontier.append((it+1, moves2 + [i], aa))
22
23 print it, iterations, moves, a