Skip to content

A function never called in tictactoe2.py #801

Open
@Vaxick

Description

@Vaxick

Just watched the code of this specific file, and noticed that there is a function that is never called

def think(board, g, h, moves):

    if board[Space.MID_CENTER] is OccupiedBy.EMPTY:
        return Space.MID_CENTER

    if board[Space.MID_CENTER] is OccupiedBy.PLAYER:
        if (
            board[Space.TOP_CENTER] is OccupiedBy.PLAYER
            and board[Space.TOP_LEFT] is OccupiedBy.EMPTY
            or board[Space.MID_LEFT] is OccupiedBy.PLAYER
            and board[Space.TOP_LEFT] is OccupiedBy.EMPTY
        ):
            return Space.BOT_LEFT
        elif (
            board[Space.MID_RIGHT] is OccupiedBy.PLAYER
            and board[Space.BOT_RIGHT] is OccupiedBy.EMPTY
            or board[Space.BOT_CENTER] is OccupiedBy.PLAYER
            and board[Space.BOT_RIGHT] is OccupiedBy.EMPTY
        ):
            return Space.BOT_RIGHT

    if g == OccupiedBy.PLAYER:
        j = 3 * int((moves - 1) / 3)
        if move == j + 1:  # noqa: This definitely is a bug!
            k = 1
        if move == j + 2:  # noqa: This definitely is a bug!
            k = 2
        if move == j + 3:  # noqa: This definitely is a bug!
            k = 3
        return subthink(g, h, j, k)  # noqa: This definitely is a bug!

Isn't it better to just remove it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions