[Londerings-commits] CVS: go/simple_go game.py, 1.42, 1.43 game_experimental.py, 1.50, 1.51
Brought to you by:
aloril
From: Aloril <al...@us...> - 2006-10-09 04:03:35
|
Update of /cvsroot/londerings/go/simple_go In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32458 Modified Files: game.py game_experimental.py Log Message: fixed super-ko bug in both uct (inside just tactical uct it remains at the moment unfixed); also added generic guard in generate_move against illegal moves Index: game.py =================================================================== RCS file: /cvsroot/londerings/go/simple_go/game.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** game.py 7 Oct 2006 18:35:18 -0000 1.42 --- game.py 9 Oct 2006 04:03:23 -0000 1.43 *************** *** 849,853 **** return random.choice(self.list_moves()) ! def generate_move(self, remove_opponent_dead=False, pass_allowed=True): """generate move using scored move generator """ --- 849,853 ---- return random.choice(self.list_moves()) ! def do_generate_move(self, remove_opponent_dead=False, pass_allowed=True): """generate move using scored move generator """ *************** *** 891,894 **** --- 891,902 ---- return self.select_scored_move(remove_opponent_dead, pass_allowed) + def generate_move(self, remove_opponent_dead=False, pass_allowed=True): + move = self.do_generate_move(remove_opponent_dead, pass_allowed) + if not self.legal_move(move): + if config.debug_flag: + dprintnl("illegal move returned by do_generate_move: ", move_as_string(move), "changed to PASS") + move = PASS_MOVE + return move + def save_c_state(self): self.saved_move_list = self.move_history[:] Index: game_experimental.py =================================================================== RCS file: /cvsroot/londerings/go/simple_go/game_experimental.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** game_experimental.py 7 Oct 2006 18:35:19 -0000 1.50 --- game_experimental.py 9 Oct 2006 04:03:23 -0000 1.51 *************** *** 1511,1515 **** self.statistics_str += """ %%stactical block %s %.3f defend %%s%s%%s %.3f attack %%s%s%%s %.3f%%s""" % (move_as_string(pos), prob_score, move_as_string(move_defend), score1, move_as_string(move_attack), score2) ratio2 = prob_score ! if ratio > ratio2: if config.debug_flag: dprintnl("win uct ratio prefered:", move_as_string(move), ratio, ratio2) --- 1511,1515 ---- self.statistics_str += """ %%stactical block %s %.3f defend %%s%s%%s %.3f attack %%s%s%%s %.3f%%s""" % (move_as_string(pos), prob_score, move_as_string(move_defend), score1, move_as_string(move_attack), score2) ratio2 = prob_score ! if ratio > ratio2 or not self.legal_move(move2): if config.debug_flag: dprintnl("win uct ratio prefered:", move_as_string(move), ratio, ratio2) |