Skip to main content
1 of 4
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6), 55 bytes

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

a=>b=>3*(a<0|a>29|b>30|b>21&(a-=b)*a>4)|b>20&a*a>1|b>29

Try it online!

Arnauld
  • 197.8k
  • 20
  • 180
  • 650