[source code included]
PoC – Proof of Concept
With this new version, the solution now enumerates all triangles and displays the results on both a (report) text box and a new tree view – from where you can select any item and highlight its corresponding border on the graphical space.
I revisited the code (which is now much more leaner) to easy readability and understanding, focusing on the contest’s goals and requirements. In order to do so, I stripped out all the gateways, factories, managers and performance-testing code.
As a result, the logical layers and data flow can be now represented as follows:
Figure 1. Data flow throughout the solution’s logical layers
And as you can check (by running and exploring the executable’s solution), I also managed to keep optimized both processing speed and memory usage.
The updated user’s graphical interface now look like this:
Figure 2. TryAngels 0.0.2.0 – Main Form
The TabControl (at the right) was updated to reflect design changes; and the report TextBox is now placed below the graphic space, at the central portion of the screen.
A new TreeView was added to the left side of the screen. It is refreshed – along with the central controls – when the user clicks on the Execute button or changes the value of the NumericUpDown control. It also allows the user to explore and highlight anyone of the inner triangles in the figure.
The next figure depicts an example of its usage:
Figure 3. TryAngels 0.0.2.0 – Selecting a triangle node of the TreeView
Here is another example, with a somewhat large-sized graph:
Figure 4. TryAngels 0.0.2.0 – A 35-side triangle with an inner triangle highlighted.
Note that a 35-side (here with 12 pixels each) equilateral triangle has a total of 11,493 visible, identifiable inner triangles; and that you can highlight each one of them from the TreeView.
Also note that all the inner triangles are uniquely identifiable, properly detailed and summed, and appropriately accounted for.
And finally note that the solution provides all these functionality within the contest’s performance and memory requirements; while implementing an algorithm that both “ensures completeness, and avoids duplication” of any kind.
By the way:
With this new version, the solution satisfies and fulfills all the requirements proposed by the contest.