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

Show parent comments

14

u/JonIsPatented Apr 10 '23

If it's just a search through a little if-else block each move, then it's linear time complexity, as well! Fastest (yet most impossible) chess AI, perhaps?

1

u/evasive_dendrite Apr 10 '23

Linear is awful for possible moves. AI chess solutions just use neural networks these days in combination with a limited search.

1

u/JonIsPatented Apr 10 '23

If the AI was simply a preprogrammed response to each possible board state, it wouldn't need to do any work at all to calculate. When the player enters a move, it's at most 139 if-else branches (the highest possible number of available moves in a chess position) to determine how to move the white piece, and the black movement would be preprogrammed as part of that method. That's even faster than linear time. Constant time, perhaps.

0

u/evasive_dendrite Apr 10 '23

That's true, but also utterly impossible to implement.

0

u/JonIsPatented Apr 11 '23

Yeah, of course. That's what this whole conversation was about, though.