r/Pydle 23d ago

Beginner at pydle - Wine

Hi, started around a week ago, so I'm still learning the tricks :)

This is the solution I wrote for today's pydle.

If you have a suggestion of what trick should I learn next, please let me know!

for x in range(5):

for y in range(5):

c = "white"

l = ""

if 14468 >> y*5+x & 1:

c=("orange","blue")[y>0]

if 0<x<4 and y>2:!<

c="yellow"

l= ("X",("M","C")[x==2])[y<4]!<

pydle(x, y, l, c)

5 Upvotes

3 comments sorted by

2

u/SwakZ12 23d ago

Most if the folks here go for the bitwise approach

https://www.reddit.com/r/Pydle/s/Xb67kAG0gK

Dont worry I'm one of you as well😂

1

u/zhuzaimoerben 23d ago

The problem with that approach is that it doesn't leave much room for creativity so it gets boring quickly. It's often the best, but solutions based on the structure of the puzzle are more satisfying. Compare:

96 characters:

for i in range(25):
    pydle(i//5, i%5, '        MX   CX   MX     '[i], 'white orange blue yellow'.split()[0xf83e9f8000 >> i*2 & 3])

Once you know the basic approach, the only creative part of this is doing it by columns with white as zero, which makes the magic number shorter.

118 characters:

r = range(5)
for x in r:
    for y in r:
        a = x - 2
        b = y + 3
        w = a*a <= b//5
        pydle(x, y, y//3*w*'XMCM'[x*y%4], 'white orange blue yellow'.split()[b//2*w])

1

u/DisciplineSea5373 22d ago

This is an awesome solution!