Skip to main content
added 71 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 6?, 7 bytes

Ø+pḤ;U$Ø+pḤUƬ

A niladic Link that yields this listpair of lists of pairs of integers:

[[1[[[1, 2], [1, -2], [-1, 2], [-1, -2]2]], [2[[2, 1], [-2, 1], [2, -1], [-2, -1]]1]]]

Try it online!Try it online!

How?

Ø+pḤ;U$Ø+pḤUƬ - Link: no arguments
Ø+      - literal [-1[1, -1] - set as the left argument
   Ḥ    - double -> [-2[2, -2]
  p     - ([-1[1, -1]) Cartesian product ([-2[2, -2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $Ƭ - last two linkscollect asup ainputs monadwhile -distinct, f(X=that)applying:
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

A full program printing the moves in an odd formatOriginal seven byter (six bytesnot abusing the very lose IO):

Ø+pḤṄU
Ø+pḤ;U$ - Link: no arguments
[[1,Ø+ 2],     - literal [1,-1] -2], [set as the left argument
   Ḥ    -1, 2],double [-1,> [2,-2]]2]
[[2, 1], [p     -2, 1]([1,-1]) Cartesian product ([2, -1],2]) [-2,> -1]]

A niladic Link yielding a pair of lists of pairs (six bytes):

Ø+pḤUƬ

[[[1[[1, 2], [1, -2], [-1, 2], [-1, -2]], 
 [[2, 1], [   $ -2, 1],last [2,two links as a monad -1], [f(X=that):
     U  -2,   reverse each of (X)
    ;   -1]]]   (X) concatenate (that)

Try it online!

Jelly, 6?, 7 bytes

Ø+pḤ;U$

A niladic Link that yields this list of pairs of integers:

[[1, 2], [1, -2], [-1, 2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1]]

Try it online!

How?

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [-1, 1] - set as the left argument
   Ḥ    - double -> [-2, 2]
  p     - ([-1, 1]) Cartesian product ([-2, 2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

A full program printing the moves in an odd format (six bytes):

Ø+pḤṄU

[[1, 2], [1, -2], [-1, 2], [-1, -2]]
[[2, 1], [-2, 1], [2, -1], [-2, -1]]

A niladic Link yielding a pair of lists of pairs (six bytes):

Ø+pḤUƬ

[[[1, 2], [1, -2], [-1, 2], [-1, -2]], [[2, 1], [-2, 1], [2, -1], [-2, -1]]]

Jelly, 6 bytes

Ø+pḤUƬ

A niladic Link that yields this pair of lists of pairs of integers:

[[[1, 2], [1, -2], [-1, 2], [-1, -2]], [[2, 1], [-2, 1], [2, -1], [-2, -1]]]

Try it online!

How?

Ø+pḤUƬ - Link: no arguments
Ø+     - literal [1,-1] - set as the left argument
   Ḥ   - double -> [2,-2]
  p    - ([1,-1]) Cartesian product ([2,-2]) -> [[1,2],[1,-2],[-1,2],[-1,-2]]
     Ƭ - collect up inputs while distinct, applying:
    U  -   reverse each

Original seven byter (not abusing the very lose IO):

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [1,-1] - set as the left argument
   Ḥ    - double -> [2,-2]
  p     - ([1,-1]) Cartesian product ([2,-2]) -> [[1,2],[1,-2],[-1,2],[-1,-2]] 
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

Try it online!

added 417 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 6?, 7 bytes

Ø+pḤ;U$

A niladic Link that yields athis list of pairs of integers.:

[[1, 2], [1, -2], [-1, 2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1]]

Try it online!

How?

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [-1, 1] - set as the left argument
   Ḥ    - double -> [-2, 2]
  p     - ([-1, 1]) Cartesian product ([-2, 2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

A full program printing the moves in an odd format (six bytes):

Ø+pḤṄU

[[1, 2], [1, -2], [-1, 2], [-1, -2]]
[[2, 1], [-2, 1], [2, -1], [-2, -1]]

A niladic Link yielding a pair of lists of pairs (six bytes):

Ø+pḤUƬ

[[[1, 2], [1, -2], [-1, 2], [-1, -2]], [[2, 1], [-2, 1], [2, -1], [-2, -1]]]

Jelly, 7 bytes

Ø+pḤ;U$

A niladic Link that yields a list of pairs of integers.

Try it online!

How?

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [-1, 1] - set as the left argument
   Ḥ    - double -> [-2, 2]
  p     - ([-1, 1]) Cartesian product ([-2, 2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

Jelly, 6?, 7 bytes

Ø+pḤ;U$

A niladic Link that yields this list of pairs of integers:

[[1, 2], [1, -2], [-1, 2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1]]

Try it online!

How?

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [-1, 1] - set as the left argument
   Ḥ    - double -> [-2, 2]
  p     - ([-1, 1]) Cartesian product ([-2, 2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)

A full program printing the moves in an odd format (six bytes):

Ø+pḤṄU

[[1, 2], [1, -2], [-1, 2], [-1, -2]]
[[2, 1], [-2, 1], [2, -1], [-2, -1]]

A niladic Link yielding a pair of lists of pairs (six bytes):

Ø+pḤUƬ

[[[1, 2], [1, -2], [-1, 2], [-1, -2]], [[2, 1], [-2, 1], [2, -1], [-2, -1]]]
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 7 bytes

Ø+pḤ;U$

A niladic Link that yields a list of pairs of integers.

Try it online!

How?

Ø+pḤ;U$ - Link: no arguments
Ø+      - literal [-1, 1] - set as the left argument
   Ḥ    - double -> [-2, 2]
  p     - ([-1, 1]) Cartesian product ([-2, 2]) -> [[1, 2], [1, -2], [-1, 2], [-1, -2]]
      $ - last two links as a monad - f(X=that):
     U  -   reverse each of (X)
    ;   -   (X) concatenate (that)