Пример #1
0
    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
Пример #2
0
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)
Пример #3
0
 def __repr__(self):
     return 'To play: {}\n{}'.format(six.u(pachi_py.color_to_str(self.color)), self.board.__repr__().decode())
Пример #4
0
 def __repr__(self):
     return 'To play: {}\n{}'.format(pachi_py.color_to_str(self.color), repr(self.board))
Пример #5
0
Файл: go.py Проект: aforr/gym
 def __repr__(self):
     return 'To play: {}\n{}'.format(pachi_py.color_to_str(self.color), repr(self.board))
Пример #6
0
 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)
Пример #7
0
Файл: go.py Проект: 222464/gym
 def __repr__(self):
     return 'To play: {}\n{}'.format(six.u(pachi_py.color_to_str(self.color)), six.u(self.board.__repr__()))
Пример #8
0
 def __repr__(self):
     return "To play: {}\n{}".format(six.u(pachi_py.color_to_str(self.color)), self.board.__repr__().decode())
Пример #9
0
 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)