re initializing totalPieces to 0 Tie now works