# [Ruby], 63 bytes <!-- language-all: lang-ruby --> ->a,b{(r=1-a...a).map{|x|r.map{|y|(x-y)*(y+=x)==0&&b>0?2:y%2}}} [Try it online!][TIO-kvc50m3d] [Ruby]: https://www.ruby-lang.org/ [TIO-kvc50m3d]: https://tio.run/##KypNqvyfZvtf1y5RJ6lao8jWUDdRT08vUVMvN7GguqaipgjCqKzRqNCt1NTSqNS2rdC0tTVQU0uyM7A3sqpUNaqtrf1fUFpSrJAWbaRjEAvSoKFmlZlXXJCaXKLJBZLigsqbEpA30THEkP8PAA "Ruby – Try It Online"