Puzzle: find the squares in C#

The example Puzzle: find the equilateral triangles in C# was fun, at least for me, so I decided to run another puzzle. This time your goal is find all of the squares that you can make using the red dots shown here. If you look at the solutions to the triangle puzzle, you can probably use the lessons you learn there to find the squares manually.

The trick is figuring out how to find the squares programmatically. Determining whether three points make up an equilateral triangle is fairly easy, but how do you determine whether four points make up a square?

This program has the same structure as the previous one so all you need to do is plug in the code to find the squares.


This entry was posted in algorithms, games, graphics, mathematics. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *