Your task is to create a plain hunt (a bell ringing pattern) with n bells. An example with 6 bells:
123456
214365
241635
426153
462513
645231
654321
563412
536142
351624
315264
132546
123456
Each number "bounces" off the side of the grid. From Wikipedia:
Each bell moves one position at each succeeding change, unless they reach the first or last position, when they remain there for two changes then proceed to the other end of the sequence.
In other words, you swap the bells in adjacent pairs, alternating between taking pairs starting from the the first bell and from the second bell. (Thanks to @xnor for this explanation.) You finish in the same order as the start.
This rule be applied to any number of bells, taken as input. Standard loopholes are forbidden.
Test Cases
6
123456
214365
241635
426153
462513
645231
654321
563412
536142
351624
315264
132546
123456
3
123
213
231
321
312
132
123
2
12
21
21
12
1
1
0: Falls in to "I don't care" situation.
1 ... n
or can it be in any order (e.g.2314
for n=4)? \$\endgroup\$1, 1
for the input of 1? \$\endgroup\$[1,2,3,4]
or something similar? \$\endgroup\$2n
changes for plain hunt onn
triggers me... \$\endgroup\$n=1
test case having one entry seems out of place. For all the rest, we only checking if we've returned to the start after the first change, since otherwise the first line of course equals itself and we'd stop immediately. So, that would gives[[1], [1]]
You could also consider puttingn=1
under "don't care" to avoid a potential edge case. \$\endgroup\$