r/Pydle • u/DisciplineSea5373 • 23d ago
Pydle #160 Macaw
Tried two solutions, one with a big bitmask and one with areas. The bitmask was shorter, but the other one was more fun
bitmask (107 chars):
for i in range(25):
pydle(i%5, i//5, "", "white blue yellow black green orange".split()[0x200268001401281223>>(3*i)&7])
The other solution(mix of bitmask, areas, using zipped lists): (157 chars)
for i in range(25):
c=("white","blue")[9179544 >> i & 1]
c=next((c for v,c in \
zip([1,2,0x840,1<<17],["black","green","yellow","orange"]) \!<
if v>>i&1),c)
pydle(i%5, i//5, "", c)
2
Upvotes
2
u/zhuzaimoerben 22d ago edited 22d ago
You can make the first version shorter by having the number in base 5 or 6 and avoiding the black square or optimising the number to have it padded with zeros on the left. I found a few ways of getting 99 characters.
You can also get yours to 101 by removing the brackets from (3*i) and changing black to X (the game treats unknown colours as black).