MultiAgentLearning / playground

PlayGround: AI Research into Multi-Agent Learning.
https://www.pommerman.com
Apache License 2.0
765 stars 217 forks source link

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

Open shenzhun opened 4 years ago

shenzhun commented 4 years ago

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