Last active
November 16, 2022 20:14
-
-
Save nin-jat/7a18755b07aff61c4f37c1c27de449c6 to your computer and use it in GitHub Desktop.
This shows a cat in your console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// This program draws a cute cat on your console. | |
| /// View more at the gist over here. | |
| /// https://gist.github.com/Those45Ninjas/7a18755b07aff61c4f37c1c27de449c6 | |
| /// | |
| /// This cute cat was sourced from textart4u. | |
| /// http://textart4u.blogspot.com/2013/02/cute-cat-face-ascii-text-art.html | |
| /// | |
| /// Code written by Those45Ninjas | |
| /// </summary> | |
| using System; | |
| class Cat | |
| { | |
| static void Main() | |
| { | |
| // Save the position of the cursor for later. | |
| var oldLeft = Console.CursorLeft; | |
| var oldTop = Console.CursorTop; | |
| // Draw the cat picture. | |
| CatPicture.Draw(ConsoleColor.DarkGray); | |
| // Reset the cursor position so you can continue with your terminal. | |
| Console.SetCursorPosition(oldLeft, oldTop); | |
| } | |
| } | |
| /// <summary> | |
| /// The cat picture class used to draw cats down the bottom right of the terminal. | |
| /// </summary> | |
| static class CatPicture | |
| { | |
| static readonly string[] picture = new string[] | |
| { | |
| " ▓▓█", | |
| " ▒██▒▒█", | |
| " █▓▓▓░▒▓▓", | |
| " ▒█▓▒█░▒▒▒█", | |
| " ▒█▒▒▒█▒▒▒▒▓▒", | |
| "▓▓▒░ ▓█▒▒▒▓██▓▒░▒█", | |
| "█▓▓██▓░ ▓█▒▒▒▒████▒▒▒█", | |
| "▓█▓▒▒▓██▓░ ▒█▒▒▒▒▒██▓█▓░░▓▒", | |
| "▓▒▓▒▒▒▒▒▓█▓░ ░▒▒▓▓██▒▒▒▒▒▒█████▒▒▒▓", | |
| "▓░█▒▒▒▒▒▒▒▓▓█▓█▓▓▓▓▒▒▒▒▒▒▒▒██▓██▒░▒█", | |
| "▓░▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓████▒▒▒█", | |
| "▓░▓██▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓██░░░█", | |
| "▓░▓███▒▒▒▒▒▒▒▒▒▒▒▓█▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▒▓▓", | |
| "▒▒▒██▓▒▓█▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒▓▒█", | |
| " ▓▒█▓▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▓█▓▓▓▓█▓▒▒▒▒▒▒▒▓▒", | |
| " ▓▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓ ▓█▓▒▒▒▒▒▓█", | |
| " ▒▒▓▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▓▓ ░▓▓ █▓▒▒▒▒▒█", | |
| " █▒▒▓▓▓▒▒▓▓▒▒▒▒▒▒▓▓ █████▓ █▓▒▒▒▒▓▒", | |
| " ▓▓█▒ ▒▓▒▒▒▒▒█ ░██████ ░█▒▒▒▒▓▓", | |
| " ▓█▒ ▒███ ▒▓▒▒▒▒█ ██████ ▓▒▒▒▒▒▓", | |
| " ██ █████ █▒▒▒▒█ ███▓ ▓▓▒▒▒▒▓", | |
| " █▓ █████ ▒▓▒▒▒█ █▓▓▓▒▒▓", | |
| " █▓ ░███ ░▓▒▒▒▓█ ░█▓▒▒▒▓▒▓", | |
| " ██ ▒▓▒▒▒▒▓▓ ░▒▓█▓ ░▓▓", | |
| " ▓█░ █▓██▓▒▒▓█▓▓▓▓██▓▓▒▓▒░░▒▓▒▓", | |
| " ▒██░ ▓▒███▓▒▒▒▒▓▓▓▓▒▒▒▒▒▒▓▓▓▓▒▓", | |
| " █▓█▓▓▒▒▓█▓▒░██▒▒▓▓█▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓█▒", | |
| " ▓ ░▓▓▓▓▓▒▓▓▓▓▒▓▓▓▒▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓", | |
| " ▒▒▒▓▒▒▒▒▒▒▓█░ ░░░ ▓▓▒▒▒▒▒▒▒▒▒▒▒▓██▓▒", | |
| " █▓▒▒▒▒▒▒▒▒▓▓ ░░░ ▓▓▒▒▒▒▒▒▒▒▒▓▓▓▒▒▓▒", | |
| " ██▓▓▒▒▒▒▒▒█▒░░░░█▒▒▒▒▒▒▒▒▓█▓▓▒▒▒▒▒", | |
| " ░ ▒██▓▓▒▒▒▒▒█▓▒▒▓▒▒▒▒▒▒▓███▓▒▒▒▒▒▓▓", | |
| " ░▒▓▓▓▓▒▒▓▓▓▓▓▓████▓▓█▒▒▒▒▒▓▓█░" | |
| }; | |
| /// <summary> | |
| /// Draw the cat. | |
| /// </summary> | |
| /// <param name="colour">The to draw the cat in.</param> | |
| public static void Draw(ConsoleColor colour) | |
| { | |
| // Set the colour. | |
| Console.ForegroundColor = colour; | |
| int v = 0; | |
| for (int i = picture.Length - 1; i >= 0; i--, v++) | |
| { | |
| // Move the cursor to the right minus the width of the picture. | |
| Console.CursorLeft = Console.WindowWidth - 39; | |
| // Move the cursor to the bottom minus the vertical offset. | |
| Console.CursorTop = Console.WindowHeight - v; | |
| // Draw a line of the picture. | |
| Console.Write(picture[i]); | |
| // Move to the next line unless it's the last one (for is in reverse (forr)) | |
| if (i != 0) | |
| Console.WriteLine(); | |
| } | |
| // Reset the colour because we are good programmers. | |
| Console.ResetColor(); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like this.