Created
June 29, 2014 02:56
-
-
Save amitjamadagni/425403bfed493e6ea577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sage: q = {1: [[18, 4, 19, 3], [17, 4, 18, 5]], 2: [[1, 9, 2, 8], [9, 3, 10, 2], [5, 13, 6, 12], [13, 7, 14, 6], [22, 7, 1, 8], [19, 11, 20, 10], [16, 11, 17, 12], [18, 4, 19, 3], [17, 4, 18, 5]], 3: [[1, 9, 2, 8], [9, 3, 10, 2], [5, 13, 6, 12], [13, 7, 14, 6], [22, 7, 1, 8], [19, 11, 20, 10], [16, 11, 17, 12], [21, 14, 22, 15], [20, 16, 21, 15]], 4: [[21, 14, 22, 15], [20, 16, 21, 15]]} | |
sage: t = {1: ['-', '+'], 2: ['-', '-', '-', '-', '+', '-', '+', '-', '+'], 3: ['-', '-', '-', '-', '+', '-', '+', '+', '-'], 4: ['+', '-']} | |
sage: for i in q.iterkeys(): | |
for j in range(len(q[i])): | |
if t[i][j] == "-": | |
del q[i][j][3] | |
del q[i][j][0] | |
elif t[i][j] == "+": | |
del q[i][j][1] | |
del q[i][j][0] | |
....: | |
sage: q | |
{1: [[4, 19], [18, 5]], | |
2: [[9, 2], | |
[3, 10], | |
[13, 6], | |
[7, 14], | |
[1, 8], | |
[11, 20], | |
[17, 12], | |
[4, 19], | |
[18, 5]], | |
3: [[9, 2], | |
[3, 10], | |
[13, 6], | |
[7, 14], | |
[1, 8], | |
[11, 20], | |
[17, 12], | |
[22, 15], | |
[16, 21]], | |
4: [[22, 15], [16, 21]]} | |
sage: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment