JavaScript (ES6), 443 431
Edit bug fix, problem during input parse, removing blank columns
F=t=>(a=b=c=d=e=f=g=h=0,M=Math.min,
t=t.split('\n').filter(r=>r.trim()>''),
t=t.map(r=>r.slice(M(...t.map(r=>r.search(/\S/))))),
t.map((r,i)=>i&1&&[...r].map((_,j)=>j&1&&r[j-1]==r[j+1]&t[i-1][j]==t[i+1][j]&r[j-1]=='|'
&&(y=i>>1,x=j>>1,z=y*5,w=x*5,a|=1<<(z+x),e|=1<<(w+y),b|=1<<(4+z-x),f|=1<<(4+w-y),c|=1<<(20-z+x),g|=1<<(20-w+y),d|=1<<(24-z-x),h|=1<<(24-w-y)
))),~[1505,2530,3024,4578,252,6552,2529,4577,2499,4547,7056].indexOf(M(a,b,c,d,e,f,g,h)))
That's very long, and even longer as parsing input is a big part of the task.
What I do is verifyng if the given input is one of the 11 foldable hexominoes.
Each foldable hexomino can be mapped to some 5x5 bitmap (up to 8 different, with simmetry and rotations). Taken the bitmaps as 25bit number, I have found the min values for the 11 noted hexominoes, using the following code (with very simple input format)
h=[ // Foldable hexominoes
'o\noooo\no', ' o\noooo\n o', // pink
'o\noooo\n o', ' o\noooo\n o', 'ooo\n ooo', 'oo\n oo\n oo', //blue
'o\noooo\n o', 'o\noooo\n o', 'oo\n ooo\n o', 'oo\n ooo\n o', 'o\nooo\n oo' // gray
]
n=[]
h.forEach(t=>(
a=[],
t.split('\n')
.map((r,y)=>[...r]
.map((s,x)=>s>' '&&(
a[0]|=1<<(y*5+x),a[1]|=1<<(x*5+y),
a[2]|=1<<(y*5+4-x),a[3]|=1<<(x*5+4-y),
a[4]|=1<<(20-y*5+x),a[5]|=1<<(20-x*5+y),
a[6]|=1<<(24-y*5-x),a[7]|=1<<(24-x*5-y))
)
),
n.push(Math.min(...a))
))
That gives [1505,2530,3024,4578,252,6552,2529,4577,2499,4547,7056]
So, given the input string, I have to do the same to find the min bitmap, then return true if this number is present in my precalc list.
// Not so golfed
F=t=>(
a=b=c=d=e=f=g=h=0,M=Math.min,
t=t.split('\n').filter(r=>r.trim()>''), // remove blank lines
t=t.map(r=>r.slice(M(...t.map(r=>r.search(/\S/))))), // remove blank colums to the left
t.map((r,i)=>i&1&&[...r] // only odd rows
.map((_,j)=>j&1&& // only odd columns
r[j-1]==r[j+1]&t[i-1][j]==t[i+1][j]&r[j-1]=='|' // found a cell
&&(y=i>>1,x=j>>1,z=y*5,w=x*5, // find bitmaps for 8 rotations/simmetries
a|=1<<(z+x),e|=1<<(w+y),
b|=1<<(4+z-x),f|=1<<(4+w-y),
c|=1<<(20-z+x),g|=1<<(20-w+y),
d|=1<<(24-z-x),h|=1<<(24-w-y)
))),
~[1505,2530,3024,4578,252,6552,2529,4577,2499,4547,7056].indexOf(Math.min(a,b,c,d,e,f,g,h)) // look for min
)
Run snippet to test in Firefox
F=t=>(a=b=c=d=e=f=g=h=0,M=Math.min,
t=t.split('\n').filter(r=>r.trim()>''),
t=t.map(r=>r.slice(M(...t.map(r=>r.search(/\S/))))),
t.map((r,i)=>i&1&&[...r]
.map((_,j)=>j&1&&r[j-1]==r[j+1]&t[i-1][j]==t[i+1][j]&r[j-1]=='|'
&&(y=i>>1,x=j>>1,z=y*5,w=x*5,
a|=1<<(z+x),e|=1<<(w+y),b|=1<<(4+z-x),f|=1<<(4+w-y),c|=1<<(20-z+x),g|=1<<(20-w+y),d|=1<<(24-z-x),h|=1<<(24-w-y)
))),~[1505,2530,3024,4578,252,6552,2529,4577,2499,4547,7056].indexOf(M(a,b,c,d,e,f,g,h)))
s=[...' \n \n \n 2 \n \n '],o=7,l=5,k={},t=0
out=[[],[]]
Test=s=>k[s]?0 // filter duplicates, but allow same shape in different position
:k[s]=(
p=Array(13).fill(0).map(x=>Array(13).fill(' ')), // build string to test in long format
s.map((v,i)=>(x=2*(i%7),y=2*(i/7|0),-v&&(
p[y][x]=p[y][x+2]=p[y+2][x]=p[y+2][x+2]='+',
p[y][x+1]=p[y+2][x+1]='-',
p[y+1][x]=p[y+1][x+2]='|'
))),
s=p.map(r=>r.join('')).join('\n'),
ok=F(s), // test
out[!ok|0].push('\n'+s+-ok),
1
)
Fill=(z,p)=>(
s[p]=2,
z>l?Test(s):s.forEach((v,i)=>v==' '&(s[i+o]==2|s[i-o]==2|s[i-1]==2|s[i+1]==2)?Fill(z+1,i):0),
s[p]=' '
)
Fill(1,s.indexOf('2'))
OV.innerHTML=out[0].join('\n')
OI.innerHTML=out[1].join('\n')
pre {
overflow: auto;
font-size: 9px;
height: 500px;
display: block;
border: 1px solid #888;
padding: 6px 20px;
line-height: 6px;
}
Verify all hexominoes possible in a 6x6 grid (Better full page) <br>
<table><tr>
<th>VALID</th><th>INVALID</th>
</tr><tr>
<td><pre id=OV></pre></td>
<td><pre id=OI></pre></td>
</tr></table>
1Can you explain why there is an image-processing tag here ? Neither the question, nor the answer will have to do any kind of image processing to solve the challenge. – Optimizer – 2015-05-10T11:32:52.510
Clarification about leading/trailing space: are unnecessary leading/trailing spaces on each row and unnecessary newlines allowed in input ? Should I be able to manage a 1000+ chars input? – edc65 – 2015-05-10T13:08:51.570
@edc65 yes you should expect the unnecessary white space you describe. 1000 chars max input size seems reasonable - I'll edit that in – Digital Trauma – 2015-05-10T16:46:05.993
Hmm. I wonder how many cube hexominoes can be squeezed, juxtaposed, on a printed page? – luser droog – 2015-11-18T06:43:06.917