Task: Write language name in 3D ASCII



C#: using System;
using System.Text;

namespace Language_name_in_3D_ascii
{
    public class F5
    {
        char[] z = { ' ', ' ', '_', '/', };
        long[,] f ={
            {87381,87381,87381,87381,87381,87381,87381,},
            {349525,375733,742837,742837,375733,349525,349525,},
            {742741,768853,742837,742837,768853,349525,349525,},
            {349525,375733,742741,742741,375733,349525,349525,},
            {349621,375733,742837,742837,375733,349525,349525,},
            {349525,375637,768949,742741,375733,349525,349525,},
            {351157,374101,768949,374101,374101,349525,349525,},
            {349525,375733,742837,742837,375733,349621,351157,},
            {742741,768853,742837,742837,742837,349525,349525,},
            {181,85,181,181,181,85,85,},
            {1461,1365,1461,1461,1461,1461,2901,},
            {742741,744277,767317,744277,742837,349525,349525,},
            {181,181,181,181,181,85,85,},
            {1431655765,3149249365L,3042661813L,3042661813L,3042661813L,1431655765,1431655765,},
            {349525,768853,742837,742837,742837,349525,349525,},
            {349525,375637,742837,742837,375637,349525,349525,},
            {349525,768853,742837,742837,768853,742741,742741,},
            {349525,375733,742837,742837,375733,349621,349621,},
            {349525,744373,767317,742741,742741,349525,349525,},
            {349525,375733,767317,351157,768853,349525,349525,},
            {374101,768949,374101,374101,351157,349525,349525,},
            {349525,742837,742837,742837,375733,349525,349525,},
            {5592405,11883957,11883957,5987157,5616981,5592405,5592405,},
            {366503875925L,778827027893L,778827027893L,392374737749L,368114513237L,366503875925L,366503875925L,},
            {349525,742837,375637,742837,742837,349525,349525,},
            {349525,742837,742837,742837,375733,349621,375637,},
            {349525,768949,351061,374101,768949,349525,349525,},
            {375637,742837,768949,742837,742837,349525,349525,},
            {768853,742837,768853,742837,768853,349525,349525,},
            {375733,742741,742741,742741,375733,349525,349525,},
            {192213,185709,185709,185709,192213,87381,87381,},
            {1817525,1791317,1817429,1791317,1817525,1398101,1398101,},
            {768949,742741,768853,742741,742741,349525,349525,},
            {375733,742741,744373,742837,375733,349525,349525,},
            {742837,742837,768949,742837,742837,349525,349525,},
            {48053,23381,23381,23381,48053,21845,21845,},
            {349621,349621,349621,742837,375637,349525,349525,},
            {742837,744277,767317,744277,742837,349525,349525,},
            {742741,742741,742741,742741,768949,349525,349525,},
            {11883957,12278709,11908533,11883957,11883957,5592405,5592405,},
            {11883957,12277173,11908533,11885493,11883957,5592405,5592405,},
            {375637,742837,742837,742837,375637,349525,349525,},
            {768853,742837,768853,742741,742741,349525,349525,},
            {6010197,11885397,11909973,11885397,6010293,5592405,5592405,},
            {768853,742837,768853,742837,742837,349525,349525,},
            {375733,742741,375637,349621,768853,349525,349525,},
            {12303285,5616981,5616981,5616981,5616981,5592405,5592405,},
            {742837,742837,742837,742837,375637,349525,349525,},
            {11883957,11883957,11883957,5987157,5616981,5592405,5592405,},
            {3042268597L,3042268597L,3042661813L,1532713813,1437971797,1431655765,1431655765,},
            {11883957,5987157,5616981,5987157,11883957,5592405,5592405,},
            {11883957,5987157,5616981,5616981,5616981,5592405,5592405,},
            {12303285,5593941,5616981,5985621,12303285,5592405,5592405,}
            };

        private F5(string s)
        {
            StringBuilder[] o = new StringBuilder[7];
            for (int i = 0; i < 7; i++) o[i] = new StringBuilder();
            for (int i = 0, l = s.Length; i < l; i++)
            {
                int c = s[i];
                if (65 <= c && c <= 90) c -= 39;
                else if (97 <= c && c <= 122) c -= 97;
                else c = -1;
                long[] d = new long[7];
                Buffer.BlockCopy(f, (++c * sizeof(long) * 7), d, 0, 7 * sizeof(long));
                for (int j = 0; j < 7; j++)
                {
                    StringBuilder b = new StringBuilder();
                    long v = d[j];
                    while (v > 0)
                    {
                        b.Append(z[(int)(v & 3)]);
                        v >>= 2;
                    }
                    char[] charArray = b.ToString().ToCharArray();
                    Array.Reverse(charArray);
                    o[j].Append(new string(charArray));
                }
            }
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 7 - i; j++)
                    System.Console.Write(' ');
                System.Console.WriteLine(o[i]);
            }
        }

        public static void Main(string[] args)
        {
            new F5(args.Length > 0 ? args[0] : "C sharp");
        }
    }
}







COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. cobol-3d.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  cobol-area.
           03  cobol-text-data PIC X(1030) VALUE "________/\\\\\\\\\____
      -        "____/\\\\\________/\\\\\\\\\\\\\__________/\\\\\________
      -        "/\\\_____________         _____/\\\////////_______/\\\//
      -        "/\\\_____\/\\\/////////\\\______/\\\///\\\_____\/\\\____
      -        "_________         ___/\\\/______________/\\\/__\///\\\__
      -        "_\/\\\_______\/\\\____/\\\/__\///\\\___\/\\\____________
      -        "_         __/\\\_______________/\\\______\//\\\__\/\\\\\
      -        "\\\\\\\\\____/\\\______\//\\\__\/\\\_____________       
      -      "  _\/\\\______________\/\\\_______\/\\\__\/\\\/////////\\\
      -        "__\/\\\_______\/\\\__\/\\\_____________         _\//\\\_
      -        "____________\//\\\______/\\\___\/\\\_______\/\\\__\//\\\
      -        "______/\\\___\/\\\_____________         __\///\\\_______
      -        "_____\///\\\__/\\\_____\/\\\_______\/\\\___\///\\\__/\\\
      -        "_____\/\\\_____________         ____\////\\\\\\\\\_____\
      -        "///\\\\\/______\/\\\\\\\\\\\\\/______\///\\\\\/______\/\
      -        "\\\\\\\\\\\\\\_         _______\/////////________\/////_
      -        "_______\/////////////__________\/////________\//////////
      -        "/////__" 
               .
           03  cobol-text-table REDEFINES cobol-text-data.
               05  cobol-text  PIC X(103) OCCURS 10 TIMES.

       01  i                   PIC 99.
       01  j                   PIC 9(4).

       PROCEDURE DIVISION.
           
           PERFORM VARYING i FROM 1 BY 1 UNTIL 10 < i
               MOVE 1 TO j
               PERFORM UNTIL 103 < j
                   
                   
                   IF cobol-text (i) (j:4) = "\\\/"
                       DISPLAY cobol-text (i) (j:3) AT LINE i COL j
                           WITH FOREGROUND-COLOR 7, HIGHLIGHT
                           
                       ADD 3 TO j
                       DISPLAY cobol-text (i) (j:1) AT LINE i COL j
                           WITH FOREGROUND-COLOR 0, HIGHLIGHT

                       ADD 1 TO j
                           
                       EXIT PERFORM CYCLE
                   END-IF
                       
                   
                   
                   IF cobol-text (i) (j:1) = "/" 
                          OR cobol-text (i) (FUNCTION SUM(j, 1):1) = "/"
                          OR cobol-text (i) (FUNCTION SUM(j, 1):2)
                              = "\/"
                       DISPLAY cobol-text (i) (j:1)  AT LINE i COL j
                           WITH FOREGROUND-COLOR 0, HIGHLIGHT
                   
                   ELSE
                       DISPLAY cobol-text (i) (j:1) AT LINE i COL j
                           WITH FOREGROUND-COLOR 7 , HIGHLIGHT
                   END-IF

                   ADD 1 TO j
               END-PERFORM
           END-PERFORM

           
           
           
           DISPLAY "Press enter to stop appreciating COBOL in 3D."
               AT LINE 11 COL 1
           ACCEPT i AT LINE 11 COL 46

           GOBACK
           .