Kevin,
really good brute force solver, you've made!
Are you sure
return solve(a, b, c+1, 0) if d==3
return solve(a, b+1, 0, d) if c==3
return solve(a+1, 0, c, d) if b==3
shouldn't be
return solve(a, b, c+1, 0) if d==3
return solve(a, b+1, 0, 0) if c==3
return solve(a+1, 0, 0, 0) if b==3
?
(I rewrote it in Ruby)
regards
Christer