Source: wu riddles
Ok, let's add a fourth opinion ;-) Please note that this is not trying to cover each and every line of play. Also, I should mention that this came to me while trying to figure out why @Gareth's solution does not work.
White has two ways of winning
- promote their g pawn before black's d pawn or
- trade the two pawns with enough of a head start towards the a file to win by capturing the black pawn there and not being trapped in front of their own pawn or letting the black king in
Neither can on its own be enforced, see for example @TACO's counter to @nadapez's attempt to win with strategy (1) alone. Instead, both white and black should remain ambiguous about their strategy until the other side slips up.
What is enough of a head start in (2)? Let's for the sake of argument relocate the white king to g6 and the black king to e7. Interestingly, this is
a zugzwang position. Black to move loses while white to move must settle for a draw. Indeed, the black king and pawn are placed "optimally" in that white queening on g8 would do so without check and the white king has no direct path to capture the black d pawn but would have to waste a crucial tempo going via e4-d5. Similarly, the white g pawn is placed far out of the black king's reach and the white king's position is perfect to react to what black chooses to do. If black moves their king to e6 to support the d pawn white has g5 ... Kh7 and wins as the g pawn is promoted with check.
Now let us look at a longer variation if black chooses to go after the g pawn instead 1. ... d5 2.Kf5 Kf7 3.Ke5 Kg6 4.Kxd5 Kg5 5.Kc5 Kxg4 and white has just enough time to eat black's last pawn and safely promote their own.
If instead white had to make the first move and for example advanced their g pawn that would hand black the one tempo they need to draw. 1.g5 d5 2.Kf5 Kf7 3.Ke5 Kg6 4.Kxd5 Kxg5 5.Kc5 Kf5 6.Kb5 Ke6 7.Kxa5 Kd7 8.Kb6 Kc8 and the black king arrives just in the nick of time.
So in order for white to win they cannot move their king directly to
g6 because that would allow black to answer with Ke7 putting white in the zugzwang position. Nor should the g pawn move before it is clear it is racing against the black d pawn. The ambiguous and I think correct move would therefore be 1.Kg5.
There are, of course, lots of variarions left to check. And given how tightly blanced the position is they should be checked but that would still be tedious. I do think we have covered the key ideas and can leave the nitty-gritty to a computer (as I did to check this answer is broadly correct).
[NOTE: After writing this, I checked with a computer. The following is wrong. I shall not say how it is wrong, of course. Nor shall I delete it, because I believe in not hiding my errors.]
It looks to me as if
White wins with 1. Kg6. The idea is to win the d-pawn while stopping Black getting to the g-pawn too quickly. Then while Black is tied up with the g-pawn White has time to get over to the queenside, capture the Black a-pawn, and promote the White a-pawn.
Something like this:
1. Kg6 Kf8; 2. Kf6 d5; 3. Ke5 Kg7; 4. Kxd5 Kg6; 5. Kc5 Kg5; 6. Kb5 Kxg4; 7. Kxa5 Kf5; 8. Kb6 and at this point it's clear that Black can't get the BK to the queenside quickly enough to capture the a-pawn, or block it, or confine the WK to the a-file.
It's not much better
for Black to play 1. ... d5; 2. Kf5 Kf7; 3. Ke5 Kg6; 4. Kxd5 Kg5; 5. Kc5 Kxg4; 6. Kb5 Kf5; 7. Kxa5 Ke5; 8. Kb6 and although B is one move quicker here it's not enough.
Black tries to stop W winning the d-pawn with 1. ... Ke7, then it doesn't look as if White can win with 2. Kh7 -- both pawns will promote, and the resulting position looks drawn. So instead 2. g5. Now there seem to be three things Black could try.
if ... Kf8 to stop the g-pawn then W plays Kf6 Kxd6 Kc5 Kb5 Kxa5 and B plays Kg8 Kg7 Kg6 Kxg5 Kf5; W is too quick. So this is no good for Black.
if ... d5 then Kf5; then presumably ... Kf7; Ke5 Kg6; Kxd5 Kxg5; Kc5 Kf5; Kb5 Ke5; Kxa5 Kd5; Kb6 and White is just quick enough.
if ... Ke6 to make the d-pawn safe then Kh7 and now White is quick enough with the g-pawn: d5; g6 d4; g7 d3; g8=Q+ and the d-pawn can't survive.
The optimal move here is to
prevent the promotion of black's open pawn.
One example of this can be done
in 5 moves: g5, Kg4, Kf3, Ke3, Kxd2.
During this black may shift focus to
either free their blocked pawn, or capture white's open pawn.
we must prevent promotion and either bring the match to a stalemate or if we should be so lucky, promote our pawns after preventing promotion, and take the game with a checkmate from two queens.
If white can
prevent the open pawn's promotion, it can also attempt to capture the blocked pawn, thus potentially opening their options back up to two promoted pieces which heavily increases their chance of winning.
But what about
promoting white's open pawn? This can be done by protecting it's route with the king traveling in the H file.
This can be prevented by
black in two moves. If white starts with Kh6, black plays Kf7. From here white has two options; Kh7 or g5. Playing g5 will break white's plan allowing black to play Kg8 and playing Kh7 leaves white's pawn open if black plays Kf6 on their next turn. However, if white starts with g5 then black simply plays Kf8 followed by Kg8 unobstructed, regardless of white's next move.
after @Gareth McCaughan pointed out in a comment that an online chess engine could solve it in seconds, I went to test the idea with Next Chess Move and it aligned with my idea (albeit taking a bit longer and a different route due to black playing its strongest next moves each turn) by capturing pawns. I won't chase the end game down as it will take a minimum of 15 more moves since black is about to capture white's open pawn while white is closing in on black's blocked pawn and white will have to force the black king to move around which can be agonizing.
Key to this position is to keep black far enough from the g-pawn to be able to capture both black pawns and promote the a-pawn.
To do that it is essential to move Kg6 as soon as black moves Ke7
Main variant: Kg5! Kf7; Kf5 Ke7; Kg6! Ke6*; g5 d5; Kh7 and the promotion is on time because of the check
* All other moves allow white to threaten the d pawn with:
d5; Kf5 and Ke5 or Ke4 as soon as possible
K?; Kf6 and Ke6 or Ke5 as soon as possible
If defended: promote the g-pawn and if left undefended: capture the pawns in time