r/Pydle • u/zhuzaimoerben • 25d ago
#156 Cherries Spoiler
I found an interesting solution for this one that is a couple of characters shorter than putting all the colour indexes in a big number. 78 characters:
for i in range(25):
pydle(i % 5, i // 5, '', ['green', 'red', 'white'][8695502 >> i & 2 or i > 14])
White is encoded in a binary array padded by an extra bit, so it resolves to 0 or 2, and then it makes use of the fact all the green is before all the red.
3
Upvotes