I need a program written in C# which should do the following thing:
At the input we have the file "input.txt" in the following format
N, A, B
N - the number of rectangles
A- the length of the first edge of the rectangle (integer not larger than 50 and not smaller than 5)
B- the length of the second edge of the rectangle (integer not larger than 50 and not smaller than 5)
1. The program should place at randomly chosen positions N rectangles with edges with length A and B at randomly chosen positions. All coordinates of vertices of rectangles should be integers not larger than 800 (this number should be the parameter of the program) and not smaller than 1. Rectangles can overlap. Rectangles have red color and are placed at the initially blue square with the edge with length 800.
2. We will say that a point P is of type 1 if it is possible to go from the left edge of the square to the right edge of the square trough any path without crossing any red points. Points situated within the square of length 800 for which it is not possible and all points situated are called "points of type 0".
3. Points of type 0 are separated from the points of type 1 by a set of polygons. The program should find all these polygons. The file "output.txt" should be produced which should be in the following format:
The first line should contain the number of polygons.
The format of next lines should be following
NV, X1, Y1, X2, Y2, ...
where NV - the number of vertices, X1, Y1- the first and the second coordinate of the first vertex of the polygon,...
4. Program should visualize results producing the figure at which rectangles found in point 1 should be drawn with red color and polygons separating regions of type 1 from regions of type 0 should be drawn with black color.
The program should work in reasonable time - let us say that at least for parameters of type N=640, A=B=10 it should not work longer than about 6 hours on a typical PC.
The project in principle concerns above described problem with rectangles, however let me know if you are able within the budget to write analogous program for