frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

What were the first animals? The fierce sponge–jelly battle that just won't end

https://www.nature.com/articles/d41586-026-00238-z
2•beardyw•7m ago•0 comments

Sidestepping Evaluation Awareness and Anticipating Misalignment

https://alignment.openai.com/prod-evals/
1•taubek•7m ago•0 comments

OldMapsOnline

https://www.oldmapsonline.org/en
1•surprisetalk•9m ago•0 comments

What It's Like to Be a Worm

https://www.asimov.press/p/sentience
2•surprisetalk•9m ago•0 comments

Don't go to physics grad school and other cautionary tales

https://scottlocklin.wordpress.com/2025/12/19/dont-go-to-physics-grad-school-and-other-cautionary...
1•surprisetalk•9m ago•0 comments

Lawyer sets new standard for abuse of AI; judge tosses case

https://arstechnica.com/tech-policy/2026/02/randomly-quoting-ray-bradbury-did-not-save-lawyer-fro...
2•pseudolus•10m ago•0 comments

AI anxiety batters software execs, costing them combined $62B: report

https://nypost.com/2026/02/04/business/ai-anxiety-batters-software-execs-costing-them-62b-report/
1•1vuio0pswjnm7•10m ago•0 comments

Bogus Pipeline

https://en.wikipedia.org/wiki/Bogus_pipeline
1•doener•11m ago•0 comments

Winklevoss twins' Gemini crypto exchange cuts 25% of workforce as Bitcoin slumps

https://nypost.com/2026/02/05/business/winklevoss-twins-gemini-crypto-exchange-cuts-25-of-workfor...
1•1vuio0pswjnm7•11m ago•0 comments

How AI Is Reshaping Human Reasoning and the Rise of Cognitive Surrender

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6097646
3•obscurette•12m ago•0 comments

Cycling in France

https://www.sheldonbrown.com/org/france-sheldon.html
1•jackhalford•13m ago•0 comments

Ask HN: What breaks in cross-border healthcare coordination?

1•abhay1633•13m ago•0 comments

Show HN: Simple – a bytecode VM and language stack I built with AI

https://github.com/JJLDonley/Simple
1•tangjiehao•16m ago•0 comments

Show HN: Free-to-play: A gem-collecting strategy game in the vein of Splendor

https://caratria.com/
1•jonrosner•17m ago•1 comments

My Eighth Year as a Bootstrapped Founde

https://mtlynch.io/bootstrapped-founder-year-8/
1•mtlynch•17m ago•0 comments

Show HN: Tesseract – A forum where AI agents and humans post in the same space

https://tesseract-thread.vercel.app/
1•agliolioyyami•18m ago•0 comments

Show HN: Vibe Colors – Instantly visualize color palettes on UI layouts

https://vibecolors.life/
1•tusharnaik•19m ago•0 comments

OpenAI is Broke ... and so is everyone else [video][10M]

https://www.youtube.com/watch?v=Y3N9qlPZBc0
2•Bender•19m ago•0 comments

We interfaced single-threaded C++ with multi-threaded Rust

https://antithesis.com/blog/2026/rust_cpp/
1•lukastyrychtr•20m ago•0 comments

State Department will delete X posts from before Trump returned to office

https://text.npr.org/nx-s1-5704785
7•derriz•20m ago•1 comments

AI Skills Marketplace

https://skly.ai
1•briannezhad•21m ago•1 comments

Show HN: A fast TUI for managing Azure Key Vault secrets written in Rust

https://github.com/jkoessle/akv-tui-rs
1•jkoessle•21m ago•0 comments

eInk UI Components in CSS

https://eink-components.dev/
1•edent•22m ago•0 comments

Discuss – Do AI agents deserve all the hype they are getting?

2•MicroWagie•24m ago•0 comments

ChatGPT is changing how we ask stupid questions

https://www.washingtonpost.com/technology/2026/02/06/stupid-questions-ai/
1•edward•25m ago•1 comments

Zig Package Manager Enhancements

https://ziglang.org/devlog/2026/#2026-02-06
3•jackhalford•27m ago•1 comments

Neutron Scans Reveal Hidden Water in Martian Meteorite

https://www.universetoday.com/articles/neutron-scans-reveal-hidden-water-in-famous-martian-meteorite
1•geox•28m ago•0 comments

Deepfaking Orson Welles's Mangled Masterpiece

https://www.newyorker.com/magazine/2026/02/09/deepfaking-orson-welless-mangled-masterpiece
1•fortran77•29m ago•1 comments

France's homegrown open source online office suite

https://github.com/suitenumerique
3•nar001•32m ago•2 comments

SpaceX Delays Mars Plans to Focus on Moon

https://www.wsj.com/science/space-astronomy/spacex-delays-mars-plans-to-focus-on-moon-66d5c542
1•BostonFern•32m ago•0 comments
Open in hackernews

No reachable chess position with more than 218 moves

https://lichess.org/@/Tobs40/blog/there-is-no-reachable-chess-position-with-more-than-218-moves/a5xdxeqs
365•emporas•4mo ago

Comments

eru•4mo ago
https://lichess.org/@/Tobs40/blog/there-is-no-reachable-ches... describes how the author removed some more complicated rules in the first pass, and is willing to re-introduce them, if necessary. Ie if the solution found violates them.

Interestingly, mixed integer linear programming solvers already support these. The technical term for this is 'row generation'. It comes from the usually way these problems are written in matrix form, where rows correspond to constraints and columns correspond to variables.

(Dynamically) adding a row is equivalent to introducing a constraint only if it's violated.

This approach is often used for the traveling salesman problem.

(Weirdly enough, Wikipedia has https://en.wikipedia.org/wiki/Column_generation but nothing on row generation.)

LeGrosDadai•4mo ago
I'm quite curious to see if the MILP solver would terminate (given the massive search space), my guess is not.
eru•4mo ago
Well, my point is that you can encode the tricks described in the linked article directly in a modern MILP solver in a way that is legible to the solver. We'd expect similar behaviour in that case, or perhaps slightly better, because the solver can 'see' them better.

Yes, if you do a naive programme only, it would be a massive search space.

salt4034•4mo ago
The most commonly used term for this is lazy constraints (https://support.gurobi.com/hc/en-us/articles/360013197972-Ho...).
Tobs40•4mo ago
Hi, author of the Lichess article here.

relaxing and omitting chess rules also changed the choice of variables. I did try lazy constraints etc. before diving into the math, but they did not yield a significant speedup. For example, not considering the white king as being in check simplified A LOT.

Best regards, Tobi

eru•4mo ago
Thanks!

> relaxing and omitting chess rules also changed the choice of variables.

I wonder if you can recast some of that in terms of (dynamic) row generation?

> I did try lazy constraints etc. before diving into the math, but they did not yield a significant speedup.

Yes, I can believe that. My point wasn't so much that using heuristics like these is somehow bad, but more that the off-the-shelf solvers can be made to cooperate with (many of) your heuristics.

> For example, not considering the white king as being in check simplified A LOT.

I guess you could classify that as branch-and-bound, if you squinted really hard?

reader9274•4mo ago
Isn't the very first move of any chess game a reachable chess position with more than 218 moves?
reed1234•4mo ago
It’s not 218 possibilities it’s 218 moves.
electroly•4mo ago
Maybe one of us is misunderstanding, but aren't there far fewer than 218 on the first move? The position in the article needed nine unobstructed queens to achieve 218 possible moves. For the first move, I think we could just enumerate the moves by hand, right? Eight pawns can move one or two spaces, that's 16 moves. The two knights have two moves, that's 4. Nothing else can move, can it? That's only 20 moves.

EDIT: I think I understand the confusion. A "move" in this case is a legal possibility for white's next turn. It's not talking about the number of moves in the game, but rather the number of legal choices for white in a single turn.

Tobs40•4mo ago
Author here!

You are correct! It's White to move and White has 218 moves to choose from as their next move. My article proves that you can't do better than 218.

clintonc•4mo ago
The initial board position is certainly reachable (and reached in every game!), but there are only 20 legal moves available: the 16 legal pawn moves for White, and the 4 legal knight moves for White.
ted_dunning•4mo ago
Indeed. And 20 < 218.

So your agree with the article so far.

renewiltord•4mo ago
When you use small context LLM, you get completion like this.
jibal•4mo ago
No, there are only 20 moves in the initial position.
kryptiskt•4mo ago
Now I wonder how Nenad Petrović and Jenő Bán came up with the optimal solutions to the problems in the 60s.
Eji1700•4mo ago
Glancing at it a chess players first instinct looks to be the "solution".

Assume all pawns are queens, then maximize queen moves, work backwards from there. Couple of other "obvious" assumptions such as minimal black pieces, which means shoving the king in a corner but somehow not in check, Rooks cover the next largest amount of space so they're going in corners, bishops will be mirrored, etc.

Not to say it isn't still impressive, but I always wonder how many "sane" positions there are for solving a puzzle like this in the first place. The paper quotes some huge number and someone else says it's a smaller, but still massive, number, but when you look at the stated goal and start from some obvious starting points, start working out rules (obviously 4 queens right in the middle blocks other queens and costs space), and eliminate symmetrical positions, well you're left with a decently solvable problem. At least compared to the kind of shit that's usually brute force solved.

Edit:

This is actually a fun one to think about for a bit the more I look at it.

It quickly becomes apparent that your basically getting 7 moves out a of a rank/column MAX, so you maximize for that first.

It quickly becomes apparent that the knights L move shape is also the optimal way to start tiling your 9 queens to maximize for squares taken.

As I said before the black position obviously has to be the dead minimum, and it makes sense that'd be a king and 2 pawns due to various end game stuff (basically impossible to prevent the king from being in check otherwise while taking up as much space as possible).

Once you know you're doing that with the black king you'll want to "block" the remaining space with pieces that can't threaten it, so you shove a bishop adjacent (which can still take the pawn), and figure you're going to mirror that bishop because that's kinda how bishop's work in play/mathematically.

It's actually quite neat to see how each step sorta leads you to the next one, like one of those metal puzzles or the sudoku's with unique rules and only 1 or 2 starting numbers.

Still i'm positive if I hadn't seen this picture first I probably NEVER would've gotten this answer correct, but I do think i would've come closer than I ever expected.

Edit 2:

Ahh i do see they have at least one or two solutions that are 218 where there's only 2 black pieces. I'm somewhat surprised that's a possible legal position but so be it. Interesting that still leads to the same net realestate. Thats the one area i'd expect to gain something if you could cheat.

somenameforme•4mo ago
Probably by just thinking about it and working to incrementally improve their answers. I'd expect plenty of people solved it before them but never published or publicized their solution. It's quite logical in many ways. For instance just thinking about the problem abstractly:

- You can only have 9 queens and they're going to want to be as centrally placed as possible with as little overlap as possible.

- The black king will need to be tucked in a corner and covered by a minimum of his pieces and nonchecking pieces of your own.

- All your other pieces, if useable, will probably end up on the edge of the board since minimizing the number of squares they block is likely to be more impactful than maximizing the number of squares they cover.

There's probably other heuristics I'm not considering, but just with those 3 you're already well on your way to the solution. So you'd lay out the pieces, and then try to find a way to do it one move better, and iterate! The concerns I'd have: pawn promotion can complicate things dramatically. Pawns can promote to 4 different pieces which would technically be 4 different moves. And a pawn can have up to 3 different paths to promote - so that's 12 possible moves tucked in a very tiny space. And then king placement - castling can add up to 2 more moves, and so compensating for that (and the corresponding rook position) adds some complexity.

Tobs40•4mo ago
Author here!

Composing such a position is much easier than mathematically proving that there isn't a better one. Perhaps there is an elegant proof. Perhaps they had reasoning that proved that they couldn't do better while composing it. Probably involves plenty of case distinctions. So I decided to just let a computer reason through it, also because human minds are fallible ^^

codeulike•4mo ago
They dont really spell it out but they mean "from this position the player has 218 possible legal moves to choose from"
wodenokoto•4mo ago
I thought it was "How many moves in a game does it take to reach this position"
coolness•4mo ago
I also thought this but OP is right: https://dev.timenote.info/de/Nenad-Petrovic

> In 1964 Petrović constructed a position with 218 possible moves for White.

jmkd•4mo ago
Same, which also damages my personal policy of reading the link before any HN comments.
stephenhumphrey•4mo ago
Huh. I also have that personal policy. Yet this time I jumped first to the comments before reading the article. I’m not certain why. Perhaps I subconsciously intuited that the ambiguity in the headline might be resolved by some of you smart people. Brains are weird; mine is, anyway.
jl6•4mo ago
The right™ order is to check the comments before the article, but to read the article before commenting.
winternewt•4mo ago
I thought it was "there's no position in chess that requires more than 218 moves to reach."
unkulunkulu•4mo ago
I thought “there is no chess problem that is both reachable from starting position and requires more than 218 moves to solve”
binarymax•4mo ago
There are no more than 218 ways to interpret this title
fer•4mo ago
It'll take at most 218 comments on HN to figure out the meaning of the submission title
matheusmoreira•4mo ago
It'll take at most 218 characters to express the fact I did not understand the submitted article's title.
leoff•4mo ago
I seriously thought they meant "it's not possible to have a chess game with more than 218 moves"
ojo-rojo•4mo ago
Yeah, I'm still confused.
fwip•4mo ago
There is no reachable[1] chess position[2] at which a player has more than 218 valid moves[3] to choose from.

[1] Able to happen while following the rules of chess

[2] The arrangement of chess pieces on the board

[3] A valid move is the motion of one piece to a place on the board, which doesn't break the rules of chess - e.g: "King to E4."

brumar•4mo ago
Same. I was astonished it was remotely possible to do this.
jibal•4mo ago
To do what?
brumar•4mo ago
To find "How many moves in a game does it take to reach this position". Which was a wrong interpretation.
weinzierl•4mo ago
But this an interesting problem too. More specifically is there an upper bound for the number of moves in a legal chess game?
kevindamm•4mo ago
Not explicitly, but when you consider the "cannot repeat the same board layout three times" rule, the number of moves possible in a game does have a limit.
jibal•4mo ago
The 3 repetition draw rule has no bearing on the number of possible chess positions. And for the number of possible moves in a game the 50 moves with no capture or pawn move rule is a much more stringent limit.

BTW, the 3 repetition rule only comes into play is one of the players invokes it ... games can legally have more than 3 repetitions, but not more than 5 repetitions.

kevindamm•4mo ago
I didn't know it required a player to invoke it, I was basing the statement on chess implementations I've read (and written) where it kicks in automatically... but the 5-time limit you mention still supports my case that there's an upper limit. As long as the number of pieces remains the same, there are a finite number of arrangements for them so eventually (after a finite number of moves) a position would be repeated enough times. If a piece is captured (or converted) it resets this but still yields a finite number of new arrangements. Eventually you either cannot avoid the repetition, or a win condition is met, or a draw for insufficient material.

Compare this to, say, the L game, where the number of moves is unbounded.

jibal•4mo ago
Your "case" that there's a limit isn't in question ... as I said, the 50 move rule is a far more stringent limitation. And those 50 moves cannot include repetitions--they are captures and pawn moves, which are irreversible.

If you read my comment that you responded to carefully, you will find that it is precise and accurate--as I said, the repetition rule has no bearing on the number of positions.

This horse is dead, so I'm moving on.

Scarblac•4mo ago
The 50 moves rule also needs to be claimed by one of the players.

However there is a 75 move rule and a 5 time repetition rule that are both automatic (don't need to be claimed).

unkulunkulu•4mo ago
there certainly is if you consider 50 moves rule.

And you can derive an easy upper bound from that as 50x8x8x2 (basically each 50 moves you make a pawn move)

if you only consider 3 moves repetition and not 50 move rule then this is harder and the number becomes one of those crazy combinatorical numbers.

jibal•4mo ago
The 50 move rule is a rule of chess so it must be considered.

The 3 repetition rule is an opportunity for one of the players to declare a draw, but games can continue beyond that. The mandatory draw rule is 5 repetitions. In any case, the 50 move rule is far more limiting as to the number of moves in a game, since repetitions are necessarily neither pawn moves nor captures (the whole point of the 50 move rule being limited to those is that they are irreversible).

CrazyStat•4mo ago
> And you can derive an easy upper bound from that as 50x8x8x2 (basically each 50 moves you make a pawn move)

This is not high enough, because the 50 move rule also resets when a piece is captured.

Certhas•4mo ago
Actually no. 50×(16×6 + 32) = 50×(16× 8) works I think. Every 50 moves, move a pawn or capture. There are 16 pawns. Each pawn can be moved 6 times, so there are 16×6 pawn moves available. In addition there are 32 captures available.
Scarblac•4mo ago
The 50 moves rule doesn't have be considered as it is optional. The players may claim, but they don't have to. So the game can continue.

The 75 move rule is the exact same thing but mandatory. That has to be considered.

(same thing is true for 5 times repetition vs 3 times).

Captures also reset the counter, not only pawn moves.

dmurray•4mo ago
I believe 8848.5 under modern rules (with the 75-move rule, as in FIDE rules since 2014). There's a reasonably rigorous demonstration here:

https://wismuth.com/chess/longest-game.html

LegionMammal978•4mo ago
Thanks for that link! I was looking for that answer a few years ago, but I couldn't find anyone who had carried it out all the way through (with the cost of "switching control" fully accounted for), nor many people who were even aware of the 75-move rule.
LorenPechtel•4mo ago
75 move rule?! Did they go and change the 50 move rule or something, because I've never heard of it.
dmurray•4mo ago
The 50 move rule is still there: either player has the right to claim a draw after 50 moves without a pawn move or a capture. So the game can end then if either player wishes it to (and it almost always will end, because at least one player can expect no better than a draw).

After 75 moves, however, it's not optional, the game has ended. It's still a draw if the game subsequently "ends" in checkmate or a loss on time, though maybe not the players sign the score sheet, move on to the next round, etc.

sim7c00•4mo ago
how can the longest game have half a move???
InitialLastName•4mo ago
"Moves" are counted for both players. Half a move means White moved but Black hasn't yet.
sim7c00•4mo ago
thank you!
pxx•4mo ago
An A press is an A press. You can't say it's only a half.
arc-in-space•4mo ago
Ah, thank you. I was confused reading this article, thinking it's about the unique position that takes the most moves to reach.
WithinReason•4mo ago
Thanks, I misunderstood the entire article. Great writing!
sverhagen•4mo ago
How can those two things be true at the same time? Unless you appreciate misunderstanding what you read...?
burnished•4mo ago
What other reason would a person have for juxtaposing two statements?
Sharlin•4mo ago
How could someone ever write something while intending to convey the exact opposite meaning?
absoflutely•4mo ago
You hit the nail on the head. They aren't both true which is why the second sentence is sarcasm.
BrenBarn•4mo ago
Yes, very strange that the phrase "possible moves" never occurs in the article. The key word is "possible". The article consistently just uses the phrasing "have moves" but this is not an obvious way of phrasing things to the average person (although I think it's more common in chess lingo).
unkulunkulu•4mo ago
in chess lingo the most common is “legal moves”
fsckboy•4mo ago
in chess lingo, most common is "moves"; only in a weird circumstance (beginners?) would you need to say "legal".

the "possible" qualifier would probably be used for an "english" reason rather than a "chess" reason, to suggest "future" moves as opposed to the moves already made to get to a position. it would be more likely for whatever reason to say "how many possible moves" than "how many future/hypothetical moves", i.e. the use of possible is not to rule out the idea of impossible, simply to mean how many "could you make now from a particular position" and/or i guess to suggest "possible initial moves" as opposed to future follow-on moves.

the ambiguity is not really in chess, it's in english (and probably every other language also)

BrenBarn•4mo ago
> the ambiguity is not really in chess, it's in english (and probably every other language also)

Sure, but the article is written in English. :-)

fsckboy•4mo ago
"moves" includes the idea of possible. "reachable" chess positions can only be the result of moves which are only those possible, and any follow-on moves would also only be those that are possible
BrenBarn•4mo ago
But if you say a position "has possible moves" (or "available moves") that unambiguously means moves that are possible from that position (i.e., future moves), whereas simply saying that a position "has moves" is ambiguous about whether those moves are in the past or the future.
davedx•4mo ago
But black has no king, so surely the game is over and there are no more legal moves?

Why does black have two pawns but no king?

I don’t understand any of this

electroly•4mo ago
Every board on the page, with the exception of the illegal "all queens" board, has a black king. The king is the one with the cross above the crown. In the first board, the 218 winner, it's at A1.
davedx•4mo ago
The first image, which I assume is the solution because the title is 'Reachable chess position with 218 moves for White, published by Petrović in 1964.', has no black king?
electroly•4mo ago
Look again. It's at A1. You may be confusing that symbol with a different piece.
davedx•4mo ago
Ugh. Sigh, I see it now - I thought that was the white king, because it has quite some white in it.

I will allocate 50% blame to my brain and eyes, and 50% to whoever designed a black king to have so much white in it :P Thanks!

jibal•4mo ago
No, it's 100% on you. If the piece on a1 is a white king, then what's the piece on f1? And why would there be no black king, when the subject is reachable (and thus legal) positions?
nabla9•4mo ago
It should be obvious that there are no 8.7 × 10^45 possible chess moves from any chess position. All pieces have less than 32 moves per piece and 19 pieces means less than 608 moves.
electroly•4mo ago
No, they do mean possible moves and they don't mean maximum length game. There are on the order of 10^45 reachable chess positions. The article did not say that was the number of moves from one position. The article says 218 is the maximum number of moves from one reachable position--it's the whole point of the article!
jibal•4mo ago
The person you responded to knows that.
electroly•4mo ago
Their post was edited to remove the part I was responding to; the "do" in my post was directly correcting the "don't" in their original post, and vice versa.
amitparikh•4mo ago
Right, and by "reachable" they mean it is theoretically possible to get to this board position through a normal (albeit obviously methodically chosen) series of moves.
amelius•4mo ago
If only they had appended "to choose from" to the article headline, it would have been clear from the start.
jibal•4mo ago
The caption on the first position is "Reachable chess position with 218 moves for White, published by Petrović in 1964."

And the title is unambiguous: "There is no reachable chess position with more than 218 moves" -- that cannot possibly mean "There is no reachable chess position that it takes more than 218 moves to reach". Also, lichess is a chess site, where people are certain to know that chess games can go way beyond 218 moves.

Agingcoder•4mo ago
Yeah I gave up when I realized I didn’t understand what problem he was trying to solve
stavros•4mo ago
Ah, wow, I read the article wrong all this time, thank you. I thought they meant "the maximum number of moves you can make to reach any chess position is 218", and I was wondering why the article made no sense to me.
kelipso•4mo ago
Is that weird? I feel like it’s plausible though. Very rare to have chess games with more than 200 moves.
stavros•4mo ago
Yeah I kind of thought that it meant "you can get to any valid position in 218 moves max", it was hard to parse.
OwlGoesHoot•4mo ago
I read it as “there is no legal position for which the minimum number of moves necessary to reach it is greater than 218” but I also did not read the whole article before coming to check the comments
refulgentis•4mo ago
It’s also rare to have one with more than 50 moves. I’m curious if this class of observation will help establish a true bounds. Especially because we don’t have a definition of what it means - my instinct is to first do that, so “infinity” isn’t the obvious upper bound.
kelipso•4mo ago
Proving this feels more difficult than proving what’s in the OP article, because here you have to show path lengths between original position and all possible positions have a max length, while OP article had to show all positions have a max degree. Path length just seems like a harder problem compared to node degree.
tln•4mo ago
What? Lots of serious chess games last more than 50 moves

Not sure if I'm reading your comment correctly

The upper bound of moves is 8848.5 https://www.reddit.com/r/chess/comments/168qmk6/longest_poss...

... under the rule that after 75 moves without a capture or pawn advancement the game is drawn

refulgentis•4mo ago
You read a comment saying it’s rare to have more than 200 moves, then a reply noting more than 50 is also rare, then suggested you were confused and maybe it was unreadable and asked “What?” because…some games have above 50 moves. shrugs

Thanks for note re: upper bound with 75 moves without pawn advancing constraint.

tln•4mo ago
More than 50 moves in a game is hardly rare, hence my surprised reaction
LorenPechtel•4mo ago
The upper bound is a few thousand. A game is considered drawn if no pawn has moved and no piece has been captured for 50 moves. And there's also the threefold repetition rule: if the same exact position (counting things like castling eligibility etc) occurs three times it's drawn.
chipsrafferty•4mo ago
I think the upper bound is 6300, then. Each pawn can move 6 times, times 16 pawns, times 50 moves before a game ending draw, plus each capturable piece that can delay the game another 50 moves (15 on each side)
bscphil•4mo ago
I thought the same, but no doubt pawn promotion rules dramatically increase the depth needed to reach certain positions.
AceyMan•4mo ago
The word 'available' inserted at the right spot would make all the difference in clarity here.
NooneAtAll3•4mo ago
imo "possible" would be better
tshaddox•4mo ago
I'd go with "legal," which also implies possible.
tromp•4mo ago
It's conceivable that the maximum number of plies (half-moves) you need is 218. The best known lower bound on needed number of plies is 185 for "Harry Goldsteen's furthest position" https://timkr.home.xs4all.nl/chess2/diary.htm So perhaps the hardest-to-reach position manages to improve on that by an additional 33 plies.
jwpapi•4mo ago
lol same here.

This is not so interesting then…

aqme28•4mo ago
I thought they meant that no game could go more than 218 moves. I can imagine some upper limit since three-fold repetition ends the game. But it’s a lot higher than 218.
hibikir•4mo ago
Another relevant rule is a draw after 50 moves without a capture or a pawn move. But yes, the maximum number of moves would be extremely large when both players are trying. Just think of a first 2 moved allowing the king out, an outrageous king march, followed by another pawn move...
hx8•4mo ago
I had the same confusion, until they showed the existing 218 position and realized it was about maximizing white's legal moves.
amenghra•4mo ago
The confusion is perhaps caused by the word “reachable”. “No legal chess position with more than 218 possible moves” would have been more clear imho.
NooneAtAll3•4mo ago
the word "possible" is missing
chankstein38•4mo ago
Thank you. I don't understand why people can't just explain what they're talking about before spending paragraphs talking about it. I thought this was like "After 218 moves there is no reachable chess position" which made no logical sense to me but I don't know enough about chess.
layman51•4mo ago
Oh, that makes more sense. That is an interesting thing to examine, but I wonder how useful it is. It reminds me of a tip I heard about improving at chess by actually counting all legal moves in a position so that you ensure you're not completely overlooking an option.
renewiltord•4mo ago
This is pretty cool. Would have been neat to see some descriptive text about encoding to integer programming problem.
Tobs40•4mo ago
Author here,

I considered but decided against the complexity, haha.

I added a Github link towards the bottom of the article though. Code might not be pretty though .__.

renewiltord•4mo ago
Haha yeah, I saw the code and it is pretty comprehensible but some things are curious. I thought some of the naming was amusing "ENABLE_ROYAL_CUDDLING" etc.

Thanks for the writeup.

Tobs40•4mo ago
Oh no, I forgot to rename that variable before publishing, haha
tromp•4mo ago
> There is no reachable chess position with more than 218 moves.

"no more than 218 possible next moves" would be a lot clearer...

> By checking all approximately 8.7x10^45 reachable chess positions?

That's a large overestimate.

https://github.com/tromp/ChessPositionRanking accurately estimates the number of legal chess positions at ~4.8x10^44.

XCSme•4mo ago
Isn't that estimate just 20x bigger? Which is not a big difference considering the magnitude.
nhumrich•4mo ago
One is "legal" the other is "total problem space" From a computing point of view, the total problem space is what matter because you still have to "compute" if it's legal or not before moving on. There isn't a straightforward way to only iterate over legal positions.
TZubiri•4mo ago
I'm not sure but I think the original utility and motivation for this mathematical puzzle is how to represent possible legal moves when programming chess, and this would be evidence that an 8bit unsigned integer is sufficient for the worst case scenario, although you would need some complex kind of encoding mechanism to make the representation terse enough to represent the common moves along with 7 promoted queens in the same 256-moves space.

Practically I think I'll stay with a fixed-length encoding for each of the starting pieces and their movements assuming maximum freedom, while adding a variable length variable in case of promotions.

Although nowadays with OOP and classes and superfast CPUs you probably have entirely variable length encodings, you know, an array of piece objects each with their own legal_moves function. But back in the day, when chess engines were written in C, these things were managed globally with all kinds of hack to save space, not due to space reasons, but to improve locality by reducing cache sizes.

For example, even though the chess board is 8x8, a common trick is to make the board 12x12 to account for knight moves that go off the board (and mark them as ilegal of course.) Which goes to show that even with efficiency as the upmost consideration, a terse representation is not ideal, so I doubt we are going to see 8bit variables to represent moves.

Scarblac•4mo ago
> although you would need some complex kind of encoding mechanism to make the representation terse enough to represent the common moves along with 7 promoted queens in the same 256-moves space.

If you have an algorithm for generating the list of legal moves in a position that always generates them in the same order, you can just use the index at which the move is in the list.

Of course that would come at the cost of speed (you always need to generate that list to know what move was made is meant).

TZubiri•4mo ago
>If you have an algorithm for generating the list of legal moves in a position that always generates them in the same order, you can just use the index at which the move is in the list.

Right, that's exactly what I'm saying, the algorithm that generates the list of legal moves would be an encoder (maps a move into an index), and the reverse would be a decoder (maps the index into a move).

You don't necessarily need to generate the list of legal moves, though. Consider a 16 bit encoding where the first 4 bits represent the piece moved, and the next 5 bits represent the direction, and the next 4 bits represent the distance and so on.

Tobs40•4mo ago
Author here,

my motiviation was intellectual curiosity and some random Lichess reading about chess engine authors wondering whether 8 bit e.g. numbers 0 to 255 (or 1 to 256), will be enough for storing the number of legal moves. Which triggered my brain: "I HAVE THE KNOWLEDGE TO SOLVET HIS FOR HUMANITY :O". It's not at all relevant practically, as you have elaborated, and there probably is a more elegant proof that 256 can't be exceeded.

margalabargala•4mo ago
Am I missing something, or is the configuration shown initially not actually reachable? It's white to move, yet the black pawns are in their starting location and the black king has no adjacent empty square, it's entombed by its pawns and the white bishop so the configuration could not have been reached.
KK7NIL•4mo ago
The black pawns are on white's side of the board.
margalabargala•4mo ago
That's what I missed. Thank you :-)
Eji1700•4mo ago
Proof is provided here for one of them: https://lichess.org/study/PLtuv3v5/zWPNxbSA

To be clear you're misunderstanding the position though. Black pawns are NOT in starting position. They've moved all the way across the board. Those are white pawn starting positions.

margalabargala•4mo ago
Yep that's what I was missing. Thank you for the link.
pmontra•4mo ago
How can a position with more than 9 white queens be legal? The limit seems to be one queen plus 8 promoted pawns.
codeulike•4mo ago
There are only 9 queens on the board
pmontra•4mo ago
The caption of the last diagram is "Legal but non-reachable position with 271 moves for White. Corner queens can be replaced with bishops." There are 24 white queens.
contravariant•4mo ago
That's the difference between illegal an unreachable. To reach that position you'd need to start from a different point (start both sides with 16 pawns or w/e), but you wouldn't need to break any other chess rules.
systoll•4mo ago
If you can start from any arbitrary different point, you can just start from the point you’re intending to reach, and don't need to break any other rules.

As per FIDE rule 3.10.3 "A position is illegal when it cannot have been reached by any series of legal moves". The position isn't legal per FIDE rules.

Beyond there being too many queens… black could not possibly have made the last move. For white to have any moves right now, the last move must have been black moving the king to H8. But G8, G7, H7 are all occupied, so where could the King have moved from?

zuminator•4mo ago
Legality is a long standing term of art used by chess problem creators. Essentially it means a position withtwo kings on the board, non touching, and not both in check. And no pawns on first or eighth ranks. It has nothing to do with whether the position is reachable from standard chess rules. Along came FIDE in 1999 with its standardized nomenclature but that doesn't invalidate the terminology used by chess problem creators in their own work.
systoll•4mo ago
I don't disbelieve you but… where?

I don't think I’ve ever heard it used like that, and in trying to find any example other than the page we’re commenting on, I’ve only found counterexamples.

Whether it’s wikipedia’s 'Glossary of Chess Problems' or OzProblems or 'Sam Loyd and his chess problems' from 1913, they’re all using 'legal' as synonymous with 'reachable'.

Bootvis•4mo ago
I understand this as follows:

Legal: doesn’t break the rules of chess. For example: no pawns on the eighth rank or in check when it’s not their turn.

Reachable: there is a series of moves that lead to this position from the standard starting position.

tromp•4mo ago
The phrasing "Legal but non-reachable " makes clear that they use some notion of legal that differs from the normal one of reachability. It's hard to imagine what sensible notion that could be though. Something like: each side having only one king, no pawns on first/last row, at most one king in check, etc ?!
amelius•4mo ago
What is the least number of bits that can describe any reachable chess board?

update: article says there are approximately 8.7x10^45 reachable chess positions and https://github.com/lechmazur/ChessCounter says this is an upper bound.

(this would correspond to about 153 bits)

cabirum•4mo ago
Piece type and color fit in 4 bits.

So, either a fixed-length encoding of the whole board, 64 * (4 bits) = 256 bits = 32 bytes.

Or, sparse variable length encoding of pieces only, 6 bits to index each of 64 squares, = 10 bits * piece count. E.g. initial position takes 32*10 = 320 bits or 40 bytes.

mcherm•4mo ago
That's a fine upper bound, but it doesn't minimize but usage since it also can represent illegal positions.
jfengel•4mo ago
The vast majority of the positions are illegal. There is only 1 black king on the board; practically all of the represented positions have more than one. And there are over a dozen kinds of pieces to repeat that for. A better upper bound is almost 100 orders of magnitude smaller.
mormegil•4mo ago
While this is an upper bound for a "board position", it should be noted that it is not an upper bound for a "game state". That includes the (unbounded) whole board position history because of the threefold repetition rule. If you ignore that (and the fifty-move rule which can alternatively be kept using a six-bit counter), you also need the castling state and the en passant state. Plus one bit of the player on move, obviously :-)
tromp•4mo ago
That's ceil(log2(~4.8x10^44)) = 149 bits. But to make it efficiently decodable you'd use the ceil(log2(8726713169886222032347729969256422370854716254)) = 153 bit representation of the ChessPositionRanking project linked to in my other comment. The ChessCounter project does not provide an efficiently decodable code.
LegionMammal978•4mo ago
The 8.7e45 "restricted" number in that repo rules out certain patterns of pawn promotions. It looks like the 5.68e50 "general" number is the true upper bound, allowing any promotions possible.
tromp•4mo ago
8726713169886222032347729969256422370854716254 is an unrestricted upper bound proven in the ChessPositionRanking project.
jcranmer•4mo ago
The king can reach any of 64 tiles. Rooks, queens, and knights can also do so, but they can also be captured, so 65 states for those 5 pieces. Bishops can only reach half of those tiles, so those two pieces get 33 states each. Pawns are interesting: they can promote into 4 pieces that each can move 64 tiles, they can be captured, or they can move into a somewhat variable number but 20-30ish positions as a pawn, or about 290 states per pawn. This means it takes 111.something bits to represent the board position of a color, or rounding up, 224 bits to represent the board positions of both black and white. En passant and castling restrictions don't add to the bit representations once you round up, since that's just 1 extra state for several pieces. That's probably the most compact representation for a fixed-size direct board representation.

For a sparse representation, note that both kings have to exist, so you can represent the live pieces with a base-10 number of n digits with n + 2 64-bit numbers representing piece position, and a little bit extra information for castling and en passant legality. If half the pieces are gone (a guesstimate for average number of pieces on the board), that amounts to about 180 bits for a board representation.

Move history requires about 10 bits per move (pair of white/black turns, with a ply of around 32 = 5 bits), which means you get to 18 moves, which appears to be somewhat shorter than the halfway point of an average chess game.

To be honest, it looks to me like getting more compact than the upper hundreds will require building impossibly large dictionaries.

p_zuckerman•4mo ago
Great article! Thanks for sharing
Tobs40•4mo ago
Thanks for appreciating my article ^__^
a3w•4mo ago
Blue is of course the color of math, his primary school is doing it wrong.
dooglius•4mo ago
I'm confused, what did he change after the 271-move model to get it to produce the optimal solutions? It just says "With this improved model"...
Tobs40•4mo ago
Author here!

Did you read the entire article?

It's 271.666... moves, not 271.0 :) This bound comes from model where whole decisions (0 or 1) are relaxed to continuous ones (0.0 to 1.0 and anything in between), e.g. a piece can only be 0.23 there and only be 0.843 able to make a particular move. The advantage of this black magic is that it is way faster to compute and only overestimates the number of moves - hence we can use that to prove away bad partial solutions. Without a technique of this kind, searching the solution space would be absolutely intractable!

dooglius•4mo ago
I did read the entire article yeah, and I was rounding down with "271", but it wasn't clear to me what change you made that got you to the finish line. Are you saying that the next improvement was to force Gurobi to use integer values? It's surprising to me that wouldn't kill performance since ILP is NP-hard whereas real LP can be solved in polynomial time.
salt4034•4mo ago
This part is unclear; what exactly did you change? Are you saying that the LP relaxation has value 271.666, but, when you enforce integrality, Gurobi can actually find and prove optimality of a solution with value 218?

Were you really just solving LPs up to this point in the article? How can these intermediate LPs be so slow to solve (6+ years) and yet Gurobi is able to solve the integer-restricted problem?

Tobs40•4mo ago
Ah, I see the misunderstanding.

I've always been solving the integer problem of course. But throughout the article, I improve the model formulation again and again through insights, which makes the LP relaxation tighter. Initially, it gave 305.0 as upper bound, but after tightening the model (addind constraints that cut off that 305 solution and others) it gives 271.666...

- which leads to insanely faster search. It's like brute-forcing through all passwords of length 20 and a wizard telling you that you're wrong when you reach character 7 instead of 13.

dbatten•4mo ago
Genuinely interested in being educated here: If Gurobi's integer programming solver didn't find a solution better than 218, is that a guarantee that there exists no solution better than 218? Is it equivalent to a mathematical proof?

(Let's assume, for the sake of argument, that there's no bugs in Gurobi's solver and no bugs in the author's implementation of the problem for Gurobi to solve.)

I guess I'm basically asking whether it's possible that Gurobi got trapped in a local maximum, or whether this can be considered a definitive universal solution.

salt4034•4mo ago
In addition to the value of the best integer solution found so far, Gurobi also provides a bound on the value of the best possible solution, computed using the linear relaxation of the problem, cutting planes and other techniques. So, assuming there are no bugs in the solver, this is truly the optimal solution.
dbatten•4mo ago
Unless I missed something, though, the highest bound the author reported for the relaxation was 271 2/3 moves, which is obviously significantly higher than 218...
salt4034•4mo ago
I think that was an intermediate model. The author updated it, then Gurobi solved the new model to optimality (i.e., the bound became equal to the value of the best solution found).

> With this improved model, I tried again and after ~23 000 seconds, Gurobi solved it to optimality!

dbatten•4mo ago
> Gurobi solved the new model to optimality (i.e., the bound became equal to the value of the best solution found).

Ah, I was not aware that that's what this language indicated. Thanks for helping me understand more!

I've used Gurobi (and other solvers) in the past, but always in situations where we just needed to find a solution that was way better than what we were going to find with, say, a heuristic... I've never needed to find a provably optimal solution...

hyperpape•4mo ago
The article was interesting, but this bit felt a bit like "and then a miracle occurred".
chipsrafferty•4mo ago
The fractional stuff was poorly explained, I didn't understand it at all.
nhumrich•4mo ago
In theory, it's not proof. In practice, it is.
sigbottle•4mo ago
Well, if the solver isn't wrong and there were no bugs in impl, yes, the approach is rigorous. Allow strictly more "powerful" configurations yet still prove that the maximum is X, then achieve X through a construction, is standard math
gregdeon•4mo ago
I'm not sure about Gurobi or how the author used it in this case. But in general, yes: these combinatorial solvers construct proof trees showing that, no matter how you assign the variables, you can't find a better solution. In simpler cases you can literally inspect the proof tree and check how it's reached a contradiction. I imagine the proof tree from this article would be an obscenely large object, but in principle you could inspect it here too.
Tobs40•4mo ago
Author here!

Yes, if Gurobi and my code run as intended and I did not mess up any thinking while simplifying my chess model, then what I did is proof that the maximum number of legal moves available in a chess position reachable by a sequence of legal moves from the starting position is 218 (upper and lower bound). Gurobi proved the entire search space as "at most as good" using bounds, basically.

jobigoud•4mo ago
The black pawn on b2 is eating a lot of possible moves for the other pieces…

It has only one legal move, take the Knight on c1. If that pawn wasn't there it would free that square for 4 white queens and a Knight. But of course the black king would already be in checkmate so these moves wouldn't really be available.

Tempting to put that e5 Queen elsewhere so that it doesn't immediately checkmate and leave the b2 square available for others.

edit: I imagine that pawn also needs to survive that far in order to avoid a stalemate.

tromp•4mo ago
The black b2 pawn has no moves in the position with white to move. If it were black's move, it would still have no moves since it is pinned by the white queen on e5. If it were not pinned it would have 4 moves, as it can also underpromote.
Scarblac•4mo ago
It's white to move. If black is in check with white to move, that makes the position illegal, and unreachable -- there's no possible legal move by black that led to this position where he is in check.

Replacing one of the black pawns by a white knight would add some moves, but there is no budget for that -- both knights are already on the board, and all pawns were promoted to queens. (And replacing both pawns would again make it impossible for black to have made the previous move)

NooneAtAll3•4mo ago
I was also confused about "black pieces are useless" as 2 white queens looking at each other can be replaced with 1 white and 1 black to add moves about eating each other - but then I realized it's simply "only 1 side can move"
Tobs40•4mo ago
Author here.

The position is White to move, so even if the b2 pawn was not pinned by a white queen to the black king, it could not move. The b2 pawn is necessary to shield the black king from checks as this position is White to move - otherwise it would be illegal.

Also, rest assured, I checked everything thoroughly. There is indeed no way to squeeze out more than 218 legal moves for White here, but it's fun to try and I'm glad that people actually care about my article, didn't expect that, haha ^^

NickC25•4mo ago
Just want to give Lichess a shoutout here. They are fantastic, provide great content, have things for free that you need to pay for on Chess.com, and a fantastic amount of variants.

Even better, the level of play in those variants, like 960 or Crazyhouse, is MUCH higher on Lichess than on Chess.com.

qsort•4mo ago
It's free, it has the same features as commercial servers, it's open source, developer-friendly, with no ads (not even on free accounts) and a transparent corporate structure under French law.

It's almost ridiculously good. Donate if you can!

andoando•4mo ago
And a nice API
tromp•4mo ago
Meanwhile, for the game of Go, as played on a standard 19x19 board, we have:

The maximum number of possible next moves is 361, which happens only in the initial empty position.

The 361 hardest-to-reach positions (assuming logical rules like [2]) are all the positions with 360 white stones and 1 empty point. these take 2*361 = 722 ply to reach, with black passing all their turns.

And these answers were found without checking all 208168199381979984699478633344862770286522453884530548425639456820927419612738015378525648451698519643907259916015628128546089888314427129715319317557736620397247064840935 legal positions :-) [1]

[1] https://tromp.github.io/go/legal.html

[2] https://tromp.github.io/go.html

mtremsal•4mo ago
Then white plays 1 stone, capturing all the black stones at once, essentially resetting the game with a 360 points lead.

(black goes first, white has Komi, so really a 260+komi points lead)

tromp•4mo ago
White cannot play on the last empty point as this would be suicide, which is prevented by the (assumed) superko rule forbidding repetition of the empty position.
GabrielBen•4mo ago
A game of Go can be legally infinite due to recaptures. (player passes 360 times, then eats the entire board and it starts over).

It's also a natural infinite game due to Kos which can be the best move to play. This requires a set of extra rules to prevent. (Ko, superKo, triple kos, etc)

tromp•4mo ago
I assume superko as is standard in several rulesets to prevent infinite play.
isagues•4mo ago
> I inserted this picture for the sole purpose of making this article look less text-heavy.

Taking care of the short attention span readers

Tobs40•4mo ago
Hi all,

a friend of mine pointed out that my article is being discussed in this forum. I am sorry for choosing a suboptimal title and I hope that it is unambiguous now. I am grateful for your feedback and kind words!

If you have any questions, also in regard to proving similar chess facts, I'd be happy to help ^^

Best regards, Tobi

randall•4mo ago
so just to be clear: for every board position there are no more than 218 moves available? is that the understanding?
Tobs40•4mo ago
It's your turn and you have 218 moves to choose from. This is the best possible and the article proves this (assuming no bugs in machine or mind).
cubefox•4mo ago
I interpreted this as: "There is no chess position which is only reachable in more than 218 consecutive moves"
quuxplusone•4mo ago
Lots of clarifications re what they mean by "number of moves"; but seems like they could productively have dropped the term "branching factor" in a couple places and thereby cleared the whole thing up.
Nevermark•4mo ago
I found a position that takes 78,352 moves and can't find a shorter combo. Both white bishops end up on dark squares. You have to castle at just the right moment. There is a race condition with a window far too narrow to be noticeable in any normal play, but a timing analysis uncovered it. There may be more.
xoroshiro•4mo ago
I guess the next low hanging fruit would be to prove (or disprove!) the same for chess960