Переконвертировать цифру в букву - C#
Формулировка задачи:
Здравствуйте. Есть такой набросок:
Можно ли этот код как-то упростить? В силу своей безграмотности это первое что пришло в голову.
private string GetXPosition(BasePlayer player)
{
int position = (int)((player.transform.position.x + (TerrainMeta.Size.x / 2)) / (TerrainMeta.Size.x / 26)) + 1;
switch(position)
{
case 1: return "A";
case 2: return "B";
case 3: return "C";
case 4: return "D";
case 5: return "E";
case 6: return "F";
case 7: return "G";
case 8: return "H";
case 9: return "I";
case 10: return "J";
case 11: return "K";
case 12: return "L";
case 13: return "M";
case 14: return "N";
case 15: return "O";
case 16: return "P";
case 17: return "Q";
case 18: return "R";
case 19: return "S";
case 20: return "T";
case 21: return "U";
case 22: return "V";
case 23: return "W";
case 24: return "X";
case 25: return "Y";
case 26: return "Z";
}
}Решение задачи: «Переконвертировать цифру в букву»
textual
Листинг программы
private string GetRotation(BasePlayer player)
{
double lookRotation = player.eyes.rotation.eulerAngles.y;
if(lookRotation > 337.5 || lookRotation < 22.5) return "⇑";
else if(lookRotation > 22.5 && lookRotation < 67.5) return "в‡—";
else if(lookRotation > 67.5 && lookRotation < 112.5) return "в‡’";
else if(lookRotation > 112.5 && lookRotation < 157.5) return "в‡