Compiling a list of openings

Tafl strategy
Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Fri Feb 17, 2017 3:13 am

Hagbard wrote:
Brench wrote:I was interested in maybe using some moderately advanced statistical techniques to cluster similar openings from the game archives and assign win probabilities to each opening.
I extracted the first four moves from all games between strong players for the most used variants:
http://aagenielsen.dk/tafl_openings.txt

Hope it can be of use.
That's actually incredibly helpful. I'm going to write some python code tonight to turn these into feature vectors for clustering them.

We should be able to identify openings, variations, optimal board positions for each side.

Thanks so much!

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Sat Feb 18, 2017 6:31 am

Update: So I clustered the all the Copenhagen Hnefatafl games and identified a large number of clusters with very similar board positions at the end of the first four moves. This required that I turn each move sequence into a representation of board positions and correct for boards that are rotated or reflected from the most similar position.

There are many different kinds of clusters with distinct win probabilities. The largest cluster has a small bias toward white (defenders), with a 57% win likelihood for that position. But there are some extremal board positions where either black almost always wins or white almost always wins. For example, consider the average board posiition shown in the attached figure. The light blue squares are empty squares, dark blue are the average positions of the attackers in this cluster. Yellow squares are defenders and red the King. The more intense a color, the more significant a given position is (the more often a piece is in that position in that clusters examined). So the greenish squares are squares that defenders show up in, but not very often.
Interestingly, black (attackers) is very reliably in all the positions shown for a winning configuration.

The configuration shown has a win percentage for black of 70% of the time. This configuration only occurred in about 10 of the games in the entire set but the result is strongly significant.

Image

Obviously there are a lot of examples to illustrate. This might make for a good book, once complete and validated.
Last edited by Brench on Sat Feb 18, 2017 3:42 pm, edited 2 times in total.

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Sat Feb 18, 2017 6:34 am

I'll try and get the most common confgurations up, as well as a few interesting ones.

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Sun Feb 19, 2017 4:07 am

Here's the "family" of openings corresponding to the cluster above. Note that many begin in different portions of the board bu are "similar" based on the symmetry of the board.

h11-h9/f4-c4/h1-h3/e5-b5/
h11-h9/f4-c4/h1-h3/e5-e3/
a8-c8/h6-h3/k8-i8/g5-i5/
h11-h9/f4-c4/h1-h3/e5-e2/
a8-c8/h6-h3/k8-i8/g5-j5/
h11-h9/f4-c4/h1-h3/e5-e3/
h11-h9/f4-c4/h1-h3/e5-b5/
d1-d3/g7-g9/d11-d9/f8-c8/
d1-d3/f8-i8/d11-d9/g7-g9/

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Sun Feb 19, 2017 4:27 am

And here's the largest cluster, about 47% of examined records fit into the cluster. That makes sense, it's close to balanced, with white having about a 57% chance of winning when the board is close to this configuration. Still, it does offer a small advantage to white and may be worth pursuing from white's perspective.

(again, intensity of the color indicates the frequency with which the square is occupied in this opening pattern)

Image


A sampling of 10 openings that fit this board pattern:

h1-h3/g5-g2/f2-c2/g6-g3/
d11-d9/f8-c8/k8-i8/e7-e10/
a4-c4/e5-b5/b6-b9/f5-c5/
d11-d9/e7-e10/f10-i10/e6-e9/
h1-h3/f4-i4/k8-i8/i4-i1/
k8-i8/g7-j7/j6-j3/h6-h9/
h1-h3/h6-h9/d11-d9/f8-i8/
k8-i8/h6-h9/h11-h10/h9-k9/
h1-h3/g7-g9/h11-h9/g9-f9/
k8-i8/g7-j7/j6-j3/h6-h9/

There are obviously many, many more openings that fit this pattern.

User avatar
Hagbard
Posts: 707
Joined: Sat Mar 14, 2015 6:07 pm
Location: Copenhagen
Contact:

Re: Compiling a list of openings

Post by Hagbard » Mon Feb 20, 2017 6:56 am

Brench wrote:And here's the largest cluster, about 47% of examined records fit into the cluster.
So the diagram shows that d1-d3 is the most winning opening move of Copenhagen Hnefatafl 11x11?
And the two most successfull answers are e5-e2 and f4-c4?
And the most used and successful third move is f2-i2 (probably linked to e5-e2)?

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Wed Feb 22, 2017 6:45 am

Hagbard wrote:
Brench wrote:And here's the largest cluster, about 47% of examined records fit into the cluster.
So the diagram shows that d1-d3 is the most winning opening move of Copenhagen Hnefatafl 11x11?
And the two most successfull answers are e5-e2 and f4-c4?
And the most used and successful third move is f2-i2 (probably linked to e5-e2)?
That's one way to look at it and will *usually* be the case, but I think a safer approach is to look at the board positions shown as a "target". The closer you get to a displayed position the more likely you are to fall insider the class of openings corresponding to the winning percentage you are aiming for.

For the record, I've changed the displays in my diagram to show *only* significant positions. So if you hit on most or all of the displayed positions by move 4 you are in pretty good shape.

Consider this:

Image

This is the average board position of opening cluster 142. It only shows 3 moves, however, 2 for the attackers and 1 for the defenders. It doesn't care, really, where you put the 4th move (for the defender). The class allows for multiple *variations* with that 4th position. They are spread out enough around the board that they don't show up as statistically associated with a single position and therefore don't show up in the image.

User avatar
Hagbard
Posts: 707
Joined: Sat Mar 14, 2015 6:07 pm
Location: Copenhagen
Contact:

Re: Compiling a list of openings

Post by Hagbard » Wed Feb 22, 2017 6:40 pm

Received a first analysis, to be read here:

http://aagenielsen.dk/openings_version_1.pdf

Brench writes:
This is still somewhat preliminary. I can probably do a better job clustering the data and I will expand the writeup as time goes on to better explain how to use the document. For now I think I'll elaborate on it in the forum and incorporate changes in the document based on feedback there.

User avatar
Hagbard
Posts: 707
Joined: Sat Mar 14, 2015 6:07 pm
Location: Copenhagen
Contact:

Re: Compiling a list of openings

Post by Hagbard » Wed Feb 22, 2017 6:48 pm

Brench wrote:This is still somewhat preliminary.
Do the diagrams show, which is the most winning start move? And the most winning answer to that? And the most winning answer to the answer etc.?

Brench
Posts: 19
Joined: Sat Feb 11, 2017 7:14 am

Re: Compiling a list of openings

Post by Brench » Wed Feb 22, 2017 8:23 pm

Hagbard wrote:
Brench wrote:This is still somewhat preliminary.
Do the diagrams show, which is the most winning start move? And the most winning answer to that? And the most winning answer to the answer etc.?
You can definitely extract the best first move from what I've compiled...look at the document at http://aagenielsen.dk/openings_version_1.pdf
and examine the "win probability" for each cluster. Then examine the most similar cluster. You will be able to use that to get very close to the response move with the best win probability for a given initial move. That will get complicated fast though...


But, we can do better than that. To get a list of the "best answers" and display that will require me to reorganize the data into a "tree". So given h1-h3 for example there would be a number of branches under that, each with win probabilities *given* the probability of that first move.

I have enough data to do that...it will just take some time to write the code. So I'll focus on that next. When done, We'll have a tree of responses for each of the first four moves...

Post Reply