Skip to content

set num_wood less than 12 can't get expected custom board #231

@shenzhun

Description

@shenzhun

this snippet of code shows that if there are 4 agents, the board will reserve some coordinates to create passages for the agents. But if the num_wood/num_rigid is set to less than 12, the code looks not right.

        if num_agents == 4:
            for i in range(4, size - 4):
                board[1, i] = wood
                board[size - i - 1, 1] = wood
                board[size - 2, size - i - 1] = wood
                board[size - i - 1, size - 2] = wood
                coordinates.remove((1, i))
                coordinates.remove((size - i - 1, 1))
                coordinates.remove((size - 2, size - i - 1))
                coordinates.remove((size - i - 1, size - 2))
                num_wood -= 4

one way to fix:

        if num_agents == 4 and num_wood > 12:
            for i in range(4, size - 4):
                board[1, i] = wood
                board[size - i - 1, 1] = wood
                board[size - 2, size - i - 1] = wood
                board[size - i - 1, size - 2] = wood
                coordinates.remove((1, i))
                coordinates.remove((size - i - 1, 1))
                coordinates.remove((size - 2, size - i - 1))
                coordinates.remove((size - i - 1, size - 2))
                num_wood -= 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions