Advertisement
AHobbyistProgrammer

ExquisiteCorpse

May 4th, 2021
1,182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExquisiteCorpse
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             bool userQuit = false;
  10.             do
  11.             {
  12.                 Console.WriteLine("Press 1 to customise a monster, 2 to randomise a monster, or 3 to quit");
  13.                 string customOrRandom = Console.ReadLine();
  14.                 switch (customOrRandom)
  15.                 {
  16.                     case "1":
  17.                         {
  18.                             Console.WriteLine("Choose a head (ghost, bug, or monster):");
  19.                             string userHead = Console.ReadLine();
  20.                             Console.WriteLine("Choose a body (ghost, bug, or monster):");
  21.                             string userBody = Console.ReadLine();
  22.                             Console.WriteLine("Choose feet (ghost, bug, or monster):");
  23.                             string userFeet = Console.ReadLine();
  24.                             BuildACreature(userHead, userBody, userFeet);
  25.                             break;
  26.                         }
  27.                     case "2":
  28.                         {
  29.                             RandomMode();
  30.                             break;
  31.                         }
  32.                     case "3":
  33.                         {
  34.                             userQuit = true;
  35.                             break;
  36.                         }
  37.                     default:
  38.                         {
  39.                             break;
  40.                         }
  41.                 }
  42.             } while (!userQuit);
  43.         }
  44.         static void BuildACreature(string head = "rand", string body = "rand", string feet = "rand")
  45.         {
  46.             int headNum = TranslateToNumber(head);
  47.             int bodyNum = TranslateToNumber(body);
  48.             int feetNum = TranslateToNumber(feet);
  49.             SwitchCase(headNum, bodyNum, feetNum);
  50.         }
  51.         static void RandomMode()
  52.         {
  53.             Random randomNumber = new Random();
  54.             int randomHead = randomNumber.Next(1, 4);
  55.             int randomBody = randomNumber.Next(1, 4);
  56.             int randomFeet = randomNumber.Next(1, 4);
  57.             SwitchCase(randomHead, randomBody, randomFeet);
  58.         }
  59.         static void SwitchCase(int head, int body, int feet)
  60.         {
  61.             switch (head)
  62.             {
  63.                 case 1:
  64.                     GhostHead();
  65.                     break;
  66.  
  67.                 case 2:
  68.                     BugHead();
  69.                     break;
  70.  
  71.                 case 3:
  72.                     MonsterHead();
  73.                     break;
  74.             }
  75.             switch (body)
  76.             {
  77.                 case 1:
  78.                     GhostBody();
  79.                     break;
  80.  
  81.                 case 2:
  82.                     BugBody();
  83.                     break;
  84.  
  85.                 case 3:
  86.                     MonsterBody();
  87.                     break;
  88.             }
  89.             switch (feet)
  90.             {
  91.                 case 1:
  92.                     GhostFeet();
  93.                     break;
  94.  
  95.                 case 2:
  96.                     BugFeet();
  97.                     break;
  98.  
  99.                 case 3:
  100.                     MonsterFeet();
  101.                     break;
  102.             }
  103.         } // takes ints for head, body and feet and cw's the appropriate ascii portion. ghost = 1, bug = 2, monster = 3
  104.         static int TranslateToNumber(string creature)
  105.         {
  106.            
  107.             switch (creature)
  108.             {
  109.                 case "ghost":
  110.                     return 1;
  111.                 case "bug":
  112.                     return 2;
  113.                 case "monster":
  114.                     return 3;
  115.                 case "rand":
  116.                     Random randomNumber = new Random();
  117.                     int currentRandom = randomNumber.Next(1, 4);
  118.                     return currentRandom;
  119.                 default:
  120.                     return 1;
  121.             }
  122.         }
  123.         static void GhostHead()
  124.         {
  125.             Console.WriteLine("     ..-..");
  126.             Console.WriteLine("    ( o o )");
  127.             Console.WriteLine("    |  O  |");
  128.         }
  129.  
  130.         static void GhostBody()
  131.         {
  132.             Console.WriteLine("    |     |");
  133.             Console.WriteLine("    |     |");
  134.             Console.WriteLine("    |     |");
  135.         }
  136.  
  137.         static void GhostFeet()
  138.         {
  139.             Console.WriteLine("    |     |");
  140.             Console.WriteLine("    |     |");
  141.             Console.WriteLine("    '~~~~~'");
  142.         }
  143.  
  144.         static void BugHead()
  145.         {
  146.             Console.WriteLine("     /   \\");
  147.             Console.WriteLine("     \\. ./");
  148.             Console.WriteLine("    (o + o)");
  149.         }
  150.  
  151.         static void BugBody()
  152.         {
  153.             Console.WriteLine("  --|  |  |--");
  154.             Console.WriteLine("  --|  |  |--");
  155.             Console.WriteLine("  --|  |  |--");
  156.         }
  157.  
  158.         static void BugFeet()
  159.         {
  160.             Console.WriteLine("     v   v");
  161.             Console.WriteLine("     *****");
  162.         }
  163.  
  164.         static void MonsterHead()
  165.         {
  166.             Console.WriteLine("     _____");
  167.             Console.WriteLine(" .-,;='';_),-.");
  168.             Console.WriteLine("  \\_\\(),()/_/");
  169.             Console.WriteLine("   (,___,)");
  170.         }
  171.  
  172.         static void MonsterBody()
  173.         {
  174.             Console.WriteLine("   ,-/`~`\\-,___");
  175.             Console.WriteLine("  / /).:.('--._)");
  176.             Console.WriteLine(" {_[ (_,_)");
  177.         }
  178.  
  179.         static void MonsterFeet()
  180.         {
  181.             Console.WriteLine("    |  Y  |");
  182.             Console.WriteLine("   /   |   \\");
  183.             Console.WriteLine("   \"\"\"\" \"\"\"\"");
  184.         }
  185.     }
  186. }
  187.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement