Course: CSE3300 Edition: 2020-2021

Enroll
One can enroll until Mon, May 31, 2021 12:00:00
All Announcements

Bug in library for assignment 1

Update: the issue is fixed in the WebLab library, meaning you can now safely call setState on theBoardCompact.

The given library contains a bug in the setState method of the BoardCompact class. Currently, line 174 sets boxCount = 0;, while this should be boxInPlaceCount = 0;.

In order to fix this issue, you can add a custom implementation of BoardCompact to your own solution, which you can use in place of the implementation in the library.

public class BoardCompactUpdate extends BoardCompact {

    public BoardCompactUpdate(int width, int height) {
        super(width, height);
    }

    @Override
    public void setState(StateMinimal state) {
        playerX = state.getX(state.positions[0]);
        playerY = state.getY(state.positions[0]);
        boxInPlaceCount = 0; // this line contains the fix

        tiles[playerX][playerY] = (tiles[playerX][playerY] & EEntity.NULLIFY_ENTITY_FLAG) | EEntity.PLAYER.getFlag();

        for (int i = 1; i < state.positions.length; ++i) {
            int x = state.getX(state.positions[i]);
            int y = state.getY(state.positions[i]);
            tiles[x][y] = (tiles[x][y] & EEntity.NULLIFY_ENTITY_FLAG) | EEntity.BOX_1.getFlag();
            if (CTile.forSomeBox(tiles[x][y])) ++boxInPlaceCount;
        }
    }
}

We are also currently working on fixing this issue on the library here on WebLab. Due to the way the assignment is constructed, this might however take some time. Hence, we recommend using the solution given above in the mean time.

at Mon, Mar 1, 2021 10:47:58 updated at Mon, Mar 1, 2021 11:52:14