Skip to main content
5 of 7
saved 1 byte
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

JavaScript (ES6),  142 ... 122  121 bytes

Expects an array of characters, e.g. ['5','1','2']. Returns 0 or 1.

a=>a.map(n=>D=D.map((_,i)=>D['504405076067'[d*6+i>>1]^i],p+=[w=a.length,-w,1,-1][d=D.indexOf(n)]),p=0,D=[...'254316'])|!p

Try it online!

Arnauld
  • 197.8k
  • 20
  • 180
  • 650