Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

RuntimeError: dictionary changed size during iteration #40

Open
fmscole opened this issue Aug 26, 2018 · 3 comments
Open

RuntimeError: dictionary changed size during iteration #40

fmscole opened this issue Aug 26, 2018 · 3 comments

Comments

@fmscole
Copy link

fmscole commented Aug 26, 2018

policy.py第110行:
for name, thing in locals().items():
应该改为:
for name, thing in list(locals().items()):
否则会出现异常RuntimeError: dictionary changed size during iteration

@brilee
Copy link
Owner

brilee commented Aug 26, 2018

Thanks for the comment. I don't work on MuGo anymore. You can see my latest work at https://github.com/tensorflow/minigo

@fmscole
Copy link
Author

fmscole commented Aug 27, 2018

@brilee
thanks for your reply!
I have a questi :how to deal with Residue and Double live?result is correct?

#####################################################################

def score(self):
    'Return score from B perspective. If W is winning, score is negative.'
    working_board = np.copy(self.board)
    while EMPTY in working_board:
        unassigned_spaces = np.where(working_board == EMPTY)
        c = unassigned_spaces[0][0], unassigned_spaces[1][0]
        territory, borders = find_reached(working_board, c)
        border_colors = set(working_board[b] for b in borders)
        X_border = BLACK in border_colors
        O_border = WHITE in border_colors
        if X_border and not O_border:
            territory_color = BLACK
        elif O_border and not X_border:
            territory_color = WHITE
        else:
            territory_color = UNKNOWN  # dame, or seki
        place_stones(working_board, territory_color, territory)

    return np.count_nonzero(working_board == BLACK) - np.count_nonzero(working_board == WHITE) - self.komi

#####################################################################
Looking at this code, I feel there is no distinction between Residue and Double Live, the remnants are regarded as double live, so it seems very problematic to calculate the winning or losing?

How to deal with it?

@fmscole
Copy link
Author

fmscole commented Aug 28, 2018

@brilee

thank you very much!
I am English very poor, I speak Chinglish ^_^
yes, I mean that "double live" is Seki .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants