()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
\::\433832|
\::\79502|
\::\8841|
\::\971|
\::\69|
\::\3|
\__\|
I did a codegolf the other day where the objective was to print out the above ASCII-art in the shortest amount of code possible. The code I came up with looks like this:
This file contains 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
[0,2384626,433832,79502,8841,971,69,3,1].map{|n|puts n<1?"()"*6+"\n|\\3.1415926|\n|:\\53589793|":"\\#{n>1?"::\\#{n}":"__\\"}|".rjust(12)} |
This file contains 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
for n in [0,2384626,433832,79502,8841,971,69,3,1] | |
if n < 1 # top part of the pie | |
puts "()"*6+"\n|\\3.1415926|\n|:\\53589793|" | |
else | |
if n > 1 # filling of the pie | |
puts "\\::\\#{n}|".rjust(12) | |
else # bottom part of the pie | |
puts "\\__\\|".rjust(12) | |
end | |
end | |
end |
\\::\\n|
where n
is the current section of pi. For the bottom part I just printed out \\__\\|
. I used rjust
to get the pie to be right alligned.Anyway, that's it for today. I've gotta go bake some raspberry pi, thanks for reading my post!