We have 4 different points on the x-y plane and we know NO three of them are collinear. The coordinates are $p_1 (x_1 ,y_1) , p_2 (x_2 , y_2) , p'_1 (x'_1 , y'_1) , p'_2 (x'_2, y'_2)$. The first two points ($p_i$) are Red and the second two points ($p'_i$) are blue. We want to find two equation of lines ($y = a x + b$ and $y = a' x + b'$) such that if we graph them on x-y planes, they partition the plane in a way that no points with different colors get in the same partition. (The picture below is a valid diagram that satisfies the conditions - different colors are different shapes (cross and circle) in this picture)
Now I want to find an algorithm that finds at least one $a$ and $b$ and $a'$ and $b'$ such that they satisfy the problem statements. The question statements also mentioned that in very rare conditions, there is maybe no answer to the problem so we must also make sure it has at least one answer.
The question is actually a C programming problem but I think the main part of the question is a combinatorial geometry math problem and programming it with knowing the mathematical answer will be easy. albeit, it was not meant to be solved with very advanced Computer Science algorithms. It is meant to be solved with basic things like "loop", "if" and 'array' and not advanced algorithms like graphs and etc. But if you think they are necessary, you can use them.
I really don't know how to approach these type of questions where a lot of different conditions may happen. And absolutely we can't check a lot of different $a , b , a' ,b '$ even with a powerful computer. We want an algorithm that find these perhaps by doing some math -and logical checks- on the coordinates.
It is also said that all ($x_i , y_i,x'_i , y'_i , a , b , a' ,b'$)are integers. And in special conditions, the line can be$ x= c'$ , $x =c'$ (not in the usual $y = ax + b$ form) (if there is no integer $a,b,a',b'$ you can assume they are floats but integers answers are preferred)
I first asked this in math.stackexchange but now I think it is more related to Computer Science part of the stackexchange.
Sorry for my English. If the question isn't clear enough, ask the problem so I may clarify it.