def draw_info(batch, window_width, window_height, upper_grid_coord, state): turn = GoGame.get_turn(state) turn_str = 'B' if turn == BLACK else 'W' prev_player_passed = GoGame.get_prev_player_passed(state) game_ended = GoGame.get_game_ended(state) info_label = "Turn: {}\nPassed: {}\nGame: {}".format( turn_str, prev_player_passed, "OVER" if game_ended else "ONGOING") pyglet.text.Label(info_label, font_name='Helvetica', font_size=11, x=window_width - 20, y=window_height - 20, anchor_x='right', anchor_y='top', color=(0, 0, 0, 192), batch=batch, width=window_width / 2, align='right', multiline=True) # Areas black_area, white_area = GoGame.get_areas(state) pyglet.text.Label("{}B | {}W".format(black_area, white_area), font_name='Helvetica', font_size=16, x=window_width / 2, y=upper_grid_coord + 80, anchor_x='center', color=(0, 0, 0, 192), batch=batch, width=window_width, align='center')
def get_info(self): """ :return: Debugging info for the state """ return { 'prev_player_passed': GoGame.get_prev_player_passed(self.state), 'turn': 'b' if GoGame.get_turn(self.state) == GoEnv.govars.BLACK else 'w', 'game_ended': GoGame.get_game_ended(self.state) }
def turn(self): return GoGame.get_turn(self.state)