#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
#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