Advertisement
IvanITD

7 - ExquisiteCorpse

Jan 28th, 2024 (edited)
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.90 KB | Source Code | 0 0
  1. using System.Collections;
  2. using System.Diagnostics;
  3. using System.Linq.Expressions;
  4.  
  5. namespace ExquisiteCorpse
  6. {
  7.   class Program
  8.   {
  9.     static void Main(string[] args)
  10.     {
  11.       RandomMode(); // This is the RandomMode method, with which I created a random creature!
  12.     }
  13.  
  14.     // Here I created a method where there is a switch case statement, in which there are going to be made different combinations of creature builds!
  15.     static void BuildACreature(string head, string body, string feet)
  16.     {
  17.       int headNum = TranslateToNumber("ghost");
  18.       int bodyNum = TranslateToNumber("bug");
  19.       int feetNum = TranslateToNumber("monster");
  20.     }
  21.  
  22.     // Here I created a separate personal method which I called RandomMode
  23.     static void RandomMode()
  24.     {
  25.         Random randomNumber = new Random();
  26.         int head = randomNumber.Next(1, 4);
  27.         int body = randomNumber.Next(1, 4);
  28.         int feet = randomNumber.Next(1, 4);
  29.  
  30.         // Here I call the SwitchCase method in order to create a random creature!
  31.         SwitchCase(head, body, feet);
  32.     }
  33.  
  34.     // Here I created a new custom method where I store my switch case statement
  35.     static void SwitchCase(int head, int body, int feet)
  36.     {
  37.       switch (head)
  38.       {
  39.         case 1:
  40.         GhostHead();
  41.         break;
  42.  
  43.         case 2:
  44.         BugHead();
  45.         break;
  46.  
  47.         case 3:
  48.         MonsterHead();
  49.         break;
  50.       }
  51.  
  52.       switch (body)
  53.       {
  54.         case 1:
  55.         GhostBody();
  56.         break;
  57.  
  58.         case 2:
  59.         BugBody();
  60.         break;
  61.  
  62.         case 3:
  63.         MonsterBody();
  64.         break;
  65.       }
  66.       switch (feet)
  67.       {
  68.         case 1:
  69.         GhostFeet();
  70.         break;
  71.  
  72.         case 2:
  73.         BugFeet();
  74.         break;
  75.  
  76.         case 3:
  77.         MonsterFeet();
  78.         break;
  79.       }
  80.  
  81.     }
  82.  
  83.     // Here we create a new method named TranslateToNumber, which is going to translate the string into a number!
  84.     static  int TranslateToNumber(string creature)
  85.     {
  86.      
  87.  
  88.       switch (creature)
  89.       {
  90.         case "ghost":
  91.           return 1;
  92.        
  93.         case "bug":
  94.           return 2;
  95.  
  96.         case "monster":
  97.           return 3;
  98.  
  99.         default:
  100.           return 1;
  101.       }
  102.      
  103.     }
  104.  
  105.     // This written code is the the creature's parts, which are written in separated methods in order those methods to be used later!
  106.     static void GhostHead()
  107.     {
  108.       Console.WriteLine("     ..-..");
  109.       Console.WriteLine("    ( o o )");
  110.       Console.WriteLine("    |  O  |");
  111.     }
  112.  
  113.     static void GhostBody()
  114.     {
  115.       Console.WriteLine("    |     |");
  116.       Console.WriteLine("    |     |");
  117.       Console.WriteLine("    |     |");
  118.     }
  119.  
  120.     static void GhostFeet()
  121.     {
  122.       Console.WriteLine("    |     |");
  123.       Console.WriteLine("    |     |");
  124.       Console.WriteLine("    '~~~~~'");
  125.     }
  126.  
  127.     static void BugHead()
  128.     {
  129.       Console.WriteLine("     /   \\");
  130.       Console.WriteLine("     \\. ./");
  131.       Console.WriteLine("    (o + o)");
  132.     }
  133.  
  134.     static void BugBody()
  135.     {
  136.       Console.WriteLine("  --|  |  |--");
  137.       Console.WriteLine("  --|  |  |--");
  138.       Console.WriteLine("  --|  |  |--");
  139.     }
  140.  
  141.     static void BugFeet()
  142.     {
  143.       Console.WriteLine("     v   v");
  144.       Console.WriteLine("     *****");
  145.     }
  146.  
  147.     static void MonsterHead()
  148.     {
  149.       Console.WriteLine("     _____");
  150.       Console.WriteLine(" .-,;='';_),-.");
  151.       Console.WriteLine("  \\_\\(),()/_/");
  152.       Console.WriteLine("   (,___,)");
  153.     }
  154.  
  155.     static void MonsterBody()
  156.     {
  157.       Console.WriteLine("   ,-/`~`\\-,___");
  158.       Console.WriteLine("  / /).:.('--._)");
  159.       Console.WriteLine(" {_[ (_,_)");
  160.     }
  161.  
  162.     static void MonsterFeet()
  163.     {
  164.       Console.WriteLine("    |  Y  |");
  165.       Console.WriteLine("   /   |   \\");
  166.       Console.WriteLine("   \"\"\"\" \"\"\"\"");
  167.     }
  168.   }
  169. }
  170.  
Tags: C#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement