That code runs fine but man, that init() function is gonna spike your cpu. Do NOT look at the cpu temp while it runs. You’ll probably get a floating point overflow in the worst way.
And it runs for like 300,000 years before it produces visible results.
This is a cool way to visualise why it's not possible to 'solve' chess by brute force. Say you wanted to build a lookup table for the best move in any given position. Even if you could find a way to encode a position onto a single atom, there are insufficient atoms in the universe to store all the positions in chess.
Moore's law cant save you, because there's not enough matter in the universe to build a big enough hard drive.
Even if you could find a way to encode a position onto a single atom, there are insufficient atoms in the universe to store all the positions in chess.
I envision it as more encoding 32 qbits via user input and outputting a wave interference that maps out the solution, instead of w.e horror show this will be.
Qbits aren't 1 or 0, they're a superposition of every possible state. So one qbit is [0,1]. Two qbits make four positions [0,0; 0,1; 1,0; 1:1]. The superposition states are 2n where n is the number of qbits.
Getting the solution involves setting up the inputs such that the output is essentially the most likely result. The qbits are allowed to fall out of the superposition and end up as either 0 or 1, in the order that gives you (probably) the correct result.
The comment suggests building a quantum computer with 32 entangled qbits for 232 possible states and the output is probably the best move.
There are ways to make it smaller, for example you can take out board positions that are horizontal mirror images of another position, which cuts our storage in half.
Also you could only store white positions, since there's an equivalent black position for each, which cuts it in half again
Hard to think of more ways, but you could cut out positions that would only occur if both players play ridiculously unoptimally (for example positions where each player promotes several pawns)
Edit: Its probably still too large, but these are some good techniques. They have actually used the first two to solve all endgame positions up to like 6 pieces
Look, yes the 2800 rated players who all frequent r/AnarchyChess can use bishops well, but handicapping yourself and playing suboptimal isn't something we want nor expect players to actually do.
If you want to know a better way to play when you don't handicap yourself using bishops, just Google en passant.
Nice! A few more optimizations like that, and you may be able to get the number of positions you need from a billion billion billion times the number of atoms in the universe, all the way down to a billion billion million times the number of atoms in the universe!
Well, in theory there are likely enough atoms for that because there are a ton of "irrelevant" positions - of course, it's difficult to tell which positions are irrelevant or not before you've already solved it, but once it is solved there's no need to consider positions that would never occur because playing in a way that results in those positions would always be suboptimal play (even when you make no assumptions of what the opponent is doing), or one player is far enough ahead that they have many winning options and they can disregard the ones that create new board states because they'll win either way so they may as well reuse the one that's already solved instead of creating a new one.
I had to listen multiple times, I kept thinking he was saying 10^18 atoms in the universe, which is obviously wrong. (He says 10 to the 80, which is correct)
586
u/FuerstAgus50 Apr 10 '23 edited Apr 10 '23
more than atoms in the universe
https://www.youtube.com/watch?v=Km024eldY1A