Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.99 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 CypherRoulette
  8. {
  9.     class CypherRoulette
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int number = int.Parse(Console.ReadLine());
  14.  
  15.  
  16.             string specialCommand = "spin";
  17.             string stringBox = "";
  18.             int specialCheckerForReset = 0;
  19.             string wordCheckerForReset = "";
  20.             int lamp = 0;
  21.             for (int i = 1; i <= number; i++)
  22.             {
  23.  
  24.                 string randomString = Console.ReadLine();
  25.  
  26.                 if (wordCheckerForReset==randomString)
  27.                 {
  28.                     stringBox = "";
  29.                     wordCheckerForReset = "";
  30.                     continue;
  31.                 }
  32.                 wordCheckerForReset = randomString;
  33.              
  34.  
  35.                 if (randomString==specialCommand)
  36.                 {
  37.                     if (lamp==1)
  38.                     {
  39.                         lamp = 0;
  40.                     }
  41.                     else
  42.                     {
  43.                         lamp = 1;
  44.                     }
  45.                     i--;
  46.                     specialCheckerForReset++;
  47.                     if (specialCheckerForReset == 2)
  48.                     {
  49.                         stringBox = "";
  50.                         specialCheckerForReset = 0;
  51.                         lamp = 0;
  52.                     }
  53.                     wordCheckerForReset = "";
  54.                     continue;
  55.  
  56.                 }
  57.                 else
  58.                 {
  59.                     specialCheckerForReset = 0;
  60.                 }
  61.                 if (lamp==0)
  62.                 {
  63.                     stringBox += randomString;
  64.                 }
  65.                 else
  66.                 {
  67.                     stringBox = randomString + stringBox;
  68.                 }
  69.                
  70.             }
  71.             Console.WriteLine(stringBox);
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement