Write all possible Braille characters An interesting puzzle came to me looking at the elevator buttons this morning.

You are required to generate a list of all Braille patterns that fit in a 2x3 grid.  Use a hash # to denote a bump and a hyphen - to denote a flat area.

Expected output sample:

#-
--
--

##
--
--

#-
#-
--

(and so on...)


Rules:


Your program must separate each pattern by at least one character or line.
The patterns may be generated in any order.
All patterns, regardless of what the Braille alphabet actually uses, should be produced.  The completely blank pattern is optional.
Only unique bump patterns should be generated.  The following patterns are considered equivilent as the bumps are in an identical arangement.  In these cases, use the pattern that is closest to the top-left corner (ie. the first option in this example.)  




#-  -#  --  --
#-  -#  #-  -#
--  --  #-  -#


Bonus points if you can make it work for any x by y sized grid. (EDIT: Within reasonable bounds.  Up to 4x4 is enough for proof of concept.)

Reading the wiki article, it appears there are 45 patterns (including the blank) that meet this puzzle's rules.
GolfScript, 34 32 chars

44,{84+2base(;{'-#'=}/@\n.}%2/n*


Turns out that there are shorter solutions than simply generating all 64 patterns and filtering out the bad ones.  In fact, by suitably mapping bits to grid positions, it's possible to map all valid (non-empty) patterns to a consecutive range of numbers, as this program does.

Specifically, the mapping I use is:

5 4
3 1
2 0


where the numbers denote the bit position (starting from the least significant bit 0) mapped to that position in the grid.  With this mapping, the valid grids correspond to the numbers 20 to 63 inclusive.

This is almost the same as the obvious mapping obtained by writing out the 6-bit number in binary and adding line breaks between every second bit, except that the bits 1 and 2 are swapped &mdash; and indeed, that's exactly how my program computes it.  (I also add 64 to the numbers before converting them to binary, and then strip the extra high bit off; that's just to zero-pad the numbers to 6 bits, since GolfScript's base would otherwise not return any leading zeros.) 

Ps. Online demo here. (Server seems overloaded lately; if you get a timeout, try again or download the interpreter and test it locally.)

Edit: Managed to save two chars by avoiding unnecessary array building and dumping.  Phew!