Advertisement
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 Wizard_Poker
- {
- class Program
- {
- static List<string> Add(List<string> deck, List<string> deck2, string[] end)
- {
- string card = end[1];
- if (deck.Contains(card))
- {
- deck2.Add(card);
- }
- else
- { Console.WriteLine("Card not found."); }
- return deck2;
- }
- static List<string> Insert(List<string> deck, List<string> deck2, string[] end)
- {
- string card = end[1];
- int index = int.Parse(end[2]);
- if (deck.Contains(card)&&(index>=0&&index<deck.Count))
- {
- deck2.Insert(index, card);
- }
- else
- { Console.WriteLine("Error!"); }
- return deck2;
- }
- static List<string> Remove(List<string> deck2, string[] end)
- {
- string card = end[1];
- if (deck2.Contains(card))
- {
- deck2.Remove(card);
- }
- else
- { Console.WriteLine("Card not found."); }
- return deck2;
- }
- static List<string> Swap(List<string> deck2, string[] end)
- {
- //string card1 = end[1];
- //string card2 = end[2];
- int index1 = deck2.IndexOf(end[1]);
- int index2 = deck2.IndexOf(end[2]);
- string temp = deck2[index1];
- deck2[index1] = deck2[index2];
- deck2[index2] = temp;
- return deck2;
- }
- static void Main(string[] args)
- {
- List<string> deck = Console.ReadLine().Split(':').ToList();
- List<string> deck2 = new List<string>();
- string[] end = Console.ReadLine().Split().ToArray();
- while (end[0] != "Ready")
- {
- if (end[0] == "Add")
- {
- Add(deck, deck2, end);
- }
- if (end[0] == "Insert")
- {
- Insert(deck, deck2, end);
- }
- if (end[0] == "Remove")
- {
- Remove(deck2, end);
- }
- if (end[0] == "Swap")
- {
- Remove(deck2, end);
- }
- if (end[0] == "Shuffle")
- {
- deck2.Reverse();
- }
- // Console.WriteLine(string.Join(" ", deck2));
- end = Console.ReadLine().Split().ToArray();
- }
- Console.WriteLine(string.Join(" ",deck2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement