Advertisement
North_Point

Tetovae2

Aug 9th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.67 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace Junk
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> inventory = Console.ReadLine().Split().ToList();
  12.  
  13.             List<string> command = Console.ReadLine().Split().ToList();
  14.  
  15.             while (command[0] != "Fight!")
  16.             {
  17.                 if (command[0] == "Buy")
  18.                 {
  19.                     if (inventory.Contains(command[1]) == false)
  20.                     {
  21.                         inventory.Add(command[1]);
  22.                     }
  23.                 }
  24.                 if (command[0] == "Trash")
  25.                 {
  26.                     if (inventory.Contains(command[1]))
  27.                     {
  28.                         inventory.Remove(command[1]);
  29.                     }
  30.                 }
  31.                 if (command[0] == "Repair")
  32.                 {
  33.                     if (inventory.Contains(command[1]))
  34.                     {
  35.                         inventory.Remove(command[1]);
  36.                         inventory.Add(command[1]);
  37.                     }
  38.                 }
  39.                 if (command[0] == "Upgrade")
  40.                 {
  41.                     List<string> tokens = command[1].Split('-').ToList();
  42.                     int index = inventory.IndexOf(tokens[0]);
  43.                     if (index != -1)
  44.                     {
  45.                         inventory.Insert(index + 1, string.Join(":", tokens));
  46.                     }
  47.                 }
  48.  
  49.                 command = Console.ReadLine().Split().ToList();
  50.             }
  51.  
  52.             Console.WriteLine(string.Join(" ", inventory));
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement