Code Monkey home page Code Monkey logo

Comments (4)

lightvector avatar lightvector commented on August 15, 2024

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.

from katago.

starshine360 avatar starshine360 commented on August 15, 2024

@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.
POPO-20231208-115858

from katago.

lightvector avatar lightvector commented on August 15, 2024

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.

from katago.

lightvector avatar lightvector commented on August 15, 2024

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.

from katago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.