Skip to content

Instantly share code, notes, and snippets.

@Attosius
Last active December 4, 2025 19:38
Show Gist options
  • Select an option

  • Save Attosius/eded57688fa7ed39132e078087aa9b0d to your computer and use it in GitHub Desktop.

Select an option

Save Attosius/eded57688fa7ed39132e078087aa9b0d to your computer and use it in GitHub Desktop.
ДЗ: Работа со свойствами
using System;
namespace IJuniorTasks
{
internal class Program
{
static void Main(string[] args)
{
var player = new Player(10, 20, "@");
var drawer = new Drawer();
drawer.DrawPlayer(player);
Console.ReadKey();
}
}
public class Player
{
public Player(int positionX, int positionY, string symbol)
{
PositionX = positionX;
PositionY = positionY;
Symbol = symbol;
}
public int PositionX { get; }
public int PositionY { get; }
public string Symbol { get; }
}
public class Drawer
{
public void DrawPlayer(Player player)
{
var consolePosition = Console.GetCursorPosition();
Console.SetCursorPosition(player.PositionX, player.PositionY);
Console.Write(player.Symbol);
Console.SetCursorPosition(consolePosition.Left, consolePosition.Top);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment