EvilZone

Programming and Scripting => Scripting Languages => Topic started by: daxda on October 23, 2013, 04:28:40 PM

Title: [Source] text2Ascii.py
Post by: daxda on October 23, 2013, 04:28:40 PM
I had nothing better to do and was looking for an easy project to realise, idea from Deque (http://www.hackcommunity.com/Thread-text-to-ascii-art-converter), thanks!
As always, take from it what you want, use it how you like.

[gist]Daapii/7119814[/gist]
Title: Re: [Source] text2Ascii.py
Post by: vezzy on October 23, 2013, 05:21:49 PM
What an ugly bowl of spaghetti. The font looks pretty similar to Figlet, too.
Title: Re: [Source] text2Ascii.py
Post by: vezzy on October 23, 2013, 06:12:45 PM
Try to think of a more elegant and structured way to achieve this than sloppy brute-force substitution, as it is now.
Title: Re: [Source] text2Ascii.py
Post by: Deque on October 23, 2013, 07:19:48 PM
Whenever you catch yourself writing repetitive code all over the place your allarm bells should ring.
There is this rule (I don't know who invented it) that says: If you repeat something three times or more, refactor it.
You are repeating - well - much more.
As I told you on HC you may look at some similar codes there to get ideas.
Title: Re: [Source] text2Ascii.py
Post by: daxda on October 23, 2013, 07:23:38 PM
Thanks for your feedback aswell Deque!
I'm aware that this way is very repetetive, I didn't know of a better way to do it.
I'll give the other people's code a read.