Skip to main content
added 309 characters in body
Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

JavaScript (ES6), 50 bytes

f=a=>a.map(_=>a.map((e,i)=>a[a[i]|=a[--i],i]&=e))&&a

Just some bit-twiddlingExplanation: Suppose two rows of the wall were like this:

0011
0101

The result needs to be this:

0001
0111

In other words, the first row becomes the AND of the two rows and the second row becomes the OR of the two rows. This just needs to be repeated enough times for all the bits to fall to the bottom.

JavaScript (ES6), 50 bytes

f=a=>a.map(_=>a.map((e,i)=>a[a[i]|=a[--i],i]&=e))&&a

Just some bit-twiddling.

JavaScript (ES6), 50 bytes

f=a=>a.map(_=>a.map((e,i)=>a[a[i]|=a[--i],i]&=e))&&a

Explanation: Suppose two rows of the wall were like this:

0011
0101

The result needs to be this:

0001
0111

In other words, the first row becomes the AND of the two rows and the second row becomes the OR of the two rows. This just needs to be repeated enough times for all the bits to fall to the bottom.

Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

JavaScript (ES6), 50 bytes

f=a=>a.map(_=>a.map((e,i)=>a[a[i]|=a[--i],i]&=e))&&a

Just some bit-twiddling.