Fruit fly races on steroids?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
towforce
Posts: 11777
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Fruit fly races on steroids?

Post by towforce »

chesskobra wrote: Sun Apr 07, 2024 12:14 amWhy is the complexity growing exponentially with board size relevant? We are dealing with 8x8 board, and the difficulty of finding a perfect algorithm has nothing to do with exponential complexity as a function of board size.

That is completely correct!

This thread is really about what, deep down, we want from computer chess - and my answer to that is a God algorithm. We're actually closing in on unbeatable engines on the 8x8 board (the draw-death issue is already very serious in correspondence chess), but today's methods for building chess engines would probably not extrapolate well to larger boards (by which I mean that I think that the "draw problem" would instantly disappear on a larger board), whereas a systematic method for creating God algorithms in chess-like games might.
The simple reveals itself after the complex has been exhausted.
User avatar
towforce
Posts: 11777
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Fruit fly races on steroids?

Post by towforce »

petero2 wrote: Sun Apr 07, 2024 7:08 am
towforce wrote: Sat Apr 06, 2024 12:42 pm The big killer, that will get close to perfect play even with a bigger board, is the God algorithm.
It seems relevant to know what has already been proven to be theoretically impossible before trying to solve a problem.

The study you linked certainly proves that (if I may be permitted to simplify) the complexity of chess increases exponentially with the board size.

It does not prove that the size of an algorithm needed to generate a correct static evaluation of a position without search in such a game increases exponentially with board size, though: the evidence suggests that it doesn't.
The simple reveals itself after the complex has been exhausted.
petero2
Posts: 699
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Fruit fly races on steroids?

Post by petero2 »

towforce wrote: Sun Apr 07, 2024 10:37 am
petero2 wrote: Sun Apr 07, 2024 7:08 am
towforce wrote: Sat Apr 06, 2024 12:42 pm The big killer, that will get close to perfect play even with a bigger board, is the God algorithm.
It seems relevant to know what has already been proven to be theoretically impossible before trying to solve a problem.
It does not prove that the size of an algorithm needed to generate a correct static evaluation of a position without search in such a game increases exponentially with board size, though
The article does not have to consider whether the algorithm is doing "search" or not (and how to define what "search" means), since it proves results that are valid for any algorithm that can be executed on a Turing machine. In particular it shows that if an algorithm is able to determine the game-theoretical value of any position, there exist positions for which the algorithm has a runtime larger than polynomial in the board size. (This assumes the 50-move draw rule does not apply though to the generalized chess variant.)

A direct quote from the article:

This implies that there exists d > 0 and infinitely many positions p such that an algorithm for deciding whether White (Black) can win from that position requires at least c^(|p|^d) time-steps to compute, where c > 1 is a constant and |p| is the size of p. Generalized chess is thus provably intractable, which is a stronger result than the complexity results for board games such as Checkers, Go, Gobang and Hex which were shown to be Pspace-hard.
User avatar
towforce
Posts: 11777
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Fruit fly races on steroids?

Post by towforce »

petero2 wrote: Sun Apr 07, 2024 10:32 pmThe article does not have to consider whether the algorithm is doing "search" or not (and how to define what "search" means), since it proves results that are valid for any algorithm that can be executed on a Turing machine. In particular it shows that if an algorithm is able to determine the game-theoretical value of any position, there exist positions for which the algorithm has a runtime larger than polynomial in the board size. (This assumes the 50-move draw rule does not apply though to the generalized chess variant.)

A direct quote from the article:

This implies that there exists d > 0 and infinitely many positions p such that an algorithm for deciding whether White (Black) can win from that position requires at least c^(|p|^d) time-steps to compute, where c > 1 is a constant and |p| is the size of p. Generalized chess is thus provably intractable, which is a stronger result than the complexity results for board games such as Checkers, Go, Gobang and Hex which were shown to be Pspace-hard.

To help anyone who's interested, here's a direct link to the paper PDF - link.

Assuming that the paper is, in general, correct, then the part of the paper that REALLY MATTERS is the section called "POLYNOMIALITY OF TRANSFORMATION", which is a little over half a page long, and is on page 213 of the paper.

This proves that in the given position, the number of moves (more accurately, the complexity of the game tree) it would take to get from that position to the win rises exponentially with the size of the board. I have no argument whatsoever with this proof - it looks entirely correct to me.

However, their proof assumes that there is no other way to prove the win other than to play out all the possible ways the game could go.

It is utterly trivial to show that this is wrong. Take another look at this position:

[d]8/8/8/8/3k4/8/8/4KR2 w - - 0 1

This position is won for white, with 29 moves to mate (see my previous post about this position for the EGTB link). I am going to prove it's won another way, without reference to the EGTB, as follows:

IT'S CONSPICUOUSLY OBVIOUS THAT WHITE IS WON IN THIS POSITION

What I mean by that is:

1. The position has a pattern which is known to be won

2. All chess players who are not beginners know this pattern

Now imagine a similar position on a 100x100 chess board. The kind of proof discussed in that paper would now be intractably large (as would a game tree of all possible games from that position - assuming that the 50-move rule becomes the "5000 move rule"). Using the mechanism described in the paper, you could reasonably say that it couldn't be proven to be a win in a reasonable amount of time on a cheap computer.

However, using my proof above ("it's obvious"), you can say it's won. It will take hundreds of moves to win rather than the 29 moves it takes on an 8x8 board, but its still a provable win.

Continuing the theme of "obvious statements", there are going to be many positions on a 100x100 board (and even on an 8x8 board) where there are not known patterns to quickly tell you whether white can win. But the point is that I have disproven the assertion that the paper proves that "This implies that there exists d > 0 and infinitely many positions p such that an algorithm for deciding whether White (Black) can win from that position requires at least c^(|p|^d) time-steps to compute...". The paper only proves that, in similar positions*, the distance to the win can rise exponentially with the board size. It has nothing whatsoever to say about patterns and heuristics.

*a simplification for clarity
The simple reveals itself after the complex has been exhausted.
User avatar
hgm
Posts: 27945
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Fruit fly races on steroids?

Post by hgm »

towforce wrote: Sat Apr 06, 2024 12:42 pmMany ways have been suggested to reduce the draw rate - but none of them will work for long, except for... bigger boards. The complexity of chess increases exponentially with board size.
We could try this creation of mine, called Makromachy:
theme=MV firstRank=1 satellite=makrom
files=14
ranks=14
promoZone=1
maxPromote=2
promoChoice=Q,M,G,RH,CN,V,CH,C,Z
graphicsDir=*/graphics.dir/alfaeriePNG/
squareSize=35
graphicsType=png
theme=DD
whitePrefix=w
blackPrefix=b
borders=0
firstRank=1
useMarkers=1
newClick=1
protected=23
captureMatrix=/"18/19^^^^=/"/19^^^^%=
pawn::fmWfceFifmnDifmnH::a4-n4
warrior::fmWfmnnDfceFbhcN:quickpawn:a2-c2,l2-n2
vao::mBpcB::d1,k1
zebra::::d2,k2
camel::::b1,m1
elephant::yafpabmBFA:elephantferz:e3,j3
knight:N:afyafyafpabmFN::c3,l3
bishop::::a3,n3
cannon:CN:::e1,j1
champion:CH:yafpabmRWAD::c1,l1
rook::::e2,j2
dragon horse:DH:BW:promotedbishop:b3,m3
dragon king:DK:RF:promotedrook:a1,n1
rhino:RH:[W?fsB]::g1
griffon::[F?fsR]:gryphon:f1
archbishop:::cardinal:k3
marshall:::chancellor:d3
queen::::h2
archer:AR:WA::f3,i3
bat:BA:B(paf)12cB::g3,h3
raven:FA:R(paf)12cR:bird2:f2,i2
eagle:EA:Q(paf)12cQ:bird:h1
terror::QNADcamK:dragon:g2
king::KispO9::i1
(I don't design chess variants very often, but in this case I wanted to demonstrate a novel idea to make large variants more exciting: there are some 'flying pieces' who can jump over arbitrary many other pieces, and thus can endanger the King from the very beginning. E.g. getting a white Bat on n9 would be checkmate, and you can threaten this with the first move.)
chesskobra
Posts: 234
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Fruit fly races on steroids?

Post by chesskobra »

towforce wrote: Sun Apr 07, 2024 11:50 pm
However, their proof assumes that there is no other way to prove the win other than to play out all the possible ways the game could go.

It is utterly trivial to show that this is wrong. Take another look at this position:

[d]8/8/8/8/3k4/8/8/4KR2 w - - 0 1

This position is won for white, with 29 moves to mate (see my previous post about this position for the EGTB link). I am going to prove it's won another way, without reference to the EGTB, as follows:

IT'S CONSPICUOUSLY OBVIOUS THAT WHITE IS WON IN THIS POSITION

What I mean by that is:

1. The position has a pattern which is known to be won

2. All chess players who are not beginners know this pattern


Continuing the theme of "obvious statements", there are going to be many positions on a 100x100 board (and even on an 8x8 board) where there are not known patterns to quickly tell you whether white can win. But the point is that I have disproven the assertion that the paper proves that "This implies that there exists d > 0 and infinitely many positions p such that an algorithm for deciding whether White (Black) can win from that position requires at least c^(|p|^d) time-steps to compute...". The paper only proves that, in similar positions*, the distance to the win can rise exponentially with the board size. It has nothing whatsoever to say about patterns and heuristics.

*a simplification for clarity
I have not read the paper, but petero2 quoted "there exist infinitely positions for which deciding ... requires ... steps to compute". This does not mean there are no simple positions where the win can be proved easily. There could also be infinitely many simple positions as in your example. The result also does not imply that the distance to win will grow exponentially. You could for example have a small depth but high width requiring "exponentially many time-steps to compute", which is not the same as "exponentially large distance to win".
User avatar
towforce
Posts: 11777
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Fruit fly races on steroids?

Post by towforce »

hgm wrote: Mon Apr 08, 2024 10:39 am
towforce wrote: Sat Apr 06, 2024 12:42 pmMany ways have been suggested to reduce the draw rate - but none of them will work for long, except for... bigger boards. The complexity of chess increases exponentially with board size.
We could try this creation of mine, called Makromachy:
theme=MV firstRank=1 satellite=makrom
files=14
ranks=14
promoZone=1
maxPromote=2
promoChoice=Q,M,G,RH,CN,V,CH,C,Z
graphicsDir=*/graphics.dir/alfaeriePNG/
squareSize=35
graphicsType=png
theme=DD
whitePrefix=w
blackPrefix=b
borders=0
firstRank=1
useMarkers=1
newClick=1
protected=23
captureMatrix=/"18/19^^^^=/"/19^^^^%=
pawn::fmWfceFifmnDifmnH::a4-n4
warrior::fmWfmnnDfceFbhcN:quickpawn:a2-c2,l2-n2
vao::mBpcB::d1,k1
zebra::::d2,k2
camel::::b1,m1
elephant::yafpabmBFA:elephantferz:e3,j3
knight:N:afyafyafpabmFN::c3,l3
bishop::::a3,n3
cannon:CN:::e1,j1
champion:CH:yafpabmRWAD::c1,l1
rook::::e2,j2
dragon horse:DH:BW:promotedbishop:b3,m3
dragon king:DK:RF:promotedrook:a1,n1
rhino:RH:[W?fsB]::g1
griffon::[F?fsR]:gryphon:f1
archbishop:::cardinal:k3
marshall:::chancellor:d3
queen::::h2
archer:AR:WA::f3,i3
bat:BA:B(paf)12cB::g3,h3
raven:FA:R(paf)12cR:bird2:f2,i2
eagle:EA:Q(paf)12cQ:bird:h1
terror::QNADcamK:dragon:g2
king::KispO9::i1
(I don't design chess variants very often, but in this case I wanted to demonstrate a novel idea to make large variants more exciting: there are some 'flying pieces' who can jump over arbitrary many other pieces, and thus can endanger the King from the very beginning. E.g. getting a white Bat on n9 would be checkmate, and you can threaten this with the first move.)

Looks great!

Two questions:

1) Is a first move of bat => N9 actually checkmate? If so, I can declare this variant a win for white :)

2) One drawback: it looks as though this game would take forever (as would any large-board variant): time controls would have to be short to have any hope of completing this game, so there wouldn't be much "learning by thinking" going on. :(
The simple reveals itself after the complex has been exhausted.
User avatar
towforce
Posts: 11777
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Fruit fly races on steroids?

Post by towforce »

chesskobra wrote: Mon Apr 08, 2024 11:15 amI have not read the paper, but petero2 quoted "there exist infinitely positions for which deciding ... requires ... steps to compute". This does not mean there are no simple positions where the win can be proved easily. There could also be infinitely many simple positions as in your example.
Agreed.

The result also does not imply that the distance to win will grow exponentially. You could for example have a small depth but high width requiring "exponentially many time-steps to compute", which is not the same as "exponentially large distance to win".

This is also correct: I was simplifying to keep the discussion accessible and everyone engaged. To be fair to myself, though, I did say "the number of moves (more accurately, the complexity of the game tree) it would take to get from that position to the win rises exponentially with the size of the board".
The simple reveals itself after the complex has been exhausted.
User avatar
hgm
Posts: 27945
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Fruit fly races on steroids?

Post by hgm »

towforce wrote: Mon Apr 08, 2024 3:15 pm1) Is a first move of bat => N9 actually checkmate? If so, I can declare this variant a win for white :)
Yes, sorry. I should have said the flying pieces can only jump when they capture (or to deliver check), not on non-captures. So you will have to move up the i-Pawn first. 1... m10 is an adequate defense, as well as a healthy development move, so white doesn't derive a large first-move advantage from this threat.
2) One drawback: it looks as though this game would take forever (as would any large-board variant): time controls would have to be short to have any hope of completing this game, so there wouldn't be much "learning by thinking" going on. :(
This is indeed the common drawback of such large games. What typically happens when you just slam a huge number of pieces on a large board is that the sliders encounter each other much faster than the leapers, and are traded out of the game. This then leads to a slow an tedious battle between two hosts of slow-moving pieces, which also have to be traded out of the way before you can get to the Kings.

I had some ideas how to ameliorate that, though, and these culminated in this design. One such idea is the flying pieces I already mentioned; these put the Kings at risk from the very beginning, because their attacks can only be blocked by each other (or by the Archers), so that you don't have to wait for the bulk of the armies to be eroded away with setting up mate attacks. It is like a parallel game is played on a sparsely populated board (which you could imagine as the 'sky level'). Pieces behind which the King can shelter for these flying attacks are necessarily placed more forward, and thus are more vulnarable to attacks by normal pieces, which could trade them away to leave the King exposed.

Another implemented idea is to have a super-piece that is very adept in massacring weaker pieces, and adopt an anti-trading rule for it to prolong its presence in the game. By equiping it with 'hit-and-run' captures, it can take out protected pieces with impunity. It is almost impossible to defend against that, favoring attack over defense.

[Edit] Annoying: the forum software interprets colons in the definition of the Diagram as smilies, making some pieces disappear. In my own posting I had to suppress smilies for the Diagram to show up correctly.
smatovic
Posts: 2832
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Fruit fly races on steroids?

Post by smatovic »

Flying pieces, archers, sky level, beautiful :)

--
Srda