Let’s call the coins C1, C2, G3, C4, and C5. The left edge of the board is E. A number shall represent the maximum number of squares a coin can move to the left until it is stopped by another coin on the left, or goes
off the board in case of the C1.
For example, if C1 is on the leftmost square, then E-C1=1; If there are 3 empty squares between C1 and C2, then C1-C2=3. Finally, let X designate an arbitrary number (several X-s in a position specification need not be equal to one another.)
Here is an example of a
key position, from which the player whose move it is shall lose, provided the opponent plays correctly:
E-C1=1, C1-C2=X, C2-G3=0, G3-C4=X, C4-C5=1.
Meaning, the first coin is on the leftmost square, second coin could be any number of squares to the right, gold coin is right next to it, then the fourth coin sits any number of squares to the right, and the fifth coin has exactly one vacant square between itself and the fourth coin. Or graphically: C.....CG..........C_C
Omitting the symbol on the left, e.g. C2 instead of C1-C2, the following is a table of some key positions:
C1 C2 G3 C4 C5
.1....X...0....X...1
.1....X...1....X...0
.1....X...2....X...3
.1....X...3....X...2
.1....X...4....X...5
.1....X...5....X...4
...........................
.2....X...0....X...2
.2....X...1....X...3
.2....X...2....X...0
.2....X...3....X...1
.2....X...4....X...6
.2....X...5....X...7
.2....X...6....X...4
...........................
.3....X...0....X...3
.3....X...1....X...2
.3....X...2....X...1
.3....X...3....X...0
.3....X...4....X...7
.3....X...5....X...6
..........................
If you convert numbers in the above table to binary and perform XOR operation between three numbers in each row, you will get zero every time. And that’s the formula for a key position!
How do we pick the intervals that count as opposed to those marked here with “X”? We just pair the coins starting from the rightmost. In this example C5-C4, G3-C2, and C1-E are the intervals that count. Why? A good explanation evades me at the moment. However, consider, for example, a key position 3..X..5..X..6. Let’s say, from that position the losing side moved C2 two spaces left resulting in 3..X..7..X..6. Now the winning side can restore 3..X..5..X..6 by moving G3 two spaces to the left.
The property of a key position is that you can never get another key position from it by a single move. The property of a non-key position is that you can always get a key position from it by a single move. The XOR operation magically works for the purpose of formally defining a key position.
The problem in the OP is subject to the same rule. It’s a special case, where only 4 coins are present and C2-G3 and C4-C5 are the only two intervals that count. Having equal number of spaces in those intervals XOR-s to zero.
Presently, I cannot invest an effort into formally proving that general formula. Feel free to prove or disprove it, as the case may be.