Somehow I decided to write a program to solve Tangram puzzles. This went a bit out of hand and I ended up with 600+ lines of code.., I I don't think it should have taken so much code.
BelowHere is an image of a positive result.:
The algorithm used isn't ideal, it successfully finds a solution in only a small part of my test set. It depends (among others) on allowed distance differences (EPSILON in the code). But even thoughtthough the algorithm is not ideal, I believe the code accurately follows the algorithm and as such is working code.
- findFind corners points (using OpenCV)
- findFind edges and more interesting points
- findFind small triangles
- findFind possible tangram pieces positions from the small triangles
- findFind the combination of pieces such that all triangles are 'covered'
I like PEP8, however I like also to deviate from it for sake of
readability readability in cases such as:
if ( condition_1
and condition_2
and not condition_3):
Am I using white space correctly and/or readable?
I don't like to write classes in Python (mainly because of typing all
the the self. everywhere) but are my classes sensible?
Of course all other comments are welcome...
Note on the Off-Topic Closure:
As discussed here, I believe the code is working implementation of a not ideal algorithm, and would like feedback on my implementation.