[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

BGonline.org Forums

[Hyper 04] Perfect play

Posted By: Tom Keith
Date: Monday, 9 July 2018, at 2:07 p.m.

This is the fourth in a series of posts that I am writing about the game of hypergammon. (The previous posts are [Hyper 01], [Hyper 02], and [Hyper 03].)

The Hard-to-Reach Position

The following position is one of the hardest to reach in hypergammon.

A hard-to-reach postition

In [Hyper03], I put out a challenge to find a sequence of rolls and plays that navigate from the hypergammon starting position to the position above in the fewest rolls possible. Here is one solution to that challenge:

Start

    Black   White
1.   6-5:  24/18, 23/18 6-6:  24/12, 22/10
2.   6-6:  22/10, 18/12(2) 4-2:  12/6
3.   6-6:  12/6(2), 10/4, 6/off 2-2:  23/21*/19*/15
4.   5-1:  bar/24, bar/20 5-5:  15/5*, 10/off
5.   5-5:  bar/20*/15, 24/19*/14 6-6:  bar/13(2)
6.   6-4:  15/9, 14/10 4-3:  13/10, 13/9
7.   2-1:  10/8, 9/8 2-1:  10/8, 9/8

Finish

Perfect Backgammon

Nobody knows how to play perfect backgammon. The bots play a very strong game — as strong as anyone — but they make their share of mistakes. And there are some backgammon positions (quite a lot, actually) where the bots have no clue whatsoever. It will probably be several decades before backgammon is completely solved.

Not the case with hypergammon. Hypergammon has relatively few positions compared with backgammon (7,959,904 versus 18,528,584,051,601,162,496). That means it is possible to write a computer program to play perfectly. In fact, Hugh Sconyers was the first to do it in 1991.

Creating a Hypergammon Bot

A program for solving hypergammon works by maintaining a large table of equities with one entry for each position. The goal is to calculate the equities of all 7,959,904 positions.

The first step is to identify the “terminal” positions.

Terminal positions. A terminal position is a position where one side or the other has all their checkers borne off. When you reach a terminal position, the game is over.

Calculating the equity of a terminal position is easy. First check to see which side won. Then check to see if they won a single game, gammon, or backgammon. The equity of that position then is −1, −2, or −3 (if the player on-roll lost) or +1, +2, or +3 (if the player on-roll won).

Nonterminal positions. Calculating the equities of the other positions is not as easy because each of those positions depends on the equities of other positions. As we saw in [Hyper 01], it is possible to get into a cycle where, for example, one position depends on another that depends on another that depends on the first position. Somehow, we have to resolve these cycles.

It turns out this is not an insurmountable problem. Every game of hypergammon ends and ultimately the equity of every position depends on the equities of the terminal positions.

To start the process of solving the equities, we give each nonterminal position an arbitrary value for its equity. Zero is a good arbitrary value because it’s roughly an average equity.

Then we progressively refine the equities, nudging them closer and closer to their true values. To do this, we go position-by-position through the table and recalculate each position’s equity:

  • For each of the 21 possible rolls, figure out the best way to play that roll. There are typically several ways to play a roll, so we find the best play by looking at the equities of the resulting positions stored in the table. Then choose the play that yields the highest equity.

  • Take a weighted average of the 21 rolls. That average is then stored in the table, replacing the previous equity we had for the position.

This procedure might seem suspect. If we start with garbage (all those zeros), how can we expect to come out with a useful value? But it actually does work.

If we repeat the procedure enough times, continually refining the equities over and over again, the values of the terminal positions purcolate up and play their part in determining the equities of the other positions. Eventually all the equities in the table reach a steady state. (It takes about 150 iterations or so on my computer.) At that point, the equities in the table are consistent with one another and we have solved cubeless hypergammon.

Knowing the equity of any position is all you need to play perfectly: When presented with a choice of what play to make, simply choose the play that gives the you the highest equity. No other strategy does better.

Now that we have a bot that plays a perfect game, we can investigate some interesting properties of cubeless hypergammon. Here are three fun questions:

  1. What is the best roll you can throw in cubeless hypergammon? (What position and roll give you the biggest increase in equity?)

  2. What is the worst roll you can throw in cubeless hypergammon?

  3. What is the biggest error you can make in cubeless hypergammon? (What position and roll have the biggest difference between best and worst play?)

Messages In This Thread

 

Post Response

Your Name:
Your E-Mail Address:
Subject:
Message:

If necessary, enter your password below:

Password:

 

 

[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

BGonline.org Forums is maintained by Stick with WebBBS 5.12.