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 programming problem but I think the main part of the question is a combinatorial geometry math problem and programming it with knowing the answer is not difficult. So I asked it here. 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)
Sorry for my English. If the question isn't clear enough, ask the problem so I may clarify it.

Calculate the line running through two points of the same colour. If the other two points are on one side you can simply shift this line a bit and you have finished.
In case that this is does not hold you can consider their respective distances to the line and put in intermediate lines in the margin.