Advertisement
cubeBullet

Untitled

Oct 22nd, 2022
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | Source Code | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Security.Cryptography;
  4.  
  5. namespace Examrpep
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> chest = Console.ReadLine() //define chest state
  12.                 .Split("|")
  13.                 .ToList();
  14.  
  15.             List<string> cmd = new List<string>(); //declare command
  16.  
  17.             while (cmd[0] != "Yohoho!") //read commands until "Yohoho!"
  18.             {
  19.                 cmd = Console.ReadLine() //define the command
  20.                     .Split(" ")
  21.                     .ToList();
  22.  
  23.                 if (cmd[0] == "Loot")
  24.                 {
  25.                     for (int i = 1; i <= cmd.Count(); i++)
  26.                     {
  27.                         if (chest.Contains(cmd[i]) == false) chest.Insert(0, cmd[i]);
  28.                         //if the chest doesn't already have the loot, insert it at index 0
  29.                     }
  30.                 }
  31.                 else if(cmd[0] == "Drop")
  32.                 {
  33.                     int.Parse(cmd[1]);                                   //convert 2nd element of cmd[] to a number
  34.                     if (cmd[1] < 0 || cmd[1] > chest.Count()) continue;  //checks if given index isn't valid
  35.                 }
  36.                 else if (cmd[0] == "Steal")
  37.                 {
  38.  
  39.                 }
  40.             }
  41.  
  42.             if(chest.Count() > 0)
  43.             {
  44.  
  45.             }
  46.             else
  47.             {
  48.  
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement