public static void Main()
Random rnd = new Random();
int w = Polygon.GetClientWidth();
int h = Polygon.GetClientHeight();
Point yBottom = new Point(0, -h / 2);
Point yTop = new Point(0, h / 2);
Polygon yAxis = new Polygon(yBottom, yTop);
Point xLeft = new Point(-w / 2, 0);
Point xRight = new Point(w / 2, 0);
Polygon xAxis = new Polygon(xLeft, xRight);
Polygon pA = new Polygon(50, 250);
pA.SetBrushColor(System.Drawing.Color.Cyan);
Polygon pB = new Polygon(50, 200);
pB.SetBrushColor(System.Drawing.Color.Orange);
Polygon pC = new Polygon(50, 150);
pC.SetBrushColor(System.Drawing.Color.Yellow);
Polygon pD = new Polygon(50, 100);
pD.SetBrushColor(System.Drawing.Color.LightPink);
Polygon pE = new Polygon(50, 50);
pE.SetBrushColor(System.Drawing.Color.Blue);
Polygon pF = new Polygon(50, 10);
pF.SetBrushColor(System.Drawing.Color.Brown);
Polygon pK1 = new Polygon(30, 10);
Point K1 = new Point(rnd.Next(-w / 4 - 50, w / 4 + 50), rnd.Next(-h / 4 + 5, h / 4 + 20));
pK1.Move(K1.GetX(), K1.GetY());
double m = K1.GetY() / K1.GetX();
Polygon lineCaption = new Polygon(10, 0);
lineCaption.Move(K1.GetX() + 10, K1.GetY() + 30);
lineCaption.SetCaption("K1 (" + K1.GetX() + "," + K1.GetY() + ")");
Console.WriteLine("K1=" + K1);
while (count < 3 && n == 1)
Console.WriteLine("Enter the m");
double answer = double.Parse(Console.ReadLine());
Console.WriteLine("you have another chance ");
pK1.SetBrushColor(System.Drawing.Color.Red);
pK1.SetBrushColor(System.Drawing.Color.White);
pK1.SetBrushColor(System.Drawing.Color.White);
Console.WriteLine("you lose this point. You have to find the right answer in 3 chances. But you can try to make a hit in the next point");
Console.WriteLine("You have won this point. Let's try the next one");
pK1.SetBrushColor(System.Drawing.Color.Green);
if (m == answer || count == 3)
Console.WriteLine("Do you want to continue? yes-1 no-any other");
n = int.Parse(Console.ReadLine());
double temp1 = K1.GetX();
for (double l = K1.GetX(); l < 0; l++)
for (double l = K1.GetX(); l > 0; l--)
K1 = new Point(rnd.Next(-w / 4 - 50, w / 4 + 50), rnd.Next(-h / 4 + 5, h / 4 + 20));
Console.WriteLine("K1=" + K1);
m = K1.GetY() / K1.GetX();
pK1.SetBrushColor(System.Drawing.Color.White);
for (int l = 0; l > K1.GetX(); l--)
for (int l = 0; l < K1.GetX(); l++)
lineCaption.SetCaption("K1 (" + K1.GetX() + "," + K1.GetY() + ")");
while (K1.GetX() > temp1)
while (K1.GetX() < temp1)
lineCaption.Move(-1, -m);
lineCaption.Move(0, -10);