How many Triangles (list, regex, grep) example Add comment to Wiki View in Wiki Edit Wiki page Printable Version

Motivation for this page was to add more list and regex example code. I had a hard time creating the regex which was acceptable to the groovy interpretor or which worked as I expected. I found examples of using static regex but very little variable based regex.

Secondly, I had seen this problem posed in multiple places and a solution in perl for the "lines2" which did not seem to work for "lines1".(my mistake, did not use enough points in the loops)

Problem: Count all triangles in the diagram.

Solution: select 3 points shared by 3 different lines




Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified