| Bytes | Lang | Time | Link |
|---|---|---|---|
| nan | Vyxal M | 240906T124643Z | pacman25 |
| 119 | Python 3 | 240104T191423Z | Jonathan |
| 234 | Python 3.8 prerelease | 240104T140547Z | Gáb |
| 018 | Jelly | 231230T004016Z | Nick Ken |
| 114 | R | 231230T232954Z | Nick Ken |
| 154 | Haskell | 231230T105858Z | matteo_c |
| 057 | Charcoal | 231230T014256Z | Neil |
| 097 | Retina 0.8.2 | 231230T012544Z | Neil |
Vyxal M, 143 bitsv2, 17.875 bytes
502fʀΠvṖÞfUµ₍G≬GḟN;Ṙ
Bitstring:
01001100010111011101100111110101010001010111110111001010000001010001111111000110110110011111110101010001101001110000010110110000011010100111111
Python 3, 119 bytes
t=(0,1,2)
print(*{(*(x*(i==j)+y*(i==k)for i in t),):0for x in(5,4,3,2,1,0)for j in t for y in(2,1,0)for k in t if j-k})
A full program that takes no input and prints the ordered upgrade paths as Python tuples with a space separator.
How?
Go through from a "big choice" of five through to zero placing this digit left-right, placing a "small choice" of two through to zero in each of the other positions in turn, each time placing a zero in the remaining position, then deduplicate the results while maintaining order.
t=(0,1,2) # create "indices" tuple t = (0,1,2)
for x in(5,4,3,2,1,0) # for "big choice" x=5..0
for j in t # for index j (where we want to try to place x)
for y in(2,1,0) # for "small choice" y=2..0
for k in t # for index k (where we want to try to place y)
if j-k # if these indices differ
for i in t # go through the indices, i
x*(i==j)+y*(i==k) # and assign a value (x, y or 0)
( ) # each triple (across i) as a generator
(* ,) # ...splat to a tuple
{ :0 ...} # ...as the keys of a dictionary (to deduplicate keys)
print(* ) # ...splat to print function
Perhaps the print(*{...}) could be print({...}) it will then print the dict representation, which is in order of its keys (the upgrade path triples), but will also show the dummy values : 0 along with each key.
Python 3.8 (pre-release), 234 bytes
from itertools import*
s,r=sorted,range;[print('-'.join(map(str,p)))for p in s(set(chain.from_iterable(permutations(list(x)+[0])for x in s(product(r(6),r(3))))),key=lambda x:(max(x),-x.index(max(x)),sum(x),x,-x.index(s(x)[1])))[::-1]]
Jelly, 18 bytes
6p3’Ż€Œ!€ẎQMNṭṀƲÞṚ
A niladic link taking no arguments and returning a list of triples.
Explanation
6p3 | Cartesian product of 1..6 and 1..3
’ | Subtract 1
Ż€ | Prefix each with zero
Œ!€ | Permutations of each
Ẏ | Join outer lists
Q | Uniquify
MNṭṀƲÞ | Sort by negated maximal indices tagged onto maximum
Ṛ | Reverse
R, 114 bytes
r=rowSums
a=apply
(b=(x=expand.grid(0:5,0:5,0:5))[r(x>2)<2&r(x>0)<3,])[order(-a(b,1,max),a(b,1,which.max),-r(b)),]
A full program that prints a data frame with the relevant triples in rows. It also prints some redundant row and column names - hopefully that’s permissible.
The footer verifies that the data frame is correct when compared to the canonical answer.
Haskell, 154 bytes
import Data.List
x=unlines[intersperse '-'s|s<-reverse$sortOn(\x->(maximum$zip x[1,0..],sort x))$mapM id$['0'..'5']<$[1..3],elem '0's,sum[1|x<-s,x>'2']<2]
Charcoal, 57 bytes
≔EΦEφ﹪%03dι∧№ι0∧›6⌈ι›²ΣEι‹2λ⟦⌈ι±⌕ι⌈ι⁻ΣιΣ⌈ιι⟧θW⁻θυ⊞υ⌈ιEυ⊟ι
Try it online! Link is to verbose version of code. Explanation: Based on my answer to the linked question.
≔EΦEφ﹪%03dι∧№ι0∧›6⌈ι›²ΣEι‹2λ⟦⌈ι±⌕ι⌈ι⁻ΣιΣ⌈ιι⟧θ
Generate all the valid triples, but then create a sort key of the maximum digit, the negated index of that digit in the triple, the other non-zero digit if any, and the triple.
W⁻θυ⊞υ⌈ι
Sort the triples in descending order by the keys.
Eυ⊟ι
Output just the triples. (This could be Eυ⪫⊟ι- to prettify the output at a cost of 2 bytes.)
Retina 0.8.2, 97 bytes
520$*¶
00$.`
.*(...)
$1,$1
%O^`\G\d
(.)(..,.*?\1(.)*)
$1$#3$2
O^`
.+,
G`0
A`[3-5].*[3-5]|[6-9]
Try it online! Link includes footer that prettifies the output. Explanation: Based on my answer to the linked question.
520$*¶
00$.`
.*(...)
$1,$1
List all the integers from 0 to 520 inclusive, padded to 3 digits, with each integer duplicated, the duplicates separated with a comma.
%O^`\G\d
Sort the first duplicate of each integer in descending order of digit.
(.)(..,.*?\1(.)*)
$1$#3$2
For each integer, after the largest digit in the sorted digits, insert another digit that is the number of digits appearing after the first occurrence of that digit in the original integer.
O^`
Sort the integers in reverse by this sort key.
.+,
Delete the sort key.
G`0
Only keep those integers with at least one 0 digit.
A`[3-5].*[3-5]|[6-9]
Discard those with more than one digit greater than 2 or with a digit greater than 5.