Use regexp to check four 4-in-a-row horizontally and vertically

Also slight refactor