KataGo
                                
                                 KataGo copied to clipboard
                                
                                    KataGo copied to clipboard
                            
                            
                            
                        How to get the whiteOwnerMap of the current board state?
When I use the "analyse" sub-command to analyse the current board state, I find that the whiteOwnerMap looks like the result that AI has make a next move. However, what I want is the whiteOwnerMap of the current board state. So Is there any methods to get that, please?
It sounds like what you're asking for is to score a game that is incomplete. There isn't a standard way to do that, so there aren't any methods offered to do it. For example if the borders of territories are not yet completed then an area that any human player would normally consider to be "owned" will technically not be owned or count as any territory because it isn't fully surrounded. Is that what you want? And under strict computer rules, if a group is "dead" but still has not been fully captured may be treated as alive in the current board state. The fact that it is dead depends on the fact that we are predicting the future board state where we are predicting that it will be removed, not the current board state where it is still on the board.
If you really are okay with these kinds of things - treating all groups as alive, and not counting territory with incomplete borders, then you can write your own method that does a recursive floodfill. Example pseudo code:
already_scored = [[false for x in range(board_x_size)] for y in range(board_y_size)]
def score(x: int, y: int, player: Player):
    if already_scored[y][x]:
        return
    mark_this_point_as_owned_by(player,x,y)
    already_scored[y][x] = True
    for adjacent_x, adjacent_y in [(x-1,y),(x+1,y),(x,y-1),(x,y+1)]:
        if is_within_bounds(adjacent_x, adjacent_y):
            score(adjacent_x, adjacent_y, player)
for y in range(board_y_size):
    for x in range(board_x_size):
        if is_black_stone(x,y):
            score(x,y,BLACK)
        elif is_white_stone(x,y):
            score(x,y,WHITE)
If you are interested in a "smarter" method still tries to predict the future outcome of dead stones and incomplete borders that depends on predicting future moves, yet somehow understands that it should not predict "specific" additional tactics things that the player to move can do, this is not really well defined and at best there are only different heuristics one can try. See https://forums.online-go.com/t/testing-autoscore-algorithms/47511/51 for some research on this.
@lightvector Thanks for your reply. Well, sometimes the players (for example, many children) are not not skilled enough. When they choose to end the game, there may be still some unsettled stones in the board. In that case, if I can get the ownership of the current board state, then I can use it to compute the size of the territory of both white and black. If black_size > white_size + komi, then the winner is black,otherwise the winner should be white. So the key is that how to get the ownership of the current board state. However, the ownership produced by katago's analyse sub-command looks like the result that AI has make a next move. As shown in the following image (the last move is made by black), when I call the analyse sub-command, katago will make a next move at S8 for the white player, and the area within the red box will be marked as the territory of white according to katago's ownership result. However, since the game is end, nobody should have a next move.
Cool, so it sounds like you want a "smart" method. So then, please take a look at the link I gave above. In case you missed it: https://forums.online-go.com/t/testing-autoscore-algorithms/47511/51
You will have to write a bit of code that queries KataGo more than once, with each side to move and does some basic floodfilling based on dame and other simple rules in order to implement the experimental "v3" algorithm that is described, that someone came up with, or any other experimental algorithms that you like. These are all experimental methods, there is no single "correct" way to do this, but you can try things.
Obviously, if you have questions, feel free to post in that OGS forum thread. I'm not the one that has been doing this research and experimentation on how to heuristically score "incomplete" games in a way that is still sensible, but I'm sure the people who are would be happy to answer questions to someone who is interested.