Arc Forumnew | comments | leaders | submitlogin
2 points by zck 3129 days ago | link | parent

> I still need to check for reflections [if I already have (2 4 1 3), do not allow (3 1 4 2)].

There's a cool technique I read about to solve problems like this. I'll put it a few lines down in case you want to think about it yourself.

.

.

.

Sort them, then check for equality! I learned this when reading about anagrams.



3 points by jsgrahamus 3129 days ago | link

So if two results were (2 4 1 3) and (3 1 2 4), both of them sort to (1 2 3 4) so delete one of them? Of course all of the results will sort to (1 2 3 4) for a 4x4 board.

Not sure I understand.

-----

2 points by zck 3129 days ago | link

Oh, you're right. I misunderstood what you meant by "reflections".

-----