blackjack/Models/Card.cs

22 lines
1015 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace БлэкДжек.Components // Замените BlazorBlackjack на имя вашего проекта
{
public class Card
{
public string Suit { get; set; } // Масть (♥, ♦, ♣, ♠)
public string Rank { get; set; } // Ранг (2, 3, ..., 10, J, Q, K, A)
public int Value { get; set; } // Значение (J,Q,K = 10, A = 11 или 1)
// Для удобного отображения
public string Display => $"{Rank}{Suit}";
// Можно добавить свойство для пути к изображению карты, если хотите графику
// public string ImagePath => $"images/cards/{Rank.ToLower()}{SuitChar}.png";
// private char SuitChar => Suit switch { "♥" => 'h', "♦" => 'd', "♣" => 'c', "♠" => 's', _ => ' ' };
public Card(string suit, string rank, int value)
{
Suit = suit;
Rank = rank;
Value = value;
}
}
}