Advertisement
Guest User

Untitled

a guest
Oct 29th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.66 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 Cube3D
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int depth = 5;
  14.             int width = 10;
  15.             int height = 15;
  16.  
  17.             var maxLines = height+depth;
  18.             var maxColumn = width + depth;
  19.  
  20.             var tempDepth = depth;
  21.             var tempDepth2 = depth;
  22.  
  23.             for (int line = 0; line < maxLines; line++)
  24.             {
  25.                 if (tempDepth > 0 && line == 0)
  26.                 {
  27.                     Console.Write(new String(' ', tempDepth));
  28.                     Console.Write(new String('*', width));
  29.                 }
  30.                 else if (tempDepth > 0 && line != 0)
  31.                 {
  32.                     Console.Write(new String(' ', tempDepth));
  33.                     Console.Write('*');
  34.                     Console.Write(new String(' ', width - 2));
  35.                     Console.Write('*');
  36.                     var diff = depth - tempDepth;
  37.                     if (diff > 1)
  38.                     {
  39.                         Console.Write(new String(' ', diff - 1));
  40.                     }
  41.                     Console.Write('*');
  42.                 }
  43.                 else if (tempDepth == 0 && line == depth)
  44.                 {
  45.                     Console.Write(new String('*', width));
  46.                     Console.Write(new String(' ', depth - 1));
  47.                     Console.Write('*');
  48.                 }
  49.                 else if (tempDepth == 0 && line < maxLines-depth-1)
  50.                 {
  51.                     Console.Write('*');
  52.                     Console.Write(new String(' ', width-2));
  53.                     Console.Write('*');
  54.                     Console.Write(new String(' ', depth - 1));
  55.                     Console.Write('*');
  56.                 }
  57.                 else if (tempDepth == 0 && line >= maxLines - depth-1 && tempDepth2 != 0)
  58.                 {
  59.                     Console.Write('*');
  60.                     Console.Write(new String(' ', width - 2));
  61.                     Console.Write('*');
  62.                     Console.Write(new String(' ', tempDepth2-1));
  63.                     Console.Write('*');
  64.                     tempDepth2--;
  65.                 }
  66.                 else if (tempDepth == 0 && tempDepth2 == 0)
  67.                 {
  68.                     Console.Write(new String('*',width));
  69.                 }
  70.                
  71.                 if (tempDepth > 0)
  72.                 {
  73.                     tempDepth--;
  74.                 }
  75.                 Console.WriteLine();
  76.             }
  77.             Console.ReadKey();
  78.         }
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement