Matlab, 292
I am sure this can be shortened a lot just by porting it into another language.
The basic idea is bruteforcing: I came up with kind of an enumeration of all ways how to place m*n/2 domino bricks on an m*n board. But this enumeration also includes many invalid tilings (bricks that overlap or go outside of the board.) So the program constructs all those tilings, and only counts the valid ones. The runtime complexity is about O(2^(m*n/2) * m*n). Memory is not a problem for the 8x8 as it only needs O(m*n) memory. But the time needed for 8x8 is about 20 days.
Here the fully commented version that explains what is going on.
PS: If anyone knows how to make the Matlab syntax highlighting work, please include the corresponding tag in this answer!
function C=f(m,n)
d = ceil(m*n/2);%number of dominoes
%enumeration: %the nth bit in the enumeration says whether the nth
% domino pice is upright or not. we enumerate like this:
% firt piece goes top left:
% next piece goes to the left most column that has an empty spot, in the
% top most empty spot of that column
C=0;%counter of all valid tilings
for e=0:2^d-1 %go throu all enumerations
%check whether each enumeration is valid
A = ones(m,n);
%empty spots are filled with 1
%filled spots are 0 (or if overlapping <0)
v=1;%flag for the validity. hte grid is assumed to be valid until proven otherwise
for i=1:d %go throu all pieces, place them in A
%find the column where to place:
c=find(sum(A)>0,1);
%find the row where to place:
r=find(A(:,c)>0,1);
%find direction of piece:
b=de2bi(e,d);
if b(i)
x=0;y=1;
else
x=1;y=0;
end
%fill in the piece:
try
A(r:r+y,c:c+x)=A(r:r+y,c:c+x)-1;
catch z
v=0;break;
end
%check whether A has no overlapping pieces
if any(A(:)<0)
v=0;break;
end
end
%if valid, count it as valid
if v && ~norm(A(:))
disp(A)
C=C+1;
end
end
Here the fully golfed one:
function C=f(m,n);m=4;n=6;d=ceil(m*n/2);C=0;for e=0:2^d-1;A=ones(m,n);v=1;for i=1:d;c=find(sum(A)>0,1);r=find(A(:,c)>0,1);b=de2bi(e,d);if b(i);x=0;y=1;else;x=1;y=0;end;try;A(r:r+y,c:c+x)=A(r:r+y,c:c+x)-1;catch z;v=0;break;end;if any(A(:)<0);v=0;break;end;end;if v && ~norm(A(:));C=C+1;end;end
You could have made our life much easier if you only had allowed 2n x 2m areas, nice challenge!
– flawr – 2015-08-24T12:30:39.073Just like this question http://codegolf.stackexchange.com/q/51067/15599 only shorter, and slower
– Level River St – 2015-08-24T12:55:53.170@edc65 Damnit =/ I can't seem to think of anything novel... Almost every challenge I think of has already been done in some form. Either way, the challenges are not exactly the same since my question is a code golf, and you don't have to find the tilings - only the amount of them. Maybe people can use nice formulas instead of writing a bruteforcer. – orlp – 2015-08-24T13:15:17.380
Agreed - going to remove the other comment – edc65 – 2015-08-24T13:17:16.720
Copied bilbo's comment (which he posted as an answer due to 1 rep): "This problem is a SPOJ challenge shorten: http://www.spoj.com/problems/MNTILE/ The shortest code on SPOJ is 98 bytes in awk.". Seems like I'm doubly unoriginal - I was unaware.
– orlp – 2015-08-24T13:25:10.953@flawr, the fully general solution isn't much more complicated than that (and in some senses it's less complicated). The tricky thing is dealing with numerical issues in a way that's provably correct.
– Peter Taylor – 2015-08-24T16:53:46.793Incidentally, as a dimer tiling question, this is very closely related to http://codegolf.stackexchange.com/q/51266/194
– Peter Taylor – 2015-08-24T16:55:05.183