Is it impossible/possible to derive a formula or sets of formulas that lead to winning chess games?

TuckerTommy
Is it impossible/possible to derive a formula or sets of formulas that lead to winning chess games...maybe not even now but perhaps in the future? I just have this feeling that mathematically it’s possible.
hitthepin
Mathmatically, yes.
TuckerTommy
Well, you figure there are 64 squares, constant set of pieces....there’s gat to be a formula for every position to capture within 1- x number of moves....it can be derived....may be pretty long...and finally one to calculate mathematilly when mate is 1- x moves away. I guess given the right INPUT a computer could derive it. It’s just like whoever wrote programs for chess or a program can figure it.
Chesserroo2

Computers do use an algorithm to evaluate positions, but it is not super accurate. They have to look several moves deep to make strong moves. Good luck with that.

EscherehcsE

There was one guy here a few years ago that posted a chessboard filled with mystical symbols and equations that were complete gibberish and totally undecipherable. The guy must have been either insane or on drugs, but the diagram was a hoot. If I could only find that thread again...

wormrose

That's what chess engines do.

wormrose

There's an old book called "Point Count Chess" which attempts to assign points to things like open files, half open files, open diagonals, pawn structure, development, space etc.

EscherehcsE
wormrose wrote:

There's an old book called "Point Count Chess" which attempts to assign points to things like open files, half open files, open diagonals, pawn structure, development, space etc.

Many people seem to agree that the point count system in the book didn't work all that well. However, the book is a pretty good positional chess primer.

uri65
TuckerTommy wrote:
Is it impossible/possible to derive a formula or sets of formulas that lead to winning chess games...maybe not even now but perhaps in the future? I just have this feeling that mathematically it’s possible.

I have no idea what do you mean by formula here. Could you give us an example? Here is a simple case - please write a formula or sets of formulas that lead to winning in this position: 

 

leoultimater

As a computer programmer, I like to think in terms of input and output more so than algorithms. Communicating with your client or manager to figure out what you're supposed to do, that's input. Writing code based on the information you understood, that's output. Do I have an algorithm describing how I write algorithms, look stuff up, test stuff, and prioritize tasks? No. That's all learning. The strongest chess engine out there right now is AlphaZero. Was it programmed with a bunch of chess-specific rules like double pawns are usually weak because they can't protect each other, castling is usually good, and trapping your bishops in is generally bad as it makes it harder to connect your rooks and other such rules of thumb?  Nah, that would be way too tweaky and rely on a bunch of human opinionated input. If we were going to solve chess, we should be thinking in terms of input and output. Define a set of absolute rules for the game of chess, and have your engine move the pieces randomly and discover its own results. Then fork the same game and make a different move toward the end. Keep in mind things like min-max where each side is trying to win or at least prevent a loss and try to draw. Have the code analyze the outcome of the game and try to figure out why whichever side won, draw or lost. Reach an assumed conclusion "white is winning more often than black based on random moves alone" and learn from this that you'll maximize your wins by playing white. Learn what works and doesn't work etc.... And don't be afraid to change this assumption if at some point later we have a reason to challenge it.

Even the art of designing chess engines is a learning process. "This engine plays better than this engine. But why?" And you isolate stuff and figure out that rating double pawns as -0.10 is too low and maybe -0.09 is better. If you can check your opponent's king and they can't block it and threaten your attacking piece, maybe this is +0.20 because it gives you more mobility and opens up tactics. But then maybe we're approaching chess all wrong like this. A human doesn't assign these values like that. They think "Is this double pawn strong, weak, or yet to be determined?" And they think in terms of confidence "Am I winning? Is my opponent winning? Is this playing toward a draw? How easy is it to play each side accurately, especially if there's time involved?" Even things like "Is my opponent rated higher, and thus I'd go up in rating by drawing? Or do I want to avoid a draw and play for the win?" This would affect things like 3-fold repetition.  Again, this is input.

So as much as we can dream of some sort of God algorithm that can play chess perfectly, 
unless a win can be forced with perfect play, chess is a draw every time with perfect play and it's a game to try to make it as difficult as possible for your opponent to find a way to claim their draw from you. Do you want to sac your queen early in the game and draw the game by checking your opponent with your rook and bishop unless they let you take their queen? Or would you rather play a much longer game where your opponent needs to find the best plan in complicated positions and spot hard to see tactics? This kind of stuff is rather subjective and can change from time to time based on the current trends in people's understanding.

But I would argue that chess is a draw from the first move unless either side blunders, even if it takes 50 moves to see the consequences in terms of piece activity.

Chesserroo2

Not just how many squares a piece can move to in one move, but how many it can get to with unlimited moves without being captured, could be another point value, although more computationally intense. Programmers have to weight the calculation cost vs how much strength it adds.

 

I want the Stockfish formunla. So far I just know the values of the chessmen, and also that a knight on the 6th is worth a rook, and that a pawn on the 7th is worth a piece. I don't know know actual numbers for everything but would like to know what Stockfish uses, for my own calculations.

leoultimater

The stockfish source code can be found here:
https://github.com/official-stockfish/Stockfish

As per the Readme.md file, there's a documentation here to aid in understanding how the codebase works:
https://chessprogramming.wikispaces.com/Stockfish

There's a whole section there dedicated to "Evaluation" that would probably interest you.  

Point value: https://chessprogramming.wikispaces.com/Point+Value
You'll see things like:  

Pawn, Knight, Bishop, Rook, Queen
Opening: 100, 350, 350, 525, 1000
Midgame: 198, 817, 836, 1270, 2521
Endgame: 258, 846, 857, 1278, 2558

In other words longer-range pieces go up in value as the game advances toward the middle and endgame, and pawns go up in value as the game advances toward the middle and endgame.

You'll see mentions of material imbalance like the bishop pair, king safty, pawn structure, and a pawn hash table which gives a value to each pawn based on its coordinates.

Ultimately, based on a number of factors, you can come up with a number to describe who's side is doing better in a given position. This is the point of the evaluation numbers. But based on the search depth, and alpha-beta pruning and concepts like min-max, you can gain an understanding how search works.

For a given position, there's the current position itself that must be evaluated. Let's say it's +3.16 and this means it's an advantage for white based on material itself and perhaps some tweaks to save us from search cut-off. In other words the last depth might think you'll get a free pawn by sacing your queen, not seeing the next move they can take back. Or if they can take back two moves away, etc.

When it's black's move, it will check all of its legal moves and find a position that gives it a position that would lower this +3.16 as low as possible, perhaps +2.91
Then let's say white blunders, putting their queen in the way of easy capture.  
The material is the same, but the evaluation will be smart enough to detect it's a hanging queen without having to waste search depth on it. Ultimately black finds it gets the score down to -6.43 or something by taking the queen with their pawn, etc.

This is how chess engines like Stockfish work at the conceptual level. There's other things like board representation as well which differs between engines. And keeping track of 3-fold repetition, the 50-move rule, en passant, castling rights, who's move it is, time control and settings.

Chess engines pretty much started with just counting material and that was their position evaluation while they tried to brute force with depth to find the best move. When searching for the best move within a certain depth, all the possible combinations of moves need to be considered in order to either maximize or minimize that +3.16 position evaluation number. But if a move is terrible enough, we can prune it and not waste depth on it. Hence alpha-beta pruning so we're not looking at both sides playing terrible for 6 (two-ply) moves. There's also another form of this where if a move looks interesting enough, such as a check, we'd look at its depth a bit deeper than other search nodes, etc.

Sadly chess engines are pretty dumb and not gonna teach you much about chess by looking at their source code other than gain a better understanding how they work, and key concepts probably better-gained elsewhere.


Why try to learn from brute force, when AlphaZero played better and has more to teach us?  
Check out: https://www.chess.com/news/view/google-s-alphazero-destroys-stockfish-in-100-game-match

Chesserroo2

There are some program optimization / design problem tips in there. The main thing I got though is that knights and bishops are each worth 3.5 pawns in the opening and endgame, and 4 in the middle game. Rooks are worth 5.25 pawns in the opening and endgame, and 6 in the middle game. Queens are worth 10 pawns in the opening and endgame, and 12.5 in the middle game.

So, a queen is still worth about 3 knights or bishops, same as before. But a rook is now about half a queen, a hair more during the middle game, and a hair less during the endgame. And pawns are now weaker than I was taught.

Yes, I'd like to look at the coordinate point system weights stuff.

TuckerTommy
The book “Best play: A new method for discovering the strongest move” by Alexander Shashin derives an algorithm drift chart that searches for the strongest move in any position based on play by Petrosian, Casablanca, and Tal’s playing. If you have the book, look at page 14.
breakingbad12

Theorically, this formula probably exists. In draughts, Jonathan Schaeffer has proved that with perfect play, you always end up in draw. There's no reason to believe that chess is different than that.

breakingbad12

However, it's important to notice that in the variant antichess, it's proven that white can force a win with perfect play. So we can't really trust our intuition sometimes...

MENTAC

Shannon's number is a conservative lower bound for the game-tree complexity of chess. It's 10^120. https://en.wikipedia.org/wiki/Shannon_number.  Zermelo's Theorem implies that a at least hypothetically determinable optimal strategy exist, necessarily. But I dunno man, it looks like one of those brute force problems, determining all possible outcomes to me, and that much computing power seems unlikely to ever be possible, but that also is not my area. I teach 300 year old Calculus to freshman and sophmores. LOL

Hans-Joachim Bremermann argued in a 1965 paper that the "speed, memory, and processing capacity of any possible future computer equipment are limited by specific physical barriers: the light barrier, the quantum barrier, and the thermodynamical barrier. These limitations imply, for example, that no computer, however constructed, will ever be able to examine the entire tree of possible move sequences of the game of chess."

My guess is that it will be "almost solved" as in "for all practical purposes" or as we used to say "good enough for government work" by continually better heuristic (non-optimal) algorithms. they already have chess engines that can beat any human. I haven't even read about this latest and greatest one from Google, but it's supposed to be the "bees knees."

I should point out that chess engines, and computer programming in general, are most definitely not my area. I mean, I can write programs to solve applied math problems if I have to, but I don't have to. LOL. As an engineer, when I needed something like that done, I would write a performance spec and give it to a programmer to actually figure out. A performance spec just says what needs to be done, not how to actually do it.

Anyway, you know how the math and physics of engineering doesn't have to be right, it just has to be right enough to work?  I suspect it'll always be like that, ever better non-optimal hueristic algorithms that eventually are so good that to us practical people "down here on the ground" it will be virtually solved, for us, but an elegant, definitive  mathematical proof will never be arrived at, but it's not my area, so don't listen to me. Ask someone who is actively engaged in writing chess engines or cheat detection algorithms maybe.  They probably have an actual pretty good handle on what's possible. I have an ancient PhD in math and an ancient masters in engineering, but this is most definitely not my area, at all, and it never will be.  I know very little about game theory, and I'm retired.   Nowadays I teach 300 year old math part time to freshman and sophomores just to get out of the house, get the stink blown off me. 

Good question though.  LOL.  I can say that yes it is possible, hypothetically, in that a solution has been proven to exist, but that determining that solution exactly is very improbable. However, these engines will get so good that it might as well be, hueristically speaking. 

MENTAC

Well heck, I dunno why, but I didn't see what @leoultimater wrote up there until just now.  :P  Probably becuase I'm old, I dunno.  LOL.  He's the guy to talk to, not me, for sure. LOL 

Chesserroo2

I doubt any equation will find the best move in every position unless it is very big and has if else statements. Has anyone heard of the mid point formula for finding a value, where your test only tells you if the true solution is greater than or less your guess? You just keep guessing halfway between the last two closest guesses where one is greater and the other less than. The algorithm is then said to converge to the solution at a certain rate and get within a certain tolerance after a certain number of moves. The goal of numerical analysis is to design algorithms that converge much faster. Well a chess algorithm is like that. You find values and conditions that matter more so you don't have to explore as many moves, which increase by powers of 1000 for every half move. Computers have limited power.

vickalan
TuckerTommy wrote:
Is it impossible/possible to derive a formula or sets of formulas that lead to winning chess games...maybe not even now but perhaps in the future? I just have this feeling that mathematically it’s possible.

Good question, and I agree this is very similar to the question of "will computers ever solve chess".

Obviously, there will never be a set of formulas to always win a game, if a perfect game of chess leads to a draw. But in that case, there could be a set of formulas for how Black can always draw, and also for how White can always draw.

If ever found, any such formulas will surely be very complicated, and will probably involve a combination of both logical evaluation and lookup-tables with access to massive databases with pre-calculated chess moves.

It has not been proven to be impossible. Humans have developed some amazingly complex algorithms, including the 5ESS switching system. This program was written by more than 5000 employees over the course of 20 years and has over 100 million lines of code.

(If you ever made a cell phone call, chances are your call was routed through this program).

Something like that might be needed to make a chess program to always win, or guarantee a draw. Or it could be more complicated. Or maybe easier.happy.png