Skip to main content
Tweeted twitter.com/StackCodeReview/status/912269485180178432
edited body; edited tags
Source Link
Mast
  • 13.9k
  • 12
  • 57
  • 128
Post Reopened by alecxe, 200_success
deleted 39 characters in body; edited tags; edited title
Source Link
200_success
  • 145.7k
  • 22
  • 191
  • 481

A Tangram Solver for some simple tangrams

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 don't think it should have taken so much code.

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 though For the algorithm is not idealpurposes of this review, I believe the code accurately follows the algorithm and as such is working codeam satisfied with a heuristic that does not solve all cases.

A Tangram Solver

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 don't think it should have taken so much code.

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 though the algorithm is not ideal, I believe the code accurately follows the algorithm and as such is working code.

Solver for some simple tangrams

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 don't think it should have taken so much code.

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). For the purposes of this review, I am satisfied with a heuristic that does not solve all cases.

deleted 346 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

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.

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 don't think it should have taken so much code.

Below 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 thought the algorithm is not ideal, I believe the code accurately follows the algorithm and as such is working code.

  • find corners points (using OpenCV)
  • find edges and more interesting points
  • find small triangles
  • find possible tangram pieces positions from the small triangles
  • find 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 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 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.

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 don't think it should have taken so much code.

Here 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 though the algorithm is not ideal, I believe the code accurately follows the algorithm and as such is working code.

  • Find corners points (using OpenCV)
  • Find edges and more interesting points
  • Find small triangles
  • Find possible tangram pieces positions from the small triangles
  • Find 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 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 self. everywhere) but are my classes sensible?

Try to clarify that the code works.
Source Link
Stephen Rauch
  • 4.3k
  • 12
  • 24
  • 36
Loading
Post Closed as "Not suitable for this site" by 200_success
Source Link
Jan Kuiken
  • 1.5k
  • 11
  • 11
Loading