The process of making Gosuji - A new way of improving your Go skills, through the power of AI

 Prologue

The Game of Go

Go is the oldest board game still played till this day. And for good reason, it has simple rules yet vast strategic concepts and an elegance and aesthetic to match!

Blue Ruin 1, 2010, https://www.flickr.com/photos/blue_ruin_1/5162970056 

But with the advancements in AI, what does it take to become good in this day and age? What can you do to be ahead of the curve?

Conventional Reviewing

In the world of Go, reviewing is a practice done after playing a match to review your moves and learn from your mistakes. This can be done with the person you played the game against, a friend that is better than you or even a Go teacher. But nowadays there's another option: Go AI. It can show you how good, or more likely bad, your move was, and what you could have played instead. 

Sometimes when I look at my game with AI, I get caught up in an interesting move. Something I would never think of myself, yet the AI sees it as common sense.

Most people just look at their biggest mistakes. Things any strong human player could easily point out as well. With this strategy, the subtle yet interesting moves from the AI get lost. It's still a good strategy, but not for me. I ended up quickly going over my mistakes and then looking at my real interest, what creative ways to solve smaller problems the AI came up this time.

Over time I noticed that it was easier to just look at games the AI played against itself. After a while I noticed something interesting. My intuition in my own games was changing. I started thinking a bit like the AI!

Soon after I realized why the conventional use of AI in Go didn't have this effect much. Most people just want to see the highlights of a game after playing it. The details of each move were more important during the game. They might not even remember the exact thought process that made them pick each move anymore.

But what if you got told the best move right after making yours?

Live Feedback

It is well known that to learn, you have to know the consequences of your actions. Preferably even what actions would have been better. And the sooner you get this information, the easier it is to correlate and remember.

This is what live feedback would improve. You play a move and you get feedback on it right then and there. No waiting until the end of the game, or the evening you played the game, or maybe the day after?

But how would live feedback even work? You can't just look at AI while your playing a regular match, that's cheating! A platform where you both get AI? The Go community is small enough as is, it will be hard to find people to play against.

Moreover, playing against real players makes people too competitive. You might know what the AI would play in a certain scenario, but do you really want to experiment with new moves right now? Or would you rather go with your comfortable own style so you can win?

It was through playing with these ideas that I came up with the following: A learning tool where you get feedback on your moves from AI, while playing AI!

From Idea To Reality

This concept is what let me to start a project I have been working on for years at this point. A project that is now known as Gosuji.

There is one extra focus in the projects that some will love but others will hate. It's not just trying not to make mistakes, it's trying to play like the AI. The hope is that this change of mindset teaches you the perspective and intuition of the AI, the exact thing that I noticed from watching AI vs AI matches.

In practice, this is enforced by making it a bit more of a guessing game. You want to have in your mind "What would the AI do here?" and play that move. If it was one of the top moves of the AI as well, it gets played. If it was not, the top move from the AI gets played instead. Even if your move was not technically a big mistake! AI has a playing style just like any other player after all. The difference is that it's the strongest playing style the Go world has ever seen. 

In this blog I will show you the process of making Gosuji. What I struggled with, the various features it has now and my thoughts behind them.

Gosuji and its Features

The Platform

Gosuji is a web application. This means that anyone can use it through a browser, just like the page you are on now. One of its pages is the trainer. This is the tool I described earlier where you can play against AI while getting feedback on your moves from AI. There is an account system so your games can get stored and continued where ever you are. And then there's the subscriptions. Running a Go AI is expensive! A normal computer can hardly run a single AI for just you alone. Now imagine the dozens, hundreds or even thousands of players that would need the AI to train on my site...

This is what the subscriptions are for. You can use the trainer for roughly one game a day for free. For virtually unlimited games, you need a subscription. If you want the AI to be stronger so it can give better feedback, it will be more expensive to run, so you need a higher subscription.

There are also pages for customizing your experience with settings, contacting me, etc. But the above are the fundamental systems of the site.

The Trainer

Lets get right into the heart of Gosuji. This is what players will visit the site for (and the Josekipedia, more on that later) and where they will spend most of their time.

 

On the left are your settings. You can save them and easily switch between different configurations through presets.

On the right you can see how you're doing. The performance graph and streaks tell you how many times in a row you played a move that the AI would have played as well.

In the center is the board that you'll play on. Let's press Start.

 

The AI played at 4-4. This already tells you they like the 4-4 point so lets do the same.

 

 The 4-4 point and a few moves after were AI approved, so we kept playing until now. It didn't like F3 so it played its top pick D14 and shows me the other possibilities. In this case B at E17. I'll try to remember this and can keep going with the button at the top right. This is essentially the main loop.

Home 

 

Just a normal home page with the logo, some text and recent changes, for now placeholders.

The Account System

 It's nothing you haven't seen before, so here are just some screenshots:

 

 

 

 Privacy minded people like me will be happy to see you can easily control your personal data here. 

Subscriptions

 

These are just placeholders for now. It might change drastically in the future.

The settings page also has a tab for your current subscription.

 

 Here you can see your tier, the next billing and upgrade, downgrade or cancel your subscription.

Profile

 

Here you can see the games you've played. You can continue, download and delete them.

You can also see statistics of your improvement. The percent is the overall percentage of right guesses in a game. Essentially the last percentage number in the graph on the trainer.

The left graph shows the percentage per game from oldest to newest game. So you hope that the percentage goes up as you practice more.

The right graph is the average percentage of the last 5 games, categorized in opening, middle game and endgame. with this you can see  what your biggest weakness is and what you need to focus on.

The Learn Page 

There are actually two tools on the site right now. And there might be more in the future. I'm thinking of making Gosuji a full platform for unique Go learning tools. But the trainer is still the main focus and will be for a while. The other tool is explained in the next chapter.

 

This is a hub where you can choose which tool to use. For people that don't want to go through two screens each time they want to train, there is also a link in the "Learn" dropdown on the navbar.

The Josekipedia

 

 Any Go player you speak will know what a josekipedia is. Or at least a joseki.

At the start of each game, there are a few sequences at the corner that many players know by hard. Just like the openings in chess, but up to four times, since there are four corners on a board. This is called a joseki. A josekipedia can be seen as a wikipedia for josekis. It has a bunch of these sequences that you can go through.

Players have wanted an AI version of a josekipedia for years now. But apart from some where strong players just added some sequences that they know the AI likes, none have been made. Not until now! I made AI play against itself on high strength on different corner start positions thousands of times. Then I did some, for a non data scientist, rather complex data science to turn it into a josekipedia.

Lets start with the oh so loved 4-4.

 

It tells you the amount of times the next move of a sequence has been seen in the game collection I generated. With this you can retrieve it loves A, likes B a lot too but is more likely not to play (pass) than to play D.

Then there are the slightly transparent stones. The main argument I've heard against an AI josekipedia or even josekipedias in general is that it's too dependent on the rest of the board position which move is good. The transparent stones show one of the positions the board was in when this sequence happened. This doesn't outright solve the problem as your conclusion from it might be incorrect, but it helps none the less.

A quick example where they are a bit more useful:

 

Black probably played Q14 instead of R14 because they already have such a strong lower-right. 

Another cool thing we can do is pass. This means it's blacks turn again and we can see what black would play if the their corner hasn't been touched yet.

 

Knight move. Shocker to no one. But the nice thing is that you can do this at any point in any sequence. 

Settings

You've already seen the account related and the subscription related tabs of the settings. But there is also a general one.

 

It has sound settings and a toggle for dark or light theme. Yes there is a light theme! Brace your eyes. 

 

 

Some of the settings you might change often are also easily reachable on the navbar.

 

The language can be changed here too.

 

The plan for now is to just support English and the Asian countries with the biggest player base.

The Contact Page

 

Here you can find information about the website and it's company (me). You can also send a message to ask for help, ask for a feature, report a problem I should know about or anything else important.

Captchas are too easy to circumvent nowadays, so it works with a limit per day per account and you need an account to send something.

Roadblocks

Multiple Frameworks

There have been three ports since the start of the project. Yes three! It started as something just for me. Just a plain static HTML, CSS and JS page with a simple API written in Java because the AI doesn't like running directly in the browser.

When I decided to take it further, I needed a real web framework. I decided for Blazor Server since I have the most programming experience in C# and I've heard good things about it.

Then I realized, way, waaay too late that the server in Blazor Server means that everything written in C# is run on the server. Even the page logic. Even the press of a simple button that needs nothing from the server. I didn't want to have unneeded load on the already expensive looking server nor the high amount of http requests the users would have to send. I'm hoping for users from both Europe and Asia so the connection might not always be so short and fast.

That's why I ported the codebase into Blazor WebAssembly. I could still use the server page exclusive pages from the Identity account system and make the other pages based on WASM so they are run from the user. It could even make pages work from the server like before while users were downloading the WASM files for the first time and then switch to WASM when it was done downloading!

Well it took about a month before the frustration got to me and I decided to go with Blazor WASM Standalone and a simple ASP.NET Core Web API. It turns out fancy new features means everything is more complicated, there are a bunch of limitations and it's too new to find solutions online.

So that's where I'm at now. I've had the WASM + API system for almost a year now and it just works! 

Many Settings Many Problems

 There are more than 30 settings for the trainer that you can tweak to your liking. This makes for great customization and allows making the trainer work in multiple completely different ways. However, making them all work together was an absolute nightmare! The main gameplay loop is easy enough. But what if it can be changed in 30 different ways? And what if one setting makes some other settings have to work differently?

My Learnings

You don't make an entire web application all by yourself without learning something new here and there.

Creative

In coding projects, my interests have often leaned towards the logic side rather than the design. But a website for others needs to look good and feel easy to use! A large amount of time has been put into thinking about what players would want and how they would want to use it. I used techniques like:

  • Mindmaps
  • Brainstorming
  • Asking others for feedback

And to make it look good enough to use I did:

  • Mockups
  • Inspirational investigation (stealing ideas from others)
  • Testing different Design Systems 

Technical

The most important things on the technical side that I learned were about topics that don't matter too much in your own hobby projects. If you make it for yourself, it doesn't have to be the fastest or the prettiest or the most secure. This is the part that was rather new to me. I learned:

  • Rate limiting
  • Sanitization
  • User and session scopes
  • Caching
  • Bundling
  • Renting GPUs 

I of course also learned a lot about the frameworks and their main technologies:

  • ASP.NET Core APIs
  • ASP.NET Identity
  • Blazor pages
  • WASM
  • Entity Framework 

So how can you try it?

Sadly, you can't...yet.

There are still some features to be finished, bugs to fix and the UI is just a prototype for now. Then there is the challenge of putting it online. I need a domain, at least one server and a place to run the AIs. With of course the challenges of making it as affordable as possible and accessible everywhere. Especially in the capitals of the Go world: China, South Korea and Japan.

In short, it's still a few months of work from being in the open, but the finish line is in sight!

Comments