Aliendreamer

cardgames

Apr 25th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CardGames
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             //input
  15.  
  16.             Console.WriteLine("Choose game:");
  17.             Console.WriteLine("1== belot");
  18.             Console.WriteLine("2==sentase");
  19.             Console.WriteLine("3==bridge");
  20.             int gameChoice = int.Parse(Console.ReadLine());
  21.  
  22.              //logic
  23.                    string colors = "\\u2663\\u2660\\u2666\\u2665";
  24.                    colors = System.Text.RegularExpressions.Regex.Unescape(colors);
  25.  
  26.                    Random rng = new Random();
  27.  
  28.                    string[] cardsNum = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "13", "14", "15", "16" };
  29.  
  30.                   List <string> cardDeck =new List<string>(cardsNum);
  31.  
  32.             switch (gameChoice)
  33.             {
  34.                 case 1:
  35.                     cardDeck.RemoveRange(0, 5);
  36.                     break;
  37.                 case 2:
  38.                     cardDeck.RemoveRange(0, 6);
  39.                     break;
  40.                 case 3:
  41.                     cardDeck.Equals(cardDeck);
  42.                     break;
  43.  
  44.                 default:
  45.                     Console.WriteLine("Wrong choice of game");
  46.                     break;
  47.             }
  48.  
  49.  
  50.  
  51.            StringBuilder CardsAllColors = new StringBuilder();
  52.      
  53.            foreach (var index in cardsNum)
  54.                
  55.            {
  56.                 CardsAllColors.Append(index).Append(colors[0]).ToString().ToList();
  57.                 CardsAllColors.Append(index).Append(colors[1]).ToString();
  58.                 CardsAllColors.Append(index).Append(colors[2]).ToString();
  59.                 CardsAllColors.Append(index).Append(colors[3]).ToString();
  60.            }
  61.                
  62.  
  63.  
  64.  
  65.  
  66.             // 3те различни типа тестета тествани и работят TODO  разбъркване с Random
  67.  
  68.             int number = CardsAllColors.Length;
  69.             int card = 0;
  70.  
  71.  
  72.             for (int first=0;first<number;first++)
  73.             {
  74.  
  75.                 card++;
  76.                 int second=rng.Next(CardsAllColors.Length);
  77.                 var temp = CardsAllColors[first];
  78.                 CardsAllColors[first] = CardsAllColors[second];
  79.                 CardsAllColors[second] = temp;
  80.  
  81.             }
  82.  
  83.             Console.WriteLine(CardsAllColors);
  84.             Console.WriteLine(gameChoice);
  85.             Console.WriteLine(CardsAllColors.Length);
  86.  
  87.          
  88.  
  89.         }
  90.     }
  91. }
Add Comment
Please, Sign In to add comment