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 Reto Koradi CC BY-SA 3.0
added 443 characters in body
May 27 '15 at 23:22 comment added randomra @Dennis Right, for some reason I tested it in Python 3.
May 27 '15 at 21:39 comment added Dennis @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 Alex A. CC BY-SA 3.0
Formatted header per our unwritten standard, added syntax highlighting
May 27 '15 at 7:51 comment added randomra 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 added Reto Koradi @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 added randomra 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:40 history edited Reto Koradi CC BY-SA 3.0
added 1 character in body
May 27 '15 at 6:33 comment added Reto Koradi @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:26 history edited Reto Koradi CC BY-SA 3.0
deleted 135 characters in body
May 27 '15 at 6:07 comment added isaacg Aliasing s.add would probably save some characters.
May 27 '15 at 5:50 history answered Reto Koradi CC BY-SA 3.0