# [R], 73 bytes <!-- language-all: lang-r --> function(m,n,d=t(diff(m)),w=which,x=w(d>0)%%n)any(x[seq(y<-w(d<0)%%n)]-y) [Try it online!][TIO-km3gtlpu] [R]: https://www.r-project.org/ [TIO-km3gtlpu]: https://tio.run/##1ZLLasMwEEX38xWqISCBEmb62EVZ9ifaLowf2Asrre3G9te7xlLlUVZNuypCcJDQnZl71c6lmctPm/X12cpGW52bXuZ1WcpGKT2YoaqzSo9mkPkJ1W5nVWonOb50xYecjvvl@OiO3/aTmhuTdocm7dt6lG2R5oesu8jKPGvRFe8mEYkWfTH2JsFXS4lScLfU0YIUwI@fAgpcNgGtG2HTub9Zh9ZNq94fdNwKRJ6IkbuliMiTe0GMMCL0RIzW@QMhI2KEjDBUw1BtnZ4RMnLeICPyRGGOa6JwS0GZgvJ3p5xcft74p9uNh80qbxiwNmGzICr08JuEIfYneAd84i23kD3w6Vk2cPUzYPsVxLKOGn/8v43PXw "R – Try It Online" Based on the idea in [Leo's Husk answer](https://codegolf.stackexchange.com/a/220491/78274). Takes input as a matrix `m` of 1s and 0s with each pattern corresponding to a row, and the size of the pattern `n`. Outputs a swapped T/F value (in the footer, the results are swapped back).