Official Triangles Discussion

Official discussion thread for Triangles. Please do not post any spoilers or big hints.

Got it, if you understand the sourcecode it’s just a question of time to clarify all this :smiley:

1 Like

Hi everybody,

I think I have solved the triangles challenge in the correct way but the flag that I get is not correct.
As a first step I obtain the unique position of the 3 characters that meet the distances (I get only one possibility for every character in the flag). Then, mathematically, I obtain the point that is the character in the flag (using the distances). My result for every character in the flag is an integer X and an integer Y (both without decimals). But the flag is not correct.

I obtain HTB{ + 4 characters without sense + } + characters without sense

I don’t understand what I am doing wrong. Any help would be greatly appreciated.

I hope this post does not contain too much spoilers :wink:
Thanks.

Howdy! Sorry to just reply back to this now. Here are my suggestions/considerations, if you have yet to figure it out:

  • Try re-downloading the zip file, and start with a fresh grid and output file. The way this challenge is setup, it is unfortunately possible to ruin the output file while working on it.
  • Confirm X vs Y axis. I know it is a little thing, but could be a problem. I think it would be very funny if both xy and yx versions produced an HTB at the start, but if it does, it wasn’t intentional.
  • Don’t use the “secret.py” file for anything except to understand how I generated the flag originally. I could see an instance where relying too closely on that file could result in something going awry.
  • Consider double checking your solution and confirming that the correct points are being mapped to the correct places. If you are solving this challenge programmatically, a simple mix up of a 1 vs 2 in an array could lead to somewhat correct results, while still being wrong.

Contact me directly for further hints!

Triangles resolved.

Thanks @TallyHack for your help on this. I finally found the problem. The casting from float (math result) to int (index) have a bug.

Due to the float imprecision, the conversion to int gives me an error of one at the index.

Tip for others:

1.999999 is printed as 2. but converted to int is 1. Be careful with this.