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.

   

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.