3ṗ4o@U,ZƊṙ2=ḢʋƝ€€ȦʋƇ8... - Link: Board
3ṗ4 - {implict range 3 = [1,2,3]} Cartesian power 4
-> allAll tilesTiles including unavailable ones like [1,2,3,3]
with all of their uniquely identifiable rotations
8 - chain's left argument -> Board
Ƈ - filter {allAll tilesTiles} keeping those for which:
ʋ - last four links as a dyad - f(Potential Tile, Board):
o@ - {Board} logical OR (vectorising) {Potential Tile}
-> Board with Potential Tile inserted
U,ZƊ - reveredreverse all the tiles and pair with transpose
(allows same logic for both E-W and S-N checks)
€ - for each of these two:
€ - for each row:
Ɲ - for neighboring pairs of tiles:
ʋ - last four links as a dyad - f(L, R):
ṙ2 - rotate {L} left two
= - {that} equals (vectorising) {R}
Ḣ - head -> relevant comparison
Ȧ - any an all? (0 if any comparison was falsey)
-> all rotations of all tiles that fit
(including the unavailable ones)
...ṙJṂƊ€Qḟ"[^go{~Ẉ‘b4¤ - ...continued:
€ - for each found tile:
Ɗ - last three links as a monad - f(T=rotated tile):
J - range of length {T} -> [1,2,3,4]
ṙ - {T} rotate left (vectorised) {[1,2,3,4]}
Ṃ - minimum -> lexicographically minimal rotation
Q - deduplicate -> Found Tiles (in their minimal rotation)
¤ - nilad followed by link(s) as a nilad:
"[^go{~Ẉ‘ - code-page indices -> [91,94,103,111,123,126,187]
b4 - to base four
-> Unavailable Tiles (in their minimal rotation) = [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,3,2,3]]
ḟ - {Found Tiles} filter discard {Unavailable Tiles}
3ṗ4o@U,ZƊṙ2=ḢʋƝ€€ȦʋƇ8... - Link: Board
3ṗ4 - {implict range 3 = [1,2,3]} Cartesian power 4
-> all tiles including unavailable ones like [1,2,3,3]
with all of their uniquely identifiable rotations
8 - chain's left argument -> Board
Ƈ - filter {all tiles} keeping those for which:
ʋ - last four links as a dyad - f(Potential Tile, Board):
o@ - {Board} logical OR (vectorising) {Potential Tile}
-> Board with Potential Tile inserted
U,ZƊ - revered all the tiles and pair with transpose
(allows same logic for both E-W and S-N checks)
€ - for each of these two:
€ - for each row:
Ɲ - for neighboring pairs of tiles:
ʋ - last four links as a dyad - f(L, R):
ṙ2 - rotate {L} left two
= - {that} equals (vectorising) {R}
Ḣ - head -> relevant comparison
Ȧ - any an all? (0 if any comparison was falsey)
-> all rotations of all tiles that fit
(including the unavailable ones)
...ṙJṂƊ€Qḟ"[^go{~Ẉ‘b4¤ - ...continued:
€ - for each found tile:
Ɗ - last three links as a monad - f(T=rotated tile):
J - range of length {T} -> [1,2,3,4]
ṙ - {T} rotate left (vectorised) {[1,2,3,4]}
Ṃ - minimum -> lexicographically minimal rotation
Q - deduplicate -> Found Tiles (in their minimal rotation)
¤ - nilad followed by link(s) as a nilad:
"[^go{~Ẉ‘ - code-page indices -> [91,94,103,111,123,126,187]
b4 - to base four
-> Unavailable Tiles (in their minimal rotation) = [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,3,2,3]]
ḟ - {Found Tiles} filter discard {Unavailable Tiles}
3ṗ4o@U,ZƊṙ2=ḢʋƝ€€ȦʋƇ8... - Link: Board
3ṗ4 - {implict range 3 = [1,2,3]} Cartesian power 4
-> All Tiles including unavailable ones like [1,2,3,3]
with all of their uniquely identifiable rotations
8 - chain's left argument -> Board
Ƈ - filter {All Tiles} keeping those for which:
ʋ - last four links as a dyad - f(Potential Tile, Board):
o@ - {Board} logical OR (vectorising) {Potential Tile}
-> Board with Potential Tile inserted
U,ZƊ - reverse all the tiles and pair with transpose
(allows same logic for both E-W and S-N checks)
€ - for each of these two:
€ - for each row:
Ɲ - for neighboring pairs of tiles:
ʋ - last four links as a dyad - f(L, R):
ṙ2 - rotate {L} left two
= - {that} equals (vectorising) {R}
Ḣ - head -> relevant comparison
Ȧ - any an all? (0 if any comparison was falsey)
-> all rotations of all tiles that fit
(including the unavailable ones)
...ṙJṂƊ€Qḟ"[^go{~Ẉ‘b4¤ - ...continued:
€ - for each found tile:
Ɗ - last three links as a monad - f(T=rotated tile):
J - range of length {T} -> [1,2,3,4]
ṙ - {T} rotate left (vectorised) {[1,2,3,4]}
Ṃ - minimum -> lexicographically minimal rotation
Q - deduplicate -> Found Tiles (in their minimal rotation)
¤ - nilad followed by link(s) as a nilad:
"[^go{~Ẉ‘ - code-page indices -> [91,94,103,111,123,126,187]
b4 - to base four
-> Unavailable Tiles (in their minimal rotation) = [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,3,2,3]]
ḟ - {Found Tiles} filter discard {Unavailable Tiles}
(39 if we may output each tile as many times as it will fit up to rotational symmetry - remove Q)
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographicallylexicographical (e.g. if [3,2,2,1] fits in any orientation(s) it would be given (once) as [1,3,2,2])
There are \17ドル\$ available tiles out of \24ドル\$ possible tiles (up to rotational symmetry), so we find all possible tiles that could fit in any rotation, rotate each of them to their lexicographically minimum and then filter out the \7ドル\$ unavailable tiles.
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographically (e.g. if [3,2,2,1] fits in any orientation(s) it would be given (once) as [1,3,2,2])
(39 if we may output each tile as many times as it will fit up to rotational symmetry - remove Q)
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographical (e.g. if [3,2,2,1] fits in any orientation(s) it would be given (once) as [1,3,2,2])
There are \17ドル\$ available tiles out of \24ドル\$ possible tiles (up to rotational symmetry), so we find all possible tiles that could fit in any rotation, rotate each of them to their lexicographically minimum and then filter out the \7ドル\$ unavailable tiles.
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographically (e.g. if [3,2,2,1] fits in any orientation(s) it would be given (once) as [1,3,2,2])
How?
3ṗ4o@U,ZƊṙ2=ḢʋƝ€€ȦʋƇ8... - Link: Board
3ṗ4 - {implict range 3 = [1,2,3]} Cartesian power 4
-> all tiles including unavailable ones like [1,2,3,3]
with all of their uniquely identifiable rotations
8 - chain's left argument -> Board
Ƈ - filter {all tiles} keeping those for which:
ʋ - last four links as a dyad - f(Potential Tile, Board):
o@ - {Board} logical OR (vectorising) {Potential Tile}
-> Board with Potential Tile inserted
U,ZƊ - revered all the tiles and pair with transpose
(allows same logic for both E-W and S-N checks)
€ - for each of these two:
€ - for each row:
Ɲ - for neighboring pairs of tiles:
ʋ - last four links as a dyad - f(L, R):
ṙ2 - rotate {L} left two
= - {that} equals (vectorising) {R}
Ḣ - head -> relevant comparison
Ȧ - any an all? (0 if any comparison was falsey)
-> all rotations of all tiles that fit
(including the unavailable ones)
...ṙJṂƊ€Qḟ"[^go{~Ẉ‘b4¤ - ...continued:
€ - for each found tile:
Ɗ - last three links as a monad - f(T=rotated tile):
J - range of length {T} -> [1,2,3,4]
ṙ - {T} rotate left (vectorised) {[1,2,3,4]}
Ṃ - minimum -> lexicographically minimal rotation
Q - deduplicate -> Found Tiles (in their minimal rotation)
¤ - nilad followed by link(s) as a nilad:
"[^go{~Ẉ‘ - code-page indices -> [91,94,103,111,123,126,187]
b4 - to base four
-> Unavailable Tiles (in their minimal rotation) = [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,3,2,3]]
ḟ - {Found Tiles} filter discard {Unavailable Tiles}
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographically (e.g. if [3,2,2,1] fits in any orientation it would be given as [1,3,2,2])
The outputted tiles are provided rotated such that their representation is the smallest it can be lexicographically (e.g. if [3,2,2,1] fits in any orientation(s) it would be given (once) as [1,3,2,2])
How?
3ṗ4o@U,ZƊṙ2=ḢʋƝ€€ȦʋƇ8... - Link: Board
3ṗ4 - {implict range 3 = [1,2,3]} Cartesian power 4
-> all tiles including unavailable ones like [1,2,3,3]
with all of their uniquely identifiable rotations
8 - chain's left argument -> Board
Ƈ - filter {all tiles} keeping those for which:
ʋ - last four links as a dyad - f(Potential Tile, Board):
o@ - {Board} logical OR (vectorising) {Potential Tile}
-> Board with Potential Tile inserted
U,ZƊ - revered all the tiles and pair with transpose
(allows same logic for both E-W and S-N checks)
€ - for each of these two:
€ - for each row:
Ɲ - for neighboring pairs of tiles:
ʋ - last four links as a dyad - f(L, R):
ṙ2 - rotate {L} left two
= - {that} equals (vectorising) {R}
Ḣ - head -> relevant comparison
Ȧ - any an all? (0 if any comparison was falsey)
-> all rotations of all tiles that fit
(including the unavailable ones)
...ṙJṂƊ€Qḟ"[^go{~Ẉ‘b4¤ - ...continued:
€ - for each found tile:
Ɗ - last three links as a monad - f(T=rotated tile):
J - range of length {T} -> [1,2,3,4]
ṙ - {T} rotate left (vectorised) {[1,2,3,4]}
Ṃ - minimum -> lexicographically minimal rotation
Q - deduplicate -> Found Tiles (in their minimal rotation)
¤ - nilad followed by link(s) as a nilad:
"[^go{~Ẉ‘ - code-page indices -> [91,94,103,111,123,126,187]
b4 - to base four
-> Unavailable Tiles (in their minimal rotation) = [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,3,2,3]]
ḟ - {Found Tiles} filter discard {Unavailable Tiles}