Challenge: Triangles puzzle

Discussion in 'Java' started by Jim Newton, Oct 16, 2004.

  1. Jim Newton

    Jim Newton Guest

    Sorry, but i do not agree with your solution.
    You missed many triangles.

    E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area.
    but it is not counted in th solution of 27.

    -jim

    Frank Buss wrote:
    > I've setup a challenge, mainly for C++, Java and Lisp, but every other
    > language is welcome:
    >
    > http://www.frank-buss.de/challenge/index.html
    >
    > There is nothing to win, but I hope there will be some interesting
    > solutions at the end, so the win are the results :)
    >
    Jim Newton, Oct 16, 2004
    #1
    1. Advertising

  2. Jim Newton

    Frank Buss Guest

    Frank Buss, Oct 16, 2004
    #2
    1. Advertising

  3. Jim Newton

    Frank Buss Guest

    Jim Newton <> wrote:

    > Sorry, but i do not agree with your solution.
    > You missed many triangles.
    >
    > E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area.
    > but it is not counted in th solution of 27.


    you are right, this was not exact enough, I've updated the web page. Only
    triangles with area>0 should be counted.

    --
    Frank Buß,
    http://www.frank-buss.de, http://www.it4-systems.de
    Frank Buss, Oct 16, 2004
    #3
  4. Jim Newton

    Yogo Guest

    > Sorry, but i do not agree with your solution.
    > You missed many triangles.
    >
    > E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area.
    > but it is not counted in th solution of 27.


    hmm...

    What are you talking about?

    A triangle with an area equal to zero doesn't exist. A triangle has three
    angles and none of them may be equal to zero, otherwise you just don't have
    a triangle.

    What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line not a
    triangle...
    Yogo, Oct 16, 2004
    #4
  5. Jim Newton

    Sudsy Guest

    Frank Buss wrote:
    > I've setup a challenge, mainly for C++, Java and Lisp, but every other
    > language is welcome:
    >
    > http://www.frank-buss.de/challenge/index.html
    >
    > There is nothing to win, but I hope there will be some interesting
    > solutions at the end, so the win are the results :)
    >


    Your diagram is incorrect.

    --
    Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.
    Sudsy, Oct 16, 2004
    #5
  6. Frank Buss <> writes:

    > I've setup a challenge, mainly for C++, Java and Lisp, but every other
    > language is welcome:
    >
    > http://www.frank-buss.de/challenge/index.html
    >
    > There is nothing to win, but I hope there will be some interesting
    > solutions at the end, so the win are the results :)


    Thanks Frank. Fun way to waste half an hour. :)
    Mikael Brockman, Oct 17, 2004
    #6
  7. On Sat, 16 Oct 2004 23:29:52 +0200, "Yogo" <n o s p a m> wrote:

    >> Sorry, but i do not agree with your solution.
    >> You missed many triangles.
    >>
    >> E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area.
    >> but it is not counted in th solution of 27.

    >
    >hmm...
    >
    >What are you talking about?
    >
    >A triangle with an area equal to zero doesn't exist.


    Not as far as a computer is concerned. Without any form of sanity
    checking, the most intuitive (read: quickest for the programmer to
    implement) definition of a triangle for a computer is a set of three
    points.

    The puzzle in question only considers triangles to be formed from a given
    set of points, as well requiring a known line connecting between those
    points. Although the puzzle didn't define triangle, the webpage now
    includes an update that requires these traingle to have an area.

    >A triangle has three
    >angles and none of them may be equal to zero, otherwise you just don't have
    >a triangle.
    >
    >What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line not a
    >triangle...


    Using the "three angles" definition, the line given is valid. There are
    three angles in the shape:

    P5 -> P0 -> P8 : 0 degree angle
    P0 -> P5 -> P8 : 180 degree angle
    P0 -> P8 -> P5 : 0 degree angle.

    0 degrees is still an angle, as is 180. These angles are generally
    significant as they indicate parallel lines, but can be valid in figures.
    Raymond Martineau, Oct 17, 2004
    #7
  8. Frank Buss <> wrote in message news:<cks0s2$6a9$>...
    > I've setup a challenge, mainly for C++, Java and Lisp, but every other
    > language is welcome:
    >
    > http://www.frank-buss.de/challenge/index.html
    >
    > There is nothing to win, but I hope there will be some interesting
    > solutions at the end, so the win are the results :)


    Would it be possible for you to have a private mailing list where you
    can show us peoples' submissions? I'm too impatient to wait until the
    25th. The recipients can be people who already sent you solutions.

    It is interesting to see how one programs differently when shipping
    time is a factor. After I sent it to you and took a quick look at the
    code, I realized I left in parameters named "blah". ;) Which is what I
    frequently name things, but I always rename them.


    MfG,
    Tayssir
    Tayssir John Gabbour, Oct 17, 2004
    #8
  9. Jim Newton

    Jeff Guest

    Tayssir John Gabbour wrote:

    > It is interesting to see how one programs differently when shipping
    > time is a factor. After I sent it to you and took a quick look at the
    > code, I realized I left in parameters named "blah". ;) Which is what I
    > frequently name things, but I always rename them.


    How very true. I'm also curious to see if anyone comes up with a
    "general case" solution to the problem. I'm in the console gaming
    industry, where most of the time hard-coding a solution to a specific
    problem is preferable -- which is why I did in this case.

    Jeff M.
    Jeff, Oct 17, 2004
    #9
  10. Jim Newton

    Jim Newton Guest


    >
    > hmm...
    >
    > What are you talking about?
    >
    > A triangle with an area equal to zero doesn't exist. A triangle has three
    > angles and none of them may be equal to zero, otherwise you just don't have
    > a triangle.
    >
    > What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line not a
    > triangle...
    >
    >
    >


    no, you are wrong. an angle may have zero degrees, or less than zero
    degrees or more than zero degrees.

    the sum of the angles in a triangle is 180 degrees. and a 0, 0, 180
    triangle is still a triangle.
    Jim Newton, Oct 17, 2004
    #10
  11. On Sun, 17 Oct 2004 11:02:55 +0200, Jim Newton wrote:

    >> A triangle with an area equal to zero doesn't exist. A triangle has three
    >> angles and none of them may be equal to zero, otherwise you just don't have
    >> a triangle.
    >>
    >> What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line not a
    >> triangle...

    >
    > no, you are wrong. an angle may have zero degrees, or less than zero
    > degrees or more than zero degrees.
    >
    > the sum of the angles in a triangle is 180 degrees. and a 0, 0, 180
    > triangle is still a triangle.


    There are a number of properties that a construct must
    posess to be considered a triangle. Amongst them are..

    a) Internal angles add to 180 degrees.
    b) The length of any two sides exceeds the length of the third.
    c) Is a 'three sided polygon'

    The case in question fits part a), but neither of parts b)
    (true in two cases, but not the third), or c) ('two sides'
    joined end to end are a single line, thus form a *single*
    side, which, when superimposed over the third side becomes
    a *line*, people...)

    The 'solution' to this is to define the conditions under
    which the shapes are acceptable, and to put at the end,
    'we will refer to these as triangles, irrespective of the
    exact mathematical definition of a triangle'

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
    Andrew Thompson, Oct 17, 2004
    #11
  12. Jim Newton

    Jim Newton Guest

    no, the triangle inequality says | a + b | >= a + b
    equality is allowed in the triangle inequalilty.

    -jim

    > You're wrong. The triangle inequality states that the sum of two
    > triangles sides exceeds the other side. Zero is not a side in any
    > triangle.
    Jim Newton, Oct 17, 2004
    #12
  13. Jim Newton <> writes:

    > > hmm...
    > > What are you talking about?
    > > A triangle with an area equal to zero doesn't exist. A triangle has
    > > three angles and none of them may be equal to zero, otherwise you
    > > just don't have a triangle.
    > > What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line
    > > not a triangle...
    > >

    >
    > no, you are wrong. an angle may have zero degrees, or less than zero
    > degrees or more than zero degrees.
    >
    > the sum of the angles in a triangle is 180 degrees. and a 0, 0, 180
    > triangle is still a triangle.


    You're wrong. The triangle inequality states that the sum of two
    triangles sides exceeds the other side. Zero is not a side in any
    triangle.
    Mikael Brockman, Oct 17, 2004
    #13
  14. Jim Newton

    Jim Newton Guest


    > There are a number of properties that a construct must
    > posess to be considered a triangle. Amongst them are..
    >
    > a) Internal angles add to 180 degrees.
    > b) The length of any two sides exceeds the length of the third.
    > c) Is a 'three sided polygon'
    >


    I do not believe most geometries insist on (b) being the case.
    Nothing important is gained by this condition.

    a 0/0/180 triangle is a THREE SIDED POLYGON



    This sounds like the argument made by the romans when
    mathematicians insisited there was a need for a zero
    in the number system.

    0 is a valid integer
    0 miles per hours is a valid speed
    0 square meters is a valid area
    0 degrees is a valid angle
    Jim Newton, Oct 17, 2004
    #14
  15. Jim Newton

    Frank Buss Guest

    (Tayssir John Gabbour) wrote:

    >> http://www.frank-buss.de/challenge/index.html

    >
    > Would it be possible for you to have a private mailing list where you
    > can show us peoples' submissions? I'm too impatient to wait until the
    > 25th. The recipients can be people who already sent you solutions.


    I've created a private submitters area and I'll send the access information
    to every submitter of a working solution.

    --
    Frank Buß,
    http://www.frank-buss.de, http://www.it4-systems.de
    Frank Buss, Oct 17, 2004
    #15
  16. Jim Newton

    Jim Newton Guest

    you're right.. my >= was backward.
    sorry.

    the triangle inequality is

    | a + b | <= | a | + | b |

    E.g.,

    | -1 + 2 | = 1 <= | -1 | + | 2 | = 1 + 2 = 3
    1 <= 3

    | 1 + 2 | = 3 <= | 1 | + | 2 | = 1 + 2 = 3
    3 <= 3

    sorry about that (blush).


    Andrew Thompson wrote:
    > On Sun, 17 Oct 2004 12:37:33 +0200, Jim Newton wrote:
    >
    > (A.T.)
    >
    >>>b) The length of any two sides exceeds the length of the third.

    >
    > ...
    >
    >>I do not believe most geometries insist on (b) being the case.

    >
    >
    > Less than 7 minutes ago you were claiming to Mikael ..
    >
    > "no, the triangle inequality says | a + b | >= a + b
    > equality is allowed in the triangle inequalilty."
    >
    > So ..what are your 'beliefs' going to be in another 10 minutes?
    >
    Jim Newton, Oct 17, 2004
    #16
  17. On Sun, 17 Oct 2004 12:37:33 +0200, Jim Newton wrote:

    (A.T.)
    >> b) The length of any two sides exceeds the length of the third.

    ....
    > I do not believe most geometries insist on (b) being the case.


    Less than 7 minutes ago you were claiming to Mikael ..

    "no, the triangle inequality says | a + b | >= a + b
    equality is allowed in the triangle inequalilty."

    So ..what are your 'beliefs' going to be in another 10 minutes?

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
    Andrew Thompson, Oct 17, 2004
    #17
  18. Jim Newton

    Jim Newton Guest

    why do you think a 0/0/180 triangle is not closed?

    -jim

    Yogo wrote:
    >>a 0/0/180 triangle is a THREE SIDED POLYGON
    >>

    >
    >
    > A polygon is a closed figure (each line segment must intersects exactly two
    > other line segments). You don't get a closed figure with that.
    >
    > Besides that, not only the sum of the three angles of a triangle must be
    > equal to 180, the sum of two angles must also be less than two right angles.
    >
    > A line segment is just a line segment.
    >
    >
    >
    Jim Newton, Oct 17, 2004
    #18
  19. Jim Newton

    Jim Newton Guest

    in a 0/0/180 triangle each side intersects its two neighboring
    sides.

    why do you think that the sum of two angles must also be less
    than two right angles?

    I think you are trying to put a lot of additional requirements
    on the definition of a triangle. You are making it harder than
    it is.




    Yogo wrote:
    >>a 0/0/180 triangle is a THREE SIDED POLYGON
    >>

    >
    >
    > A polygon is a closed figure (each line segment must intersects exactly two
    > other line segments). You don't get a closed figure with that.
    >
    > Besides that, not only the sum of the three angles of a triangle must be
    > equal to 180, the sum of two angles must also be less than two right angles.
    >
    > A line segment is just a line segment.
    >
    >
    >
    Jim Newton, Oct 17, 2004
    #19
  20. Jim Newton

    Yogo Guest

    >
    > a 0/0/180 triangle is a THREE SIDED POLYGON
    >


    A polygon is a closed figure (each line segment must intersects exactly two
    other line segments). You don't get a closed figure with that.

    Besides that, not only the sum of the three angles of a triangle must be
    equal to 180, the sum of two angles must also be less than two right angles.

    A line segment is just a line segment.
    Yogo, Oct 17, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tayssir John Gabbour

    Re: Challenge: Triangles puzzle

    Tayssir John Gabbour, Oct 18, 2004, in forum: C++
    Replies:
    0
    Views:
    380
    Tayssir John Gabbour
    Oct 18, 2004
  2. Paul Lutus

    Re: Challenge: Triangles puzzle

    Paul Lutus, Oct 18, 2004, in forum: C++
    Replies:
    0
    Views:
    414
    Paul Lutus
    Oct 18, 2004
  3. Frank Buss

    Re: Challenge: Triangles puzzle

    Frank Buss, Oct 25, 2004, in forum: C++
    Replies:
    13
    Views:
    817
    Dirk Thierbach
    Nov 3, 2004
  4. George

    Creating Triangles

    George, Sep 9, 2005, in forum: C++
    Replies:
    5
    Views:
    488
    Howard
    Sep 13, 2005
  5. Wyatt Greene

    Ruby Puzzle Challenge

    Wyatt Greene, Jan 30, 2008, in forum: Ruby
    Replies:
    13
    Views:
    198
    fedzor
    Jan 31, 2008
Loading...

Share This Page