问题
I once did a programming test for a job, which involved producing ASCii art in C#. I didn't really do well at this, as I had little idea or experience of doing this in C# (or in any programming knowledge).
Are there any resources or classes in .NET that would be worth knowing/practising on?
回答1:
Have a read at this post http://www.c-sharpcorner.com/UploadFile/dheenu27/ImageToASCIIconverter03022007164455PM/ImageToASCIIconverter.aspx
It allows you to upload an image which will be converted into ASCII art :) Pretty cool stuff.
CodeProject has a sample too http://www.codeproject.com/KB/web-image/ascii_art_with_c_.aspx
回答2:
ASCII art is pretty general, but if you want to produce an ASCII banner or heading then I've ported the popular FIGlet font generation to .NET:
https://github.com/drewnoakes/figgle
It's very easy to use, and available on NuGet for almost every version of .NET (netstandard1.3
and above, so .NET Framework as well as .NET Core, Xamarin, etc...).
_ _ __ __ _ _ _
/\ /\___| | | ___ / / /\ \ \___ _ __| | __| | / \
/ /_/ / _ \ | |/ _ \ \ \/ \/ / _ \| '__| |/ _` |/ /
/ __ / __/ | | (_) | \ /\ / (_) | | | | (_| /\_/
\/ /_/ \___|_|_|\___( ) \/ \/ \___/|_| |_|\__,_\/
|/
Produced via:
Console.WriteLine(
FiggleFonts.Ogre.Render("Hello, World!"));
回答3:
To understand the full ASCII "spectrum" one should know about the ASCII Chart, also known as the ASCII Table.
http://www.asciitable.com/
Knowing that, one could take code found in the codeproject link and make something "unique" with it. :-)
If you think about it, it's just a "look-up" table and you can pull a value out of it and do anything you want.
来源:https://stackoverflow.com/questions/3436132/producing-ascii-art-via-c-sharp