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

Sort:
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...

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

wormrose

I have read that there is now an engine which; given any first move, can beat Magnus Carlsen. 

uri65

The original question was about "a formula or sets of formulas". Why everybody is answering about algorithms, computer software etc?? Formula and algorithm are two different concepts. From Wikipedia: "In science, a formula is a concise way of expressing information symbolically, as in a mathematical or chemical formula. The informal use of the term formula in science refers to the general construct of a relationship between given quantities."