r/baduk 3 dan 3d ago

Generate random openings that are balanced according to KataGo

https://random-go.antontobi.com/
52 Upvotes

33 comments sorted by

13

u/le_4TC 3 dan 3d ago

This is a tool I made to generate random balanced opening positions!

How to play:

  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)

For more information, see this thread: https://forums.online-go.com/t/random-opening-generator/56079

2

u/kenshinero 2d ago

Play a normal game of go, with black going first and standard komi (6.5 for Japanese rules, 7.0 for Chinese rules)

Why is Chinese komi 7.0 and not the usual 7.5?

1

u/JesstForFun 6 kyu 2d ago

They seem to be going for the fairest possible komi according to AI. 7.0 produces the most balanced winrates in the starting position for Chinese rules. 6.5 does for Japanese rules.

1

u/le_4TC 3 dan 2d ago

Good question! I wanted the same positions to work both for Chinese rules and Japanese rules, and for that there needs to be a 0.5 point difference between the two komi values. You can of course still play with 7.5 komi: white is then sligthly favored, but only to the same extent that white is favored from the empty board with 7.5 komi.

13

u/Everlance 4k 3d ago

GO version of Fischer random chess, Nice!!

9

u/mirco_nanni 4 kyu 3d ago

Very cool, indeed.

Since some positions look rather unnatural to me -- rather than just uncommon --, it would be nice to have some control on the craziness tolerance of placements. Two ideas that came to my mind:

  1. (easy) Give placements fixed probabilities that are not uniform. For instance, 1-line placements might be low-probability. Maybe probability should (slightly) decrease the farther they are from hoshi points?

  2. (more complex?) Ask KataGo the K (e.g. K=100) best moves and choose randomly from them. My guess is that even for K=300 you would get rid of crazy-impossible placements.

What do you think?

Thanks for sharing it!

7

u/icosaplex 2d 3d ago

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. Goes a long way to reducing the craziness while still having a few second line moves and occasional first line moves.

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. :)

5

u/le_4TC 3 dan 3d ago

Yes, I will add some other types of positions later! I already played around a bit with completely disallowing stones on the first line and stones touching each other, so that would probably be my next choice. I also like your second idea, might try some version of that!

4

u/anadosami 4 kyu 3d ago

This is super interesting! The 24-move positions would really test your ability to handle weak stones/groups.

How do you generate these positions? Do you do a brute-force random search until you find a close position? Or are you doing something more clever?

9

u/le_4TC 3 dan 3d ago

It is indeed just trying random positions until a close one is found! Luckily they are not so rare: if black and white both make random moves, on average the moves will be equally bad. So the evaluation will roughly follow a normal distribution centered on equal positions.

The one optimization I do is that after generating a position, I first search it at 4 visits, then 16 visits, then 64, then 256. If any of the evaluations are more than 0.3 points away from equal, the position is discarded. This helps to avoid wasting time searching lopsided positions deeply. Also, by making sure that the evaluation stays stable as visits increase, we decrease the chance that the evaluation relies on finding some narrow tactical line.

You can check out the full sgf generation code here: https://github.com/antonTobi/random-go

1

u/socontroversialyetso 5 kyu 3d ago

You could already do that with KataGo as is, though?

The problem is that it has limited utility for actual games, as most of the moves will be random. Only thing to take away from positions like this is propably an aneurysm lol

1

u/le_4TC 3 dan 3d ago

Yes it's easy to find more positions like this yourself! This tool is meant to streamline the process of generating new positions, for those that want to try out the variant at their club or online.

The more random moves you generate, the less similar the opening is to regular go. It's definitely not for everyone, but some of us like this kind of crazyness :D

1

u/socontroversialyetso 5 kyu 3d ago

You're right, it's a fun tool. But if there was an easy way of generating pseudo random positions resembling 'normal' opening play, it would be vastly more useful :)

3

u/anadosami 4 kyu 3d ago

I think part of the point here is to play from positions that don't resemble normal opening play, but which are still equal.

4

u/MindfulSailor 3d ago

Very cool! I will definitely try this.

Some ideas for options that you could add:

  • Prevent moves on the first (+second) line
  • prevent same/opposite color stones touching each other
  • maybe even a minimum distance around each stone? :D

3

u/le_4TC 3 dan 3d ago

Yes, I will add some options like this eventually! I decided to stick to the pure random variant for the initial release, but I already have a couple different ideas for other options people might like. Aside from the ones you mentioned, I think it could be fun for instance to play from positions that are just a bunch of crosscuts :D

3

u/Riokaii 3 kyu 3d ago

Id also suggest require equal # of moves in each quadrant of the board as an optional toggleable rule.

4

u/tuerda 3 dan 3d ago

I am going to try this a bit. Will report back soon. My expectation is that I am going to be quite bad at it.

6

u/tuerda 3 dan 3d ago

Update 1:

Observation 1: It probably is never necessary to request 16 or 24 moves. We did 8. We are at least 60 moves in and the position still has not settled into anything that feels familiar. Lots of very funky shapes.

Observation 2: Bumping the board was bad. Even though the number of stones added was small, it was still hard to remember where they were with much certainty. For some of them the exact location had tactical implications which made it easier to remember. but even at this stage, I am still not sure I remember all of them.

Observation 3: I _really_ felt like I had no idea what I was doing at the start. Difference in go skill vs my opponent is clearly still there, but it took quite some time to be felt in the position.

More to come.

6

u/tuerda 3 dan 3d ago

Update 2. First game finished. Observations 1, 2 and 3 are all valid. One more thing I noticed is that some of the positions being locally unfamiliar led to some misreads. I expected a lot of the difficulty would be in positional judgment, but that was not all. Some of the tactics, while still normal go tactics, were ones that I just don't see so often, so things went slightly sideways.

This was fun. I will definitely do it again, but not right now.

3

u/niemand__yt 5 kyu 3d ago

really usefull, thx! If you have the time, you could also do a quiz game with these positions. Find the blue move is really tricky with these 24 move positions. With a score wich his higher the lower the point loss :)

3

u/Asdfguy87 3d ago

That's really cool!

3

u/Maxaraxa 9 kyu 3d ago

Awesome idea, love having something fresh to try

3

u/carljohanr 4d 3d ago

Great idea and clean execution! Looks hard even at 8 stones :)

Would you consider adding an option for random moves that are also considered good moves individually by KataGo (eg no mistakes greater than 2 points leading up to the position)?

I also thought about an option to prioritize high/low moves in similar way that could replicate a particular style of player.

4

u/busseroverflow 10 kyu 3d ago

Very cool idea!

Do you think this could be easily extended to generate random handicap positions? Could we find random placements of black stones that result in a lead equivalent to N handicap stones placed at the traditional positions?

2

u/le_4TC 3 dan 3d ago

That's certainly possible! I decided not to generate any handicap positions for now, because I'm not sure what would be the best way to do it. To make a 3 stone handicap, all the following seem like reasonable options:

- Place 3 black stones randomly, no white stones.

- Place 3 black stones and 2 white stones (if white plays first like in regular handicap games, this will give the same stone counts as if the game was played normally, but by placing white stones less efficiently we could make it a handicap position)

- Place 6 black stones and 3 white stones, to have a mix where both players have useful stones, but black has the numerical advantage

The KataGo evaluation is a bit less useful in positions where black has a large lead, but if we picked positions with similar score/winrate as a standard handicap position they would probably be roughly what we are looking for.

In the meantime I think a good option to make any random balanced position into a N-handicap position is to let white pass the first (N-1) moves, so that black gets N moves in a row.

2

u/busseroverflow 10 kyu 3d ago

Great ideas!

Another one would be to use Katago to determine how many points black leads by with N stones in the traditional placements, and then place M black stones randomly until we get to the same point lead. That way the whole “we’re N ranks apart so N stones of handicap is fair” still works, even if in the end it’s not N but M black stones on the board.

2

u/mr2cef 5 kyu 3d ago

How cool is that? 🤩

2

u/LocalExistence 3 kyu 3d ago

Fascinating! If you're doing requests, it'd be cool to select for positions where there are a numerous decent moves - my (admittedly unverified) guess is that some of the positions where black and white starts attached are pretty narrow in that any move except responding to the attachment loses a lot. But others again seem like there should be many plausible moves.

2

u/carljohanr 4d 3d ago

Why did you decide to still keep the komi if you are anyway generating a random position? Seems like it's cleaner without komi (or 0.5 as tiebreaker if you want to avoid draws)

2

u/le_4TC 3 dan 3d ago

I also like the idea of playing without komi, and I did play around with generating some of those. I ended up going with standard komi since it allows to play on any server (even if you don't have the option to modify komi), and maybe for OTB play it's a slight advantage that you can continue playing with the komi you're most used to. I wanted to keep the interface simple for this initial release, but I might add some no-komi options later!

2

u/cbr 3d ago

Alternatively:

  1. Create completely random openings without regard for balance
  2. Have players bid komi to choose sides

1

u/Riokaii 3 kyu 3d ago

One other idea for something like this is instead of discarding lopsided positions, use them as " A or B" quiz material where you are presented with 2 boards and must pick the one that is uneven and which direction it is uneven.

This would be a way to "test" opening conceptual evaluation