added the function isOccupied and now setCell checks if the selected cell is occupied