Skip to main content
3 of 4
saved 5 bytes
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6),  55 53  48 bytes

Thanks to @KevinCruijssen for noticing that I was not fully assuming \$a\le b\$ (saving 5 bytes)

Takes input as (a)(b) with \$a\le b\$. Returns \$0\$ (valid), \$1\$ (ended) or \$2\$ (invalid).

a=>b=>a<0|a>29|b>30|b>21&b-a>2?2:b>20&b-a>1|b>29

Try it online!

Arnauld
  • 197.8k
  • 20
  • 180
  • 650