# Timeline for Permutations of the Fifteen Puzzle

### Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
May 28 '15 at 6:28 history edited
May 27 '15 at 23:22 comment @Dennis Right, for some reason I tested it in Python 3.
May 27 '15 at 21:39 comment @randomra: As far as I know, *l,=t works only in Python 3, which would require int() around input() and () around len(S). l=list(t) works and improves readability immensely, but it doesn't save bytes.
May 27 '15 at 14:28 history edited
May 27 '15 at 7:51 comment Converting to list, swapping and converting back to tuple is a little shorter: def e(a,b):*l,=t;l[a],l[b]=l[b],l[a];s.add(tuple(l)).
May 27 '15 at 7:41 comment @randomra Sounds good, I'll try that tomorrow. I thought there was probably some clever way of using conditional expressions instead of the series of if statements. I also wonder if there's a shorter way of building a tuple with two elements swapped.
May 27 '15 at 7:00 comment You can convert the if statements into short-circuiting expressions with side effect like j%4and e(j-1,j) so you can put them into one line as a boolean tuple: j%4and e(j-1,j),j%4>2or e(j,j+1),j<4or e(j-4,j),j>11or e(j,j+4).
May 27 '15 at 6:33 comment @isaacg I saved quite a bit by moving the similar code into a function. Looking at this now, I probably don't have to pass t as an argument. Other than that, I figure there's most likely more room for improvement if I had better Python skills.
May 27 '15 at 6:07 comment Aliasing s.add would probably save some characters.