Skip to content

Instantly share code, notes, and snippets.

@Kichat-sudo
Created May 23, 2025 08:52
Show Gist options
  • Save Kichat-sudo/4fae4d96461b2d888bfeda465cd30949 to your computer and use it in GitHub Desktop.
Save Kichat-sudo/4fae4d96461b2d888bfeda465cd30949 to your computer and use it in GitHub Desktop.
3.1
using System;
namespace GameInterface
{
class CharacterStatsDisplay
{
static void Main()
{
Console.WriteLine("Укажите уровень жизненной энергии (0-100%): ");
int lifeEnergyLevel = Convert.ToInt32(Console.ReadLine());
ShowStatusVisual(lifeEnergyLevel);
Console.WriteLine("Укажите уровень магической энергии (0-100%): ");
int magicEnergyLevel = Convert.ToInt32(Console.ReadLine());
ShowStatusVisual(magicEnergyLevel);
}
static void ShowStatusVisual(int percentageValue)
{
const int visualLength = 25;
int activeSegments = visualLength * percentageValue / 100;
string activeVisual = new string('■', activeSegments);
string inactiveVisual = new string('·', visualLength - activeSegments);
Console.WriteLine($"|{activeVisual}{inactiveVisual}|");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment