Look for symmetry
Sometimes the required ASCII art is symmetric at some point. For example, Argyle ASCII Art requires an output similar to this:
/\ /\
/ \ /\ / \
/\/ \/ \/ \/\
\/\ /\ /\ /\/
\ / \/ \ /
\/ \/
One could just print this normally, but depending on the language, the code required can be shortened by only generating the top half of the result, reversing it and swapping /
and \
.
Try transposing
In ASCII Art Archery Arrows the result to print is this, scaled to a given n
:
/\
/ \
/ \
/ \
\ /
\____/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
/| |\
/ | | \
/ | | \
/ | | \
/ | | \
/ |__| \
/ / \ \
/ / \ \
// \\
/ \
If we take a look at the arrow, we can see there's 8 kinds of lines:
/ \
\ /
\_/
| |
/ | | \
/ |_| \
/ / \ \
/ \
Let's try the same for its transpose.
///////
/ /
/\ / /
/ \ / /
/ _||||||||||||||||||||||
/ _ _
\ _ _
\ _||||||||||||||||||||||
\ / \ \
\/ \ \
\ \
\\\\\\\
Here, there are 10 kinds of lines.
/
/ /
/ \ / /
/ _|
/ _ _
\ _ _
\ _|
\ / \ \
\ \
\
But here's the catch: the bottom 5 are identical to the top 5, except for swapping /
and \
. As per the previous rule, you can first generate the first 5, copy, do the swap, and finally transpose to get the arrow. This can save a lot of code.