def render(self): """ Print the board for human reading """ outfile = sys.stdout outfile.write('To play: {}\n{}\n'.format( six.u(pachi_py.color_to_str(self.player_color)), self.board.__repr__().decode())) return outfile
def main(): parser = argparse.ArgumentParser() parser.add_argument('--raw_actions', action='store_true') args = parser.parse_args() env = envs.make('Go9x9-v0') env.reset() while True: s = env._state env._render() colorstr = pachi_py.color_to_str(s.color) if args.raw_actions: a = int(raw_input('{} (raw)> '.format(colorstr))) else: coordstr = raw_input('{}> '.format(colorstr)) a = go.str_to_action(s.board, coordstr) _, r, done, _ = env.step(a) if done: break print('You win!' if r > 0 else 'Opponent wins!') print('Final score:', env._state.board.official_score)
def __repr__(self): return 'To play: {}\n{}'.format(six.u(pachi_py.color_to_str(self.color)), self.board.__repr__().decode())
def __repr__(self): return 'To play: {}\n{}'.format(pachi_py.color_to_str(self.color), repr(self.board))
def user_policy_fn(curr_state, prev_state, prev_action): print curr_state.board coordstr = raw_input('%s> ' % pachi_py.color_to_str(curr_state.color)) return curr_state.board.str_to_coord(coordstr)
def __repr__(self): return 'To play: {}\n{}'.format(six.u(pachi_py.color_to_str(self.color)), six.u(self.board.__repr__()))
def __repr__(self): return "To play: {}\n{}".format(six.u(pachi_py.color_to_str(self.color)), self.board.__repr__().decode())