Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DanhBai
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.OutputEncoding = Encoding.Unicode;
- string[] data = generateData();
- int player1 = chiaBai(data);
- Console.WriteLine($"Nguoi choi 1 : {player1}");
- }
- static int chiaBai(string[] data)
- {
- Random ran = new Random();
- int totalGamer1 = 0;
- for (int i = 0; i < 3; i++)
- {
- int number = ran.Next(0, data.Length);
- int temp = int.Parse(data[number].Split('_')[0]);
- if (temp >= 10) temp = 0;
- totalGamer1 += temp;
- }
- return totalGamer1 %= 10;
- }
- static string[] generateData()
- {
- string[] res = new string[52];
- const string type = "♥♦♣♠";
- int dem = 0;
- for (int i = 1; i <= 13; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- res[dem] = i.ToString() + "_" + type[j];
- dem++;
- }
- }
- return res;
- }
- }
- }
Add Comment
Please, Sign In to add comment