コード例 #1
0
def gamma_golden_move(g: Gamma, player: int, x: int, y: int) -> bool:
    if x < 0 or y < 0 or g.board.width <= x or g.board.height <= y:
        return False
    if player < 1 or player > g.players:
        return False

    return Gamma.try_golden_move(g, player, x, y)
コード例 #2
0
def apply_gamma(gammas, images):
    for gamma in gammas:
        for image in images:
            cvImage = cv2.imread(image)
            gammaImage = Gamma.adjust_gamma(cvImage, gamma)

            imagePaths = image.split('/')
            imageProps = imagePaths[len(imagePaths) - 1].split('.')
            if not os.path.exists('./result_images/gamma'):
                os.makedirs('./result_images/gamma')
            cv2.imwrite(
                './result_images/gamma/' + imageProps[0] +
                str(gamma).replace('.', 'dot') + '.' + imageProps[1],
                np.array(gammaImage))
コード例 #3
0
def gamma_new(width: int, height: int, players: int,
              areas: int) -> Optional[Gamma]:
    if width * height < 1 or players < 1 or areas < 1:
        return None
    return Gamma(width, height, players, areas)
コード例 #4
0
def gamma_golden_possible(g: Gamma, player: int) -> bool:
    return g.is_golden_possible(player)
コード例 #5
0
def gamma_free_fields(g: Gamma, player: int) -> int:
    return g.get_free_fields(player)
コード例 #6
0
def gamma_busy_fields(g: Gamma, player: int) -> int:
    return g.get_busy_fields(player)
コード例 #7
0
def unsafe_gamma_move(g: Gamma, player: int, x: int, y: int) -> bool:
    return g.unsafe_move(player, x, y)