コード例 #1
0
ファイル: go.py プロジェクト: zhuzhenping/SuperGo
    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
ファイル: go.py プロジェクト: AniChikage/gym
 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
ファイル: go.py プロジェクト: caoxiaoqing/gym
 def __repr__(self):
     return "To play: {}\n{}".format(six.u(pachi_py.color_to_str(self.color)), self.board.__repr__().decode())
コード例 #9
0
ファイル: play.py プロジェクト: DaedalusX/pachi-py
 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)