r/ProgrammerHumor • • Apr 10 '23

Meme god why is coding chess so hard

Post image
67.4k Upvotes

1.8k comments sorted by

View all comments

6

u/mikeyj777 Apr 10 '23 edited Apr 11 '23

From the responses, I'm imagining there's an easier way

Edit: Just stating the obvious that I was joking. Given the responses, it may not have come across.

14

u/Talking_Burger Apr 10 '23

This is probably the hardest way possible

7

u/Alevo Apr 10 '23 edited Apr 10 '23

When I made a chess game in uni I used mostly maths to decide where the pieces could move.

King: difference in x + difference in y = 1 or 2 Knight: sqrt(difference in x)2 + sqrt(difference in y)2 = 3

Etc.

3

u/Rhaedas Apr 10 '23

Sebastian did a video on how to start the approach. Better ones are going to go beyond simple programming and use neural nets or other similar recursive training, but this video shows how using pruning you can break down the impossible the OP meme is to a manageable task, as long as you don't have it go too deep in the search levels. It's also fun because he (deliberately or not) makes a few mistakes or overlooks as he goes, just like anyone programming something would do.

1

u/zzorga Apr 10 '23

It's both technically possible, but also literally impossible.

1

u/JacobMT05 Apr 11 '23

I’d guess it’s a) not doing it in python, b) click selecting, c) drag and dropping, like every other online chess app.