Random Opening Generator

This is a tool I made, based on an idea from Jonas Welticke, to generate random positions that are balanced according to KataGo:
image

Try it yourself here!

  1. Generate a random position
  2. Set up the position together with your opponent, on a physical board or online
  3. Play a normal game of go, with black going first and standard komi (6.5 for Japanese rules, 7.0 for Chinese rules)

Every generated position has been evaluated by KataGo as being within ±0.5 points of even.

If you want to play on OGS you can use these links instead to save you some clicks:

Simply open the corresponding review, scroll down to a random position in the game tree, and click “Fork game” in the sidebar to create a challenge.

What is the point of this variant?

This “Random Opening” variant is similar in spirit to Chess960. It forces the players to rely less on opening and joseki knowledge, and instead come up with their own ideas from move one! It also allows us to explore unusual shapes that would otherwise never occur naturally.

It’s a very “minimal” variant: no changes are made to any of the rules, allowing you to play this variant directly today on any go server, as long as you pre-agree to the opening together with your opponent.

How to play with handicap?

You can use the positions together with free handicap placement. For example, to play a 3-stone handicap game:

  1. Set up one of the positions as usual, but with a komi of 0.
  2. White passes the first 2 moves after the setup, allowing black to make 3 moves in a row.

Hope you enjoy this variant! Feel free to share any games you play in this thread.

The code is available on GitHub.

26 Likes

The KPMC did something like this in pairgo, but rather than check with Katago if it was even they randomly generated moves and mirrored them for the opponent.

The idea was the same though, to break up the opening theory.


Being able to fork the games seems handy :slight_smile:

4 Likes

of course :grin:

Was thinking about something like this once I found out about Chess960 :laughing:

2 Likes

This is incredible. I have thought about a balanced game underway variant before, so to see it be constructed is a doozy. I had often felt that cross fuseki (with flexibility of starts) should be considered as a way to break up any monotony. So I do wonder if we get to see that here.

2 Likes

If someone wants to challenge me with

  • 19x19, 16 moves or 24 moves
  • Fischer 3d+1d, up to 3d

feel free to do so.

4 Likes

Streamed this game on twitch: Random Opening

Hope this tool gets more attention!

3 Likes

This is a development of a unique feature of go. We can have many fair evaluated starting positions which is hard to find in other games. Delightful.

5 Likes

If we could Link to a variation?
then it would be cool to have not just the button “download SGF”, but also “open in OGS”

When the about page says “The script that generates the positions is very simple: it selects positions at random”, does “positions” here mean moves? After looking at the code I could understand the algorithm, but the description was confusing to me

To generate a position, the moves are played one at a time, with each unoccupied intersection being equally likely (more explicitly, random intersections are tried until an empty one is found).

So for instance if we are generating a 9x9 position with 4 moves, then all the


different possible placements of 2 black and 2 white stones are equally likely. (I have not built in any special handling to exclude positions where stones get captured, or where one of the moves is suicidal. So far I haven’t seen such a case occur, it would be quite rare!)

Edit: Ah now I see that you already understood the algorithm, I misread at first. Yes my wording there is perhaps confusing, I’ll try to improve that description later.

3 Likes

Can this be used as a package in other projects? Would be neat to use this to add a random starting position variant in a certain go variants server project :smile:

Really cool tool! :heart: :tada:

4 Likes

Roughly copying also what I commented at reddit:

One interesting thing is that KataGo actually trains a small fraction of its games starting from positions with random placements but where first line placements are downweighted by a factor of 20 and second line is downweighted by a factor of 4.

It also means KataGo has direct experience with a lot of positions generated with that kind of weighting, so that if you match that weighting then it’s not entirely just guessing when evaluating those positions for who is ahead.

6 Likes

I would assume that even if I don’t match the weighting, these purely random positions (especially the ones with not too many stones) should be somewhat familiar to the network, right? (since it has sometimes seen first-line moves in training)

Overall I am not so worried about KataGo being slightly inaccurate because of unfamiliarity, because I think we human players will be even worse :grin: So the outcome of a given game, even between strong players, is much more likely to be decided by the players’ mistakes, than by the game-theoretic value of the initial position.

But still I am curious about how strong KataGo is in these slightly out-of-distribution positions. I’ve played out some example games with it while playing around with the position generation, and it leads to some very interesting sequences and shapes that would never come up normally!

2 Likes

If the first line stones are separated a bit, then yeah I would expect it to generalize just fine. Cases where there are multiple first line stones in close proximity along with second line stones, mixed between both colors would probably be a little less familiar, since those are going to be far rarer and in that case you’re more likely going off of (still likely pretty reasonable) neural network extrapolation rather than direct experience.

(But anyways, the fact that there is random-stone training like this at all probably does mean that KataGo has orders of magnitude more familiarity generally with “weird” random-like stones in the opening than human players do).

2 Likes

This could be a nice option in the tool, so that the positions are more realistic and interesting (though still random) as first-line moves are just weird.

1 Like

I think this post of yours could just be copy pasted to the website, honestly. It seems to explain it quite clearly

If you want to add such a feature, feel free to use the generated sgf-files!

1 Like

That seems very useful and intriguing! Well done :slight_smile:

4 Likes

Thank you very much. This is very awesome!
If anyone wants to play, please hit me up :slight_smile:

3 Likes