CJam, 33 bytes
La'|ali({_'|f+@"——"f++}*\;{N+_N}/
This is an iterative implementation of a recursive algorithm:
The possible tilings for n can be obtained by adding a vertical domino to the possible tilings for n - 1 and a horizontal domino to the possible tilings for n - 2. This way, the number of tilings for n is the sum of the numbers of tilings for n - 1 and n - 2, i.e., the nth Fibonacci number.
How it works
La'|a " A:= [''] B:= ['|'] ";
li({ }* " Repeat int(input()) - 1 times: ";
_'|f+ " C = copy(B); for T ∊ C: C += '|' ";
@ " Swap A and B. ";
"--"f+ " for T ∊ B: T += '--' ";
+ " B = C + B ";
\; " Discard A. ";
{N+_N}/ " for T ∊ B: print T + '\n', T + '\n', '\n' ";
Example run
$ cjam domino.cjam <<< 3
|||
|||
——|
——|
|——
|——
$ for i in {1..10}; do echo $[$(cjam domino.cjam <<< $i | wc -l) / 3]; done
1
2
3
5
8
13
21
34
55
89
Dennis
- 211.7k
- 41
- 380
- 830