i suppose you would load the map into a 2d array and then track the position of the player as an index in the array. create a B at this index when needed. you need to create a whole new 2d array with the B in it because you cannot modify an existing array. use the existing array as input to some method that generates a new one.
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad: