using System.Collections.Generic;
static void Main(string[] args)
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);
Point L = new Point(-w / 2, m * -w / 2 + b);
Point R = new Point(w / 2, m * w / 2 + b);
Polygon lineCaption = new Polygon(10, 0);
lineCaption.Move(-w / 2 + 100, h / 2 - 100);
Polygon pL = new Polygon(20, 3);
pL.Move(L.GetX(), L.GetY());
Polygon pR = new Polygon(20, 3);
pR.Move(R.GetX(), R.GetY());
Polygon t = new Polygon(L, R);
int x1 = rnd.Next(-50, 0);
Point p1 = new Point(x1, m * x1 + b);
Point p2 = new Point(x2, m * x2 + b);
Polygon pl1 = new Polygon(20, 3);
pl1.Move(p1.GetX(), p1.GetY());
Polygon pl2 = new Polygon(20, 3);
pl2.Move(p2.GetX(), p2.GetY());
pl1.SetCaption("(" +x1+", " + (m * x1 + b) +")");
pl2.SetCaption("(" + x2 + ", " + (m * x2 + b) + ")");
Console.WriteLine("point 1: ({0},{1}) ", x1, m * x1 + b);
Console.WriteLine("point 2: ({0},{1})", x2, m * x2 + b);
Console.WriteLine("enter m");
int ma = int.Parse(Console.ReadLine());
Point w1 = new Point(-w / 2, ma * -w / 2 + b);
Point w2 = new Point(w / 2, ma * w / 2 + b);
Polygon wrong = new Polygon(w1,w2);
Console.ForegroundColor = ConsoleColor.Red;
wrong.SetPenColor(System.Drawing.Color.Red);
Console.WriteLine("try again");
Console.WriteLine("more");
ma = int.Parse(Console.ReadLine());
Console.WriteLine("try again");
Console.WriteLine("less");
ma = int.Parse(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
t.SetPenColor(System.Drawing.Color.Green);
t.SetPenColor(System.Drawing.Color.Black);
Console.WriteLine("great!");
Console.WriteLine("enter b");
int ba = int.Parse(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("try again");
Console.WriteLine("more");
ba = int.Parse(Console.ReadLine());
Console.WriteLine("try again");
Console.WriteLine("less");
ba = int.Parse(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("great!");
Console.WriteLine("the answer is: y = {0}x + {1}", m, b);
Polygon lineCaption1=new Polygon(10,0);
lineCaption1.Move(-w/4+10,h/4+5);
lineCaption1.SetCaption("y ="+m+"x+"+b );