From: Frank Buss
Subject: Challenge: Triangles puzzle
Date: 
Message-ID: <cks0s2$6a9$1@newsreader2.netcologne.de>
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 :-)

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de

From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tdgbrF1ua929U1@uni-berlin.de>
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 :-)
> 
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cks2dm$6a9$2@newsreader2.netcologne.de>
Jim Newton <·····@rdrop.com> 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�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87lle6l35i.fsf@thalassa.informatimago.com>
Frank Buss <··@frank-buss.de> writes:

> Jim Newton <·····@rdrop.com> 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.

But still the statement is not precise enough.

For example, (P6, P5, P8) is a non empty triangle but why don't you
count it in your solutions?

Also, you cite "similar problems".  What are the limits of the class
of "similar problems" you have in mind?

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cks9t3$k09$1@newsreader2.netcologne.de>
Pascal Bourguignon <····@mouse-potato.com> wrote:

> But still the statement is not precise enough.
> 
> For example, (P6, P5, P8) is a non empty triangle but why don't you
> count it in your solutions?

the idea was to count only the triangles, which are bounded by lines. 
I've tried to clarify it, see the solution image for any remaining 
questions :-)

> Also, you cite "similar problems".  What are the limits of the class
> of "similar problems" you have in mind?

this was only a constraint to avoid (princ 27) solutions. Only problems 
which results by adding lines or removing lines needs to be handled with 
the solutions.

PS: Please don't post solutions to the newsgroup before the end of the 
challenge, because I would like to see independant solutions and 
realistic time statements.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Yogo
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <4171929b$0$14941$e4fe514c@news.xs4all.nl>
> 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...
From: Raymond Martineau
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <loi3n090dq200tbmn5i66b7jh965rlpnp6@4ax.com>
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.  
From: Wanja Gayk
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <MPG.1bdc8f4f48131e8198971b@news.t-online.de>
Raymond Martineau said...

> 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.  

The problem is, that parallel lines cannot form a triangle.

Greets,
-Wanja-

-- 
"Gewisse Schriftsteller sagen von ihren Werken immer: 'Mein Buch, mein 
Kommentar, meine Geschichte'. [..] Es w�re besser, wenn sie sagten: 
'unser Buch, unser Kommentar, unsere Geschichte'; wenn man bedenkt, dass 
das Gute darin mehr von anderen ist als von ihnen." [Blaise Pascal]
From: Raymond Martineau
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <l805n05apks3eidbibmbu67r4v4luoibgc@4ax.com>
On Sun, 17 Oct 2004 15:17:21 +0200, Wanja Gayk <··········@yahoo.com>
wrote:

>Raymond Martineau said...
>
>> 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.  
>
>The problem is, that parallel lines cannot form a triangle.
>

They can if they overlap - which is the exact problem one of the posters
was pointing out.

There's also the case with non-euclidian geometry, where a 2D drawing
surface forms a sphere (and nothing is allowed to pass through.)  With
something like this, you can draw three individual lines to surround the
equator, and attempt to call it a triangle.  

That's why you need definitions on what constitutes as a triangle and what
doesn't.  If you don't define things clearly, then you will end up with
confusion and arguments on what really counts as a triangle and what
doesn't.
From: =?ISO-8859-15?Q?Juli=E1n?= Albo
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tfig6F1u2isqU1@uni-berlin.de>
Hello.

The problem is that the C++ Ansi/Iso standard has not definition of
"trinagle". Then the definition is implementation dependant or undefined
behaviour and seems that you are using different implementatios ;)

-- 
Salu2
From: John McGrath
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <_Wzcd.1404$EL5.62@trndny09>
On 10/16/2004 at 9:47:02 PM, Raymond Martineau wrote:

> On Sat, 16 Oct 2004 23:29:52 +0200, "Yogo" <n o s p a m> wrote:
> 
> > A triangle with an area equal to zero doesn't exist. 
> 
> Not as far as a computer is concerned.

That depends on the programming, doesn't it?

Check the dictionary:

   tri�an�gle   n.

   1.  a. The plane figure formed by connecting three points 
          not in a straight line by straight line segments; 
          a three-sided polygon.

   http://dictionary.reference.com/search?q=triangle

-- 
Regards,

John McGrath
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87oej13xk6.fsf@thalassa.informatimago.com>
"John McGrath" <··@jpmcgrath.net> writes:
> Check the dictionary:
> 
>    tri�an�gle   n.
> 
>    1.  a. The plane figure formed by connecting three points 
>           not in a straight line by straight line segments; 
>           a three-sided polygon.
> 
>    http://dictionary.reference.com/search?q=triangle

You should not fetch mathematical definitions from literary dictionaries.

Each mathematical course state its own definitions and if you define a
triangle as three points, you can still have interesting theorems
about them, even in the case of _degenerate_ triangles (which needs a
definition), or in the case where you need to treat specialy some
cases in your theorems.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: =?ISO-8859-15?Q?Jens_Axel_S=F8gaard?=
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <4172dc7b$0$249$edfadb0f@dread11.news.tele.dk>
Pascal Bourguignon wrote:
> "John McGrath" <··@jpmcgrath.net> writes:
> 
>>Check the dictionary:
>>
>>   tri·an·gle   n.
>>
>>   1.  a. The plane figure formed by connecting three points 
>>          not in a straight line by straight line segments; 
>>          a three-sided polygon.
>>
>>   http://dictionary.reference.com/search?q=triangle

> You should not fetch mathematical definitions from literary dictionaries.
> 
> Each mathematical course state its own definitions and if you define a
> triangle as three points, you can still have interesting theorems
> about them, even in the case of _degenerate_ triangles (which needs a
> definition), or in the case where you need to treat specialy some
> cases in your theorems.

In this context I would like to add that it is not uncommon in mathematics
to misuse language. I.e. one is allowed to define that a "degenerate triangle"
isn't a "triangle", but a point or line.

Other examples are:

   A "transfinite number" is not a "number".
   An "indetermininate assertion" is not an "assertion" (*).
   A "semigroup" is not neccesarily a "group".

There is other examples, but they escape me for the moment.


(*) This was translated from Danish - there is a chance I picked the
wrong translation of the "indetermininate".

     1 = 2  is an "assertion"
     x = 1  is not an "assertion" but an "indeterminate(*) assertion"

-- 
Jens Axel Søgaard
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87sm8el3ar.fsf@thalassa.informatimago.com>
"Yogo" <n o s p a m> writes:

> > 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.

Look again at his graphic, and consider (P0, P2, P4).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2teu9sF1tnmcjU1@uni-berlin.de>
> 
> 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.
From: Andrew Thompson
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <1963h5itp264g.u8as7k1rdvzv$.dlg@40tude.net>
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
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tf3rbF1vms81U1@uni-berlin.de>
> 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
From: Andrew Thompson
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <bl6g9q8rvdm$.sjh9t0pvflov$.dlg@40tude.net>
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
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tf58oF1ufkckU1@uni-berlin.de>
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?
> 
From: Yogo
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <41726b38$0$21106$e4fe514c@news.xs4all.nl>
>
> 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.
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tf8gqF1sh7rnU1@uni-berlin.de>
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.
> 
> 
> 
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tf8pqF1t53ocU1@uni-berlin.de>
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.
> 
> 
> 
From: rmagere
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cktsid$1jh$2@news.ox.ac.uk>
"Jim Newton" <·····@rdrop.com> wrote in message
····················@uni-berlin.de...
> 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 that within Euclidian geometry (and I think this is the geometry
being used in the problem) the sum of any two sides of a triangle is
*greater* than the third side.
Not greater or equal to the third side. Which rules out triangles of area
zero.

Furthermore it is pointless to talk about polygons of zero areas as polygons
must have an area otherwise they are just lines (or points). It's like
saying a line of
length zero, well that's not a line it is a point. Similarly you cannot have
a solid with zero volume: i.e a cube of zero volume is a square (or a line
or a point).
From: Wanja Gayk
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <MPG.1bdc931873d2faa798971d@news.t-online.de>
Jim Newton said...
> in a 0/0/180 triangle each side intersects its two neighboring
> sides.

Nope, it intersects in an unlimited number of points, which harms the 
definition of a triangle, because there are more than 3 intersections.

If you bring the area of a triangle down to zero, it stops being a 
triangle: you get either a point or a line.

Say you would shorten each side of a triamgle to a length of 0, you 
would get a single point, which is less than 3, which allows no angle, 
no intersections and thus is no triangle at all. Same problem, 
basically.

Greets,
-Wanja-

-- 
"Gewisse Schriftsteller sagen von ihren Werken immer: 'Mein Buch, mein 
Kommentar, meine Geschichte'. [..] Es w�re besser, wenn sie sagten: 
'unser Buch, unser Kommentar, unsere Geschichte'; wenn man bedenkt, dass 
das Gute darin mehr von anderen ist als von ihnen." [Blaise Pascal]
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87k6tp5jv4.fsf@thalassa.informatimago.com>
Wanja Gayk <··········@yahoo.com> writes:

> Jim Newton said...
> > in a 0/0/180 triangle each side intersects its two neighboring
> > sides.
> 
> Nope, it intersects in an unlimited number of points, which harms the 
> definition of a triangle, because there are more than 3 intersections.
> 
> If you bring the area of a triangle down to zero, it stops being a 
> triangle: you get either a point or a line.
> 
> Say you would shorten each side of a triamgle to a length of 0, you 
> would get a single point, which is less than 3, which allows no angle, 
> no intersections and thus is no triangle at all. Same problem, 
> basically.

You'd still get a triangle, only a degenerate one.

Moreover, you can have three different points and still a degenerate
triangle, when the tree points are aligned.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Paul Wallich
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <ckum9n$rs0$1@reader1.panix.com>
Pascal Bourguignon wrote:
> Wanja Gayk <··········@yahoo.com> writes:
> 
> 
>>Jim Newton said...
>>
>>>in a 0/0/180 triangle each side intersects its two neighboring
>>>sides.
>>
>>Nope, it intersects in an unlimited number of points, which harms the 
>>definition of a triangle, because there are more than 3 intersections.
>>
>>If you bring the area of a triangle down to zero, it stops being a 
>>triangle: you get either a point or a line.
>>
>>Say you would shorten each side of a triamgle to a length of 0, you 
>>would get a single point, which is less than 3, which allows no angle, 
>>no intersections and thus is no triangle at all. Same problem, 
>>basically.
> 
> 
> You'd still get a triangle, only a degenerate one.
> 
> Moreover, you can have three different points and still a degenerate
> triangle, when the tree points are aligned.

There is the minor problem that there's no principled way to distinguish 
among degenerate triangles of this type, line segments, and degenerate 
n-gons for any finite n>3.

paul   and we wonder why AI is so hard
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87k6to4mmm.fsf@thalassa.informatimago.com>
Paul Wallich <··@panix.com> writes:
> There is the minor problem that there's no principled way to
> distinguish among degenerate triangles of this type, line segments,
> and degenerate n-gons for any finite n>3.

Well, there are ways to distinguish (the definitions are
characterizing!), but it's more complicated than that.

For example, what people name triangle could be defined either as:

    - three points (with or without conditions to avoid degenerate cases),

    - three segments, the set of vertices of which has as cardinal: 3.

    - a concave closed surface whose border is composed of three
      segments, the set of vertices of which has as cardinal: 3.
    
    - etc, (euclidian triangles, triangles on a sphere, on a
      planetoid, etc, etc).

So when you see something and call it a triangle, you're not saying
much about that something (it could just be three people having or not
a special "intercourse", would that be a degenerate "triangle"?
(assuming the three people are taken amongst a bisexual species?)).

So please, stick to the definitions!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tfp1fF1vmebcU1@uni-berlin.de>
Is a zero degree angle an angle?

Is a 180 degree angle an angle?


Paul Foley wrote:
> 
> 
>>>a 0/0/180 triangle is a THREE SIDED POLYGON
>>>
> 
> 
> No it isn't.  It's a line segment.
> 

> 
From: Eric Schmidt
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <f8577bb7.0410172111.3eea75a5@posting.google.com>
Jim Newton <·····@rdrop.com> wrote in message news:<···············@uni-berlin.de>...
> Is a zero degree angle an angle?
> 
> Is a 180 degree angle an angle?

Yes, and yes, but you can't form a triangle out of them. A triangle is
a polygon with 3 sides. You can't have 0 and 180 degree angles in
polygons. Otherwise, for instance, all triangles are quadrilaterals,
pentagons, hexagons, and so on. Not only that, but all line segments
are triangles, quadrilaterals, pentagons, and so on. Even worse, all
line segments are tetrahedra, pentahedra. hexahedra, and so on. It
also means you could have a two-sided polygon. etc....

If you really think that a segment is a triangle, then I challenge to
tell me where such a triangle's circumcenter would be.

Anyway, such "degenerate triangles" are not triangles according to any
definition of triangle I've ever seen.
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tfrfaF1vb313U1@uni-berlin.de>
hi paul, please tell me what a degenerate triangle is
according to your definition.  Can you give me
an example of a degenerate triangle?


Paul Foley wrote:
> On Sun, 17 Oct 2004 14:54:06 +0200, Yogo  wrote:
> 
> 
>>>a 0/0/180 triangle is a THREE SIDED POLYGON
>>>
> 
> 
> No it isn't.  It's a line segment.
> 
> 
>>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.
> 
> 
> The sum of the angles doesn't necessarily have to equal 180 degrees,
> either.  That's only true for a triangle on a Euclidean plane.  [E.g.,
> you can easily draw a spherical triangle whose angles add up to
> anything from 180 to 270 degrees]
> 
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <873c0d5fhp.fsf@thalassa.informatimago.com>
Jim Newton <·····@rdrop.com> writes:

> hi paul, please tell me what a degenerate triangle is
> according to your definition.  Can you give me
> an example of a degenerate triangle?

I'm not paul, but:

  - any triangle where the three corners are aligned.

(This includes the cases where two or three corners are equal.)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Mikael Brockman
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87d5zhbpjp.fsf@igloo.phubuh.org>
Jim Newton <·····@rdrop.com> 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.
From: Jim Newton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2tf3ekF1si45tU1@uni-berlin.de>
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.
From: Paul Lutus
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <10n6qlffli41d6a@corp.supernews.com>
Mikael Brockman wrote:

> Jim Newton <·····@rdrop.com> 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.

Actually, it is "equals or exceeds". A three-sided polygon with sides 3, 4
and 7 is a degenerate triangle, but it is a triangle.

http://www.fact-index.com/t/tr/triangle_inequality.html

"In mathematics, the triangle inequality is a statement which states roughly
that the distance from A to B to C is never shorter than going directly
from A to C. "

Note that it says "never shorter than ...". Not "always longer than ...".

> Zero is not a side in any 
> triangle.

True, but not the present issue. The problem appears to be the case of
angles of 0,0,180 and nonzero sides a + b = c.

-- 
Paul Lutus
http://www.arachnoid.com
From: Mikael Brockman
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <877jpobaib.fsf@igloo.phubuh.org>
Paul Lutus <······@nosite.zzz> writes:

> Mikael Brockman wrote:
> 
> > Jim Newton <·····@rdrop.com> 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.
> 
> Actually, it is "equals or exceeds". A three-sided polygon with sides 3, 4
> and 7 is a degenerate triangle, but it is a triangle.
> 
> http://www.fact-index.com/t/tr/triangle_inequality.html
> 
> "In mathematics, the triangle inequality is a statement which states roughly
> that the distance from A to B to C is never shorter than going directly
> from A to C. "
> 
> Note that it says "never shorter than ...". Not "always longer than ...".

OK, citation time.  :-)

http://mathworld.wolfram.com/Triangle.html:

| Allowable side lengths a, b, and c for a triangle are given by the set
| of inequalities a > 0, b > 0, c > 0, and a + b > c, b + c > a, a + c >
| b, a statement that encapsulated in the so-called triangle inequality.

http://mathworld.wolfram.com/TriangleInequality.html:

| Geometrically, the right-hand part of the triangle inequality states
| that the sum of the lengths of any two sides of a triangle is greater
| than the length of the remaining side.
From: Pascal Bourguignon
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87u0ss2u6s.fsf@thalassa.informatimago.com>
Mikael Brockman <······@phubuh.org> writes:
> OK, citation time.  :-)
> 
> http://mathworld.wolfram.com/Triangle.html:
> 
> | Allowable side lengths a, b, and c for a triangle are given by the set
> | of inequalities a > 0, b > 0, c > 0, and a + b > c, b + c > a, a + c >
> | b, a statement that encapsulated in the so-called triangle inequality.
> 
> http://mathworld.wolfram.com/TriangleInequality.html:
> 
> | Geometrically, the right-hand part of the triangle inequality states
> | that the sum of the lengths of any two sides of a triangle is greater
> | than the length of the remaining side.

It does not matter. As I already wrote, each mathematician choose his
own definitions. Those definitions prevent the cases of degenerate
triangle, good for Wolfram.  But sometimes you need to allow
degenerate triangles to generalize some theorem so another
mathematician may choose to define a triangle as the given of three
points in which case you can have all sorts of degenerate cases too.

For example, if your point is to prove that the sum of the angles is
pi, it may be worthwhile to admit flat triangles where the three
points are aligned (but not where two or three points are the same).


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.
From: Markus Malkusch
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2243639.9PKM7ocenH@malkusch.de>
Jim Newton:

> the sum of the angles in a triangle is 180 degrees.  and a  0, 0, 180
> triangle is still a triangle.

I don't know why you are discussing about it. You're talking about a line. A
triangle is an area. If you decide that a triangle may be a line, then a
rectancle can also be a line. A box can be a rectangle and this can be a
line. And a line could be a point.

So a point is a triangle, rectangle, pyramid, and every other geometrical
structure? I think it's wrong if you decide that an area may be a line. 

Volume, area, line and point are different worlds. And you can't decide that
a line has an exact area of 0, otherwise the sum of lines would be 0, but
it is an area > 0.
-- 
<http://www.domaininformation.de/> - Whoisabfrage 
From: Paul Lutus
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <10n6pqtcci1mib7@corp.supernews.com>
Markus Malkusch wrote:

> Jim Newton:
> 
>> the sum of the angles in a triangle is 180 degrees.  and a  0, 0, 180
>> triangle is still a triangle.
> 
> I don't know why you are discussing about it. You're talking about a line.
> A triangle is an area.

Yes, but that area may be equal to zero. A triangle is an object with three
sides and three angles. In a flat Cartesian coordinate system, the
triangle's angles must add up to 180 degrees. The sum of the lengths of any
two sides cannot be less than the length of the third side. That's the
entire list of requirements.

-- 
Paul Lutus
http://www.arachnoid.com
From: Tayssir John Gabbour
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <866764be.0410162111.33e75a57@posting.google.com>
Frank Buss <··@frank-buss.de> wrote in message news:<············@newsreader2.netcologne.de>...
> 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
From: Jeff
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <Psncd.195114$wV.35501@attbi_s54>
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.
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cktjb1$p0g$1@newsreader2.netcologne.de>
···········@yahoo.com (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�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Tayssir John Gabbour
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <866764be.0410171833.37e890c3@posting.google.com>
Frank Buss <··@frank-buss.de> wrote in message news:<············@newsreader2.netcologne.de>...
> ···········@yahoo.com (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.

Thanks. It was interesting to see the differences in thought process.

Since I didn't do a good job of commenting (I just kicked it out),
I've sent you a commentary version that you might put next to my real
submission. It critiques my rough code a little, and gave some of my
background so readers know where I'm at.


MfG,
Tayssir
From: Philip Haddad
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <ba57c4f9.0410181225.11fc2d7c@posting.google.com>
Frank Buss <··@frank-buss.de> wrote in message news:<············@newsreader2.netcologne.de>...
> ···········@yahoo.com (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.

I'm still working on my solution. I have been pondering it for a few
hours on and off, and now I think I've figured it out so I can
actaully write the code. I really had to brush up on geometry. :-)

--
Certum quod factum
Philip Haddad
From: Mikael Brockman
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87is9ab6zx.fsf@igloo.phubuh.org>
Frank Buss <··@frank-buss.de> 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.  :-)
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cljmao$5j4$1@newsreader2.netcologne.de>
Frank Buss <··@frank-buss.de> 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

the challenge is over, thanks to all participants. I've submitted the link 
at Slashdot, too, there are always so objective discussions :-) 

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Chris Dams
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cljp1m$hm9$1@gamow.sci.kun.nl>
Dear Frank,

Frank Buss <··@frank-buss.de> writes:

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

>the challenge is over, thanks to all participants. I've submitted the link 
>at Slashdot, too, there are always so objective discussions :-) 

Did you reach any interesting (or uninteresting) conclusions from the
solutions?

Best,
Chris
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <cljqsa$d4o$1@newsreader2.netcologne.de>
······@gamow.sci.kun.nl (Chris Dams) wrote:

> Did you reach any interesting (or uninteresting) conclusions from the
> solutions?

yes, but it is not a new conclusion: The language doesn't matter, if you 
have a good idea.

But I don't know, why there are so many Lisp solutions, but this is good, 
because I'm still learning Lisp, and now I have many good examples, which I 
can compare to see the advantage and disadvantages for this problem.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Tayssir John Gabbour
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <1098776600.252147.202100@c13g2000cwb.googlegroups.com>
Frank Buss wrote:
> ······@gamow.sci.kun.nl (Chris Dams) wrote:
> > Did you reach any interesting (or uninteresting) conclusions from
> >  the solutions?
>
> yes, but it is not a new conclusion: The language doesn't matter,
> if you have a good idea.

The useful thing was though, that I didn't have any conscious idea of
what I was doing. Usually with my previous languages, I always made my
thoughts explicit (for example, on things like paper). Being in
control. After being inspired by the video, I am now experimenting with
trying other extreme, which is like falling backwards in the
expectation that I can actually levitate. Maybe I'm just weakly and
slowly groping around, but I liked the moment when I thought, "Hmm, so
that's what I'm doing."

For example, if there were something tricky about it, I might have
signalled a warning and left restarts for later. Meat & potatoes stuff
which has nothing to do with what Lisp is hyped for (and didn't appear
in the code), but quietly takes away intellectual issues so you can do
as you wish.

I certainly don't want my code to be any representative example of
Lisp, in the eyes of the public, but I thought it was fun and
edumacational. I kind of hope no one tries drawing any lessons from
what I did. ;)

On the other hand, I liked that Literate Haskell answer. Sort of the
opposite approach.


MfG,
Tayssir
From: Michael Naunton
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <slrncnr6l5.1mc.mmn@micron.bellatlantic.net>
Damn, I don't see my solution on your site (sent Tues of last week)

-- MMN

On Mon, 25 Oct 2004 20:05:44 +0000 (UTC), Frank Buss <··@frank-buss.de> wrote:
> Frank Buss <··@frank-buss.de> 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
> 
> the challenge is over, thanks to all participants. I've submitted the link 
> at Slashdot, too, there are always so objective discussions :-) 
> 
> -- 
> Frank Bu�, ··@frank-buss.de
> http://www.frank-buss.de, http://www.it4-systems.de
From: Frank Buss
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <clkknk$mui$1@newsreader2.netcologne.de>
Michael Naunton <···@news.bellatlantic.net> wrote:

> Damn, I don't see my solution on your site (sent Tues of last week)

I'm sorry, I didn't received it. Have you marked the subject with 
"[Challenge]"? Perhaps my spam filter has filtered it wrong, but you can 
send it again and I'll add it to the table with a comment.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Gareth McCaughan
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87k6td2cgs.fsf@g.mccaughan.ntlworld.com>
Frank Buss <··@frank-buss.de> 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
> 
> the challenge is over, thanks to all participants. I've submitted the link 
> at Slashdot, too, there are always so objective discussions :-) 

I've put a little plot of the results at
    http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
    http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf

which should be reasonably self-explanatory. The letters above and
to the right of the main plot show the marginal distributions.
The ones below the main plot are those with no time specified in
Frank's table.

All the numbers depicted should be taken with a grain of salt;
in particular, I haven't made a very serious attempt to correct
for the fact that some people will have reported non-blank non-comment
line counts and others will have included everything. (Where the
distinction was made, I chose the non-blank non-comment figure,
or the nearest thing thereto.) Likewise, those who gave times
may have meant different things by them.

There may be interesting conclusions to draw, but I am not going
to draw them. :-)

-- 
Gareth McCaughan
.sig under construc
From: M Jared Finder
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <2u8ui8F26j25tU2@uni-berlin.de>
Gareth McCaughan wrote:
> Frank Buss <··@frank-buss.de> 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
>>
>>the challenge is over, thanks to all participants. I've submitted the link 
>>at Slashdot, too, there are always so objective discussions :-) 
> 
> 
> I've put a little plot of the results at
>     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
>     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf
> 
> which should be reasonably self-explanatory. The letters above and
> to the right of the main plot show the marginal distributions.
> The ones below the main plot are those with no time specified in
> Frank's table.
> 
> All the numbers depicted should be taken with a grain of salt;
> in particular, I haven't made a very serious attempt to correct
> for the fact that some people will have reported non-blank non-comment
> line counts and others will have included everything. (Where the
> distinction was made, I chose the non-blank non-comment figure,
> or the nearest thing thereto.) Likewise, those who gave times
> may have meant different things by them.
> 
> There may be interesting conclusions to draw, but I am not going
> to draw them. :-)

What do the Python, Java, Lisp, and Ruby entries with times less than 0 
mean?  Has time travel already been invented?

   -- MJF
From: Gareth McCaughan
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87oein23wl.fsf@g.mccaughan.ntlworld.com>
M Jared Finder wrote:

[I said:]
> > I've put a little plot of the results at
> >     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
> >     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf
> > which should be reasonably self-explanatory. The letters above and
> > to the right of the main plot show the marginal distributions.
> > The ones below the main plot are those with no time specified in
> > Frank's table.
> > All the numbers depicted should be taken with a grain of salt;
> > in particular, I haven't made a very serious attempt to correct
> > for the fact that some people will have reported non-blank non-comment
> > line counts and others will have included everything. (Where the
> > distinction was made, I chose the non-blank non-comment figure,
> > or the nearest thing thereto.) Likewise, those who gave times
> > may have meant different things by them.
> > There may be interesting conclusions to draw, but I am not going
> > to draw them. :-)
> 
> What do the Python, Java, Lisp, and Ruby entries with times less than
> 0 mean?  Has time travel already been invented?

As I said ...

> > The ones below the main plot are those with no time specified in
> > Frank's table.

-- 
Gareth McCaughan
.sig under construc
From: Mark McConnell
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <d3aed052.0410270653.5571a969@posting.google.com>
Gareth McCaughan <················@pobox.com> wrote in message news:<··············@g.mccaughan.ntlworld.com>...
> I've put a little plot of the results at
>     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
>     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf
> [snip]
> All the numbers depicted should be taken with a grain of salt;
> in particular, I haven't made a very serious attempt to correct
> for the fact that some people will have reported non-blank non-comment
> line counts and others will have included everything. (Where the
> distinction was made, I chose the non-blank non-comment figure,
> or the nearest thing thereto.) Likewise, those who gave times
> may have meant different things by them.

Also, people chose different definitions of the problem--of what it
means to input points and lines.
From: Gareth McCaughan
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87k6tb23ro.fsf@g.mccaughan.ntlworld.com>
···············@yahoo.com (Mark McConnell) writes:

> Gareth McCaughan <················@pobox.com> wrote in message news:<··············@g.mccaughan.ntlworld.com>...
> > I've put a little plot of the results at
> >     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
> >     http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf
> > [snip]
> > All the numbers depicted should be taken with a grain of salt;
> > in particular, I haven't made a very serious attempt to correct
> > for the fact that some people will have reported non-blank non-comment
> > line counts and others will have included everything. (Where the
> > distinction was made, I chose the non-blank non-comment figure,
> > or the nearest thing thereto.) Likewise, those who gave times
> > may have meant different things by them.
> 
> Also, people chose different definitions of the problem--of what it
> means to input points and lines.

Yes. In particular, the *very* short solutions all (1) used
assignments within the program as input (though they didn't
count those assignments as part of the code), thus requiring
0 lines for handling input, and (2) used numbers to represent
points, which enables various minor algorithmic simplifications.

Whether you think of that as cheating or as intelligent use
of the language's facilities is up to you. :-)

-- 
Gareth McCaughan
.sig under construc
From: Dirk Thierbach
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <20041028055445.34D.0.NOFFLE@ID-7776.user.dfncis.de>
Gareth McCaughan <················@pobox.com> wrote:

> Yes. In particular, the *very* short solutions all (1) used
> assignments within the program as input (though they didn't
> count those assignments as part of the code), 

No, at least one short solution did count those assignments (3 lines
of assignments out of 6 total lines of code).

You could replace those 3 lines by 1 line to read the contents of a file,
1 line to parse it and to call the algorithm, 1 line to calculate the 
missing part of the input definition, and 1 line to print the result.
Maybe an additional line to get the filename from the commandline arguments.
So instead of 3, you have 4-5 lines. I didn't bother, because then you have
to edit 2 files instead of 1 for testing.

> (2) used numbers to represent points, which enables various minor
> algorithmic simplifications.

Nope. Anything that's comparable will do for the simple solution,
and with two additional lines, you can use anything that only admits equality.
If you just want the number of solutions, and not the solutions themselves
without "duplicates" by permutation, then you can do even without that
(just divide the length of the list of solutions by 6).

BTW, one more important difference is that some algorithms just counted,
while some actually computed all solutions. Some algorithms restricted
themselves to two "fans" of lines, while some allowed an arbitrary
geometry. And so on, and so on.



- Dirk
From: Jens Axel Søgaard
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <4180ec79$0$243$edfadb0f@dread11.news.tele.dk>
Dirk Thierbach wrote:
> Gareth McCaughan <················@pobox.com> wrote:

>>Yes. In particular, the *very* short solutions all (1) used
>>assignments within the program as input (though they didn't
>>count those assignments as part of the code), 

>>(2) used numbers to represent points, which enables various minor
>>algorithmic simplifications.
> 
> 
> Nope. Anything that's comparable will do for the simple solution,
> and with two additional lines, you can use anything that only admits equality.
> If you just want the number of solutions, and not the solutions themselves
> without "duplicates" by permutation, then you can do even without that
> (just divide the length of the list of solutions by 6).
> 
> BTW, one more important difference is that some algorithms just counted,
> while some actually computed all solutions. Some algorithms restricted
> themselves to two "fans" of lines, while some allowed an arbitrary
> geometry. And so on, and so on.

It is also interesting to look at the various time complexities for
the algorithms used. The programs that generate all tree-tuples of points
and then filter for triangles and remove duplicates will be slower than
programs that generate the triangles in way that doesn't generate non-triangles
nor duplicates, when we run the programs for large n and m.

-- 
Jens Axel Søgaard
From: Gareth McCaughan
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <87sm7wwgv0.fsf@g.mccaughan.ntlworld.com>
Dirk Thierbach wrote:

[I said:]
>> Yes. In particular, the *very* short solutions all (1) used
>> assignments within the program as input (though they didn't
>> count those assignments as part of the code), 
> 
> No, at least one short solution did count those assignments (3 lines
> of assignments out of 6 total lines of code).

I beg your pardon; I misremembered.

> You could replace those 3 lines by 1 line to read the contents of a file,
> 1 line to parse it and to call the algorithm, 1 line to calculate the 
> missing part of the input definition, and 1 line to print the result.
> Maybe an additional line to get the filename from the commandline arguments.
> So instead of 3, you have 4-5 lines. I didn't bother, because then you have
> to edit 2 files instead of 1 for testing.

Sure.

>> (2) used numbers to represent points, which enables various minor
>> algorithmic simplifications.
> 
> Nope. Anything that's comparable will do for the simple solution,
> and with two additional lines, you can use anything that only admits equality.

I'm not sure how we're in disagreement here...

> If you just want the number of solutions, and not the solutions themselves
> without "duplicates" by permutation, then you can do even without that
> (just divide the length of the list of solutions by 6).

Indeed. (Though you may, in some implementations, need a little
extra code to avoid repeated points.)

> BTW, one more important difference is that some algorithms just counted,
> while some actually computed all solutions. Some algorithms restricted
> themselves to two "fans" of lines, while some allowed an arbitrary
> geometry. And so on, and so on.

Indeed. The solution that was a 3-character program in J
(or whatever it was) was particularly notable in this respect :-).

(I get the impression that you think I think it was cheating
to avoid using a separate file for the data. I don't.)

-- 
Gareth McCaughan
.sig under construc
From: Dirk Thierbach
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <20041103070640.326.1.NOFFLE@ID-7776.user.dfncis.de>
Gareth McCaughan <················@pobox.com> wrote:
>> BTW, one more important difference is that some algorithms just counted,
>> while some actually computed all solutions. Some algorithms restricted
>> themselves to two "fans" of lines, while some allowed an arbitrary
>> geometry. And so on, and so on.

> Indeed. The solution that was a 3-character program in J
> (or whatever it was) was particularly notable in this respect :-).

Yes. J (and APL, and K) can be very terse, but also somewhat hard to
read (at least for me).

> (I get the impression that you think I think it was cheating
> to avoid using a separate file for the data. 

No. I guess the point was that other differences are much more important.

- Dirk
From: Dirk Thierbach
Subject: Re: Challenge: Triangles puzzle
Date: 
Message-ID: <20041027073228.499.4.NOFFLE@ID-7776.user.dfncis.de>
Gareth McCaughan <················@pobox.com> wrote:
> Frank Buss <··@frank-buss.de> writes:

>> the challenge is over, thanks to all participants. I've submitted the link 
>> at Slashdot, too, there are always so objective discussions :-) 

> I've put a little plot of the results at
>    http://homepage.ntlworld.com/g.mccaughan/software/tri-times.ps
>    http://homepage.ntlworld.com/g.mccaughan/software/tri-times.pdf
> 
> which should be reasonably self-explanatory. The letters above and
> to the right of the main plot show the marginal distributions.
> The ones below the main plot are those with no time specified in
> Frank's table.
> 
> All the numbers depicted should be taken with a grain of salt;
> in particular, I haven't made a very serious attempt to correct
> for the fact that some people will have reported non-blank non-comment
> line counts and others will have included everything. (Where the
> distinction was made, I chose the non-blank non-comment figure,
> or the nearest thing thereto.) Likewise, those who gave times
> may have meant different things by them.

> There may be interesting conclusions to draw, but I am not going
> to draw them. :-)

One thing that was interesting for me in the graph: If you just look
at the Lisp entries alone (which are numerous enough), you can see on
the one hand a linear relationship between lines of code/time needed
(a diagonal line), and on the other hand and vertical line (a nearly
constant relationship) on the left hand side. Both effects are not so
surprising: It takes longer to write more lines of code on the other
hand, and to get a short and simple solution, you have to invest some
time thinking about it, but no matter how it long takes you, the
"simplest" solution will have roughly the same number of lines.

I didn't expect those effects to be so visible so prominently, however.

(And I agree with Frank: In the end, what counts is the idea behind
the algorithm, no matter what language you use to describe it in.)

- Dirk