Currently, piece ids change based on their state. When in the initial container, they are prefixed with i- and when on the board they are prefixed with b-.
This state should be held in a different key value pair separate from the index. All logic that relies on these prefixes should be updated.
Consider adding an isOnBoard or a state value to store whether the piece is in the initial container, on the board, or if it's the sample piece.
Also consider generating random Ids to accommodate splitting and combining pieces in the future. It may be confusing to end up with an array with ids like 1, 2, 3a, 3b, 3c, 4, 6.