def handle_stone(self, node): add = [] for l in node.prop: print "Placing stone at %s" % l x, y = util.pos2xy(l) add.append((x, y)) self.add_stone(x, y, util.str2color(node.name))
def _undo(): print "_undo %s" % node for x, y in added: self.remove_stone(x, y) for x, y in removed: cl = util.str2color(node.name) self.add_stone(x, y, util.enemy(cl)) self.place_stone_xy(x, y, util.enemy(cl))
def handle_move(self, node): "Handle a move. Deal with dead stone, etc. Assuming it's a play node" if node.prop == "": print "PASS" self.emit(QtCore.SIGNAL("newComment(PyQt_PyObject)"), "PASS") return [] else: x, y = util.pos2xy(self.game.where().prop) return self.play_xy(x, y, util.str2color(self.game.where().name))