The sharp and flat problem is confusing because the 12 edo tuning system works in semitones and wholetone intervals. If you work in Large (L) and small (s) intervals as in meantone tuning, you realise that sharps are on the fifth side of the spiral direction, and flats are on the fourths. So transpose by steps of fourths and fifths instead of semitones.