6 changed files with 139 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||
|
|
||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
|
# Visual Studio Version 17 |
||||
|
VisualStudioVersion = 17.2.32616.157 |
||||
|
MinimumVisualStudioVersion = 10.0.40219.1 |
||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{005994BC-B1E2-4637-A76A-32C4B965ECA3}" |
||||
|
EndProject |
||||
|
Global |
||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
|
Debug|Any CPU = Debug|Any CPU |
||||
|
Release|Any CPU = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
|
{005994BC-B1E2-4637-A76A-32C4B965ECA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{005994BC-B1E2-4637-A76A-32C4B965ECA3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{005994BC-B1E2-4637-A76A-32C4B965ECA3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{005994BC-B1E2-4637-A76A-32C4B965ECA3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
GlobalSection(SolutionProperties) = preSolution |
||||
|
HideSolutionNode = FALSE |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ExtensibilityGlobals) = postSolution |
||||
|
SolutionGuid = {698449FD-F40C-4736-A499-828A1056E6C7} |
||||
|
EndGlobalSection |
||||
|
EndGlobal |
||||
@ -0,0 +1,35 @@ |
|||||
|
namespace ConsoleApp1 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Класс карты игральной
|
||||
|
/// </summary>
|
||||
|
public class Card |
||||
|
{ |
||||
|
#region consts
|
||||
|
private const CardValue MinValue = CardValue._6; |
||||
|
private const CardValue MaxValue = CardValue.Туз; |
||||
|
#endregion
|
||||
|
|
||||
|
#region Поля и свойства
|
||||
|
/// <summary>
|
||||
|
/// масть
|
||||
|
/// </summary>
|
||||
|
public CardSuit Suit; /* { get; set; } */ |
||||
|
/// <summary>
|
||||
|
/// величина
|
||||
|
/// </summary>
|
||||
|
public CardValue Value { get; set; } |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region constructors
|
||||
|
public Card(CardSuit suit, CardValue value) |
||||
|
{ |
||||
|
Suit = suit; |
||||
|
Value = value; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
namespace ConsoleApp1 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Масти карт
|
||||
|
/// </summary>
|
||||
|
public enum CardSuit : byte |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Неизвестная
|
||||
|
/// </summary>
|
||||
|
// Неизвестная,
|
||||
|
/// <summary>
|
||||
|
/// Червовые карты
|
||||
|
/// </summary>
|
||||
|
Черви, |
||||
|
/// <summary>
|
||||
|
/// Трефовые карты
|
||||
|
/// </summary>
|
||||
|
Трефы, |
||||
|
Буби, |
||||
|
Пики |
||||
|
}; |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
namespace ConsoleApp1 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Масти карт
|
||||
|
/// </summary>
|
||||
|
public enum CardValue : byte |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Неизвестная
|
||||
|
/// </summary>
|
||||
|
// Неизвестная,
|
||||
|
_6, _7, _8, _9, _10, Валет, Дама, Король, Туз |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<OutputType>Exe</OutputType> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||
|
<Nullable>enable</Nullable> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,32 @@ |
|||||
|
namespace ConsoleApp1 |
||||
|
{ |
||||
|
internal class Program |
||||
|
{ |
||||
|
static void Main(string[] args) |
||||
|
{ |
||||
|
CardSuit myCardType = CardSuit.Черви; |
||||
|
Console.WriteLine($"{myCardType}"); |
||||
|
|
||||
|
Card[] arCards = new Card[36]; |
||||
|
CardSuit[] arColors = (CardSuit[])Enum.GetValues(typeof(CardSuit)); |
||||
|
CardValue[] arValues = (CardValue[])Enum.GetValues(typeof(CardValue)); |
||||
|
|
||||
|
int ii = 0; |
||||
|
foreach (CardSuit color in arColors) |
||||
|
{ |
||||
|
foreach (CardValue value in arValues) |
||||
|
{ |
||||
|
Card _card = new Card(color, value); |
||||
|
arCards[ii] = _card; |
||||
|
ii++; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach (var card in arCards) |
||||
|
{ |
||||
|
Console.WriteLine($"{card.Suit}:{card.Value}"); |
||||
|
} |
||||
|
Console.ReadKey(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue