Giovanni Intini wrote:

>>     32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"},$/}
> 
> This really is wonderful, but the most wonderful thing its that I
> cannot understand it intuitively :(

32.times{|y|...}: We are going to output 32 lines and we'll need to know 
the line number as we iterate over each of them.

print" "*(31-y), ...: Print 31 - current line number spaces. This will 
print 31 spaces for the first line and 0 for the last one. This is 
needed for centering the pyramid segment. Try removing it and it will be 
stuck to the left border of the screen.

(0..y).map{|x|...}: produce y+1 segments. We will produce one for the 
first line and 32 ones for the last line. The pyramid will be wider at 
the bottom.

~y&x>0?" .":" A": The heart of the algorithm. Let's explain it by sample.

    y: 000000
   ~y: 111111
    x: 000000
~y&x: 000000
=> " A"

The segment for the first line is [" A"]

    y: 000001
   ~y: 111110
    x: 000000
~y&x: 000000
=> " A"
    y: 000001
   ~y: 111110
    x: 000001
~y&x: 000000
=> " A"

The segment for the second line is [" A"," A"]

    y: 000010
   ~y: 111101
    x: 000000
~y&x: 000000
=> " A"
    y: 000010
   ~y: 111101
    x: 000001
~y&x: 000001
=> " ."
    y: 000010
   ~y: 111101
    x: 000010
~y&x: 000000
=> " A"

The segment for the third line is [" A"," ."," A"]

The segment for the fourth line is boringly just [" A"," A"," A"," A"]

    y: 000100
   ~y: 111011
    x: 000000
~y&x: 000000
=> " A"
    y: 000100
   ~y: 111011
    x: 000001
~y&x: 000001
=> " ."
    y: 000100
   ~y: 111011
    x: 000010
~y&x: 000010
=> " ."
    y: 000100
   ~y: 111011
    x: 000011
~y&x: 000011
=> " ."
    y: 000100
   ~y: 111011
    x: 000100
~y&x: 000000
=> " A"

The segment for the fifth line is [" A"," ."," ."," ."," A"]

At this point we already have this:

     A
    A A
   A . A
  A A A A
A . . . A

You can already make out the top of the pyramid. The rest works out just 
as well.

I still have to explain how the segments get printed however:

print...,(0..y).map{...}: When print gets an argument that is not 
already a String it calls .to_s on it -- Array#to_s is the same as 
Array#join without an argument -- it just chains the items together 
without a separator.

print...,$/: $/ is the output record separator. It is just a shorter way 
of saying "\n". Note that puts could not have been used instead of print 
because it also inserts a newline between all its arguments. That would 
not work here.

Hope this helped at understanding it post-intuitively. The hardest to 
understand is the algorithm it uses.