From: Alexander Burger
Subject: Chess in 458 Lines
Date: 
Message-ID: <dir3qg$323$1@online.de>
In case anybody is interested:

Pico Lisp now comes with a complete chess program,
in only 458 lines of code.  Developed just for
the fun of programming.

ASCII board display, unlimited undo/redo,
board position save+load, analysis and autoplay.

Neither strong nor fast, but should play correct chess
(castling, pawn promotion, en passant capture etc.).

More in picoLisp-2.2.0/games/README

Cheese,
- Alex
-- 
   Alexander Burger
   Software Lab. / 7fach GmbH
   Bahnhofstr. 24a, D-86462 Langweid
   ···@software-lab.de, http://www.software-lab.de, +49 821 9907090

From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <Tma4f.1855$h25.618@news-wrt-01.rdc-nyc.rr.com>
Alexander Burger wrote:

> In case anybody is interested:
> 
> Pico Lisp now comes with a complete chess program,
> in only 458 lines of code.

Cool. Good timing, someone was just complaining that the enterprise 
application I developed for him, while it does everything he asked and 
more, is only 60kloc Lisp. I forwarded him your post.


-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: Andras Simon
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <vcdd5m6ody3.fsf@csusza.math.bme.hu>
Kenny Tilton <·······@nyc.rr.com> writes:

> Alexander Burger wrote:
> 
> > In case anybody is interested:
> > Pico Lisp now comes with a complete chess program,
> > in only 458 lines of code.
> 
> Cool. Good timing, someone was just complaining that the enterprise
> application I developed for him, while it does everything he asked and
> more, is only 60kloc Lisp. I forwarded him your post.

Count the number of lines after macroexpanding the source, and he'll
feel better. Or tell him this isn't the app he asked for, it's the
program that writes it. (defmacro is the ultimate file compression
utility.)

Not that you asked for advice :)

Andras
From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <8Eo4f.4064$H3.3998@twister.nyc.rr.com>
Andras Simon wrote:
> Kenny Tilton <·······@nyc.rr.com> writes:
> 
> 
>>Alexander Burger wrote:
>>
>>
>>>In case anybody is interested:
>>>Pico Lisp now comes with a complete chess program,
>>>in only 458 lines of code.
>>
>>Cool. Good timing, someone was just complaining that the enterprise
>>application I developed for him, while it does everything he asked and
>>more, is only 60kloc Lisp. I forwarded him your post.
> 
> 
> Count the number of lines after macroexpanding the source, and he'll
> feel better. Or tell him this isn't the app he asked for, it's the
> program that writes it. (defmacro is the ultimate file compression
> utility.)
> 
> Not that you asked for advice :)

I consoled him by saying the 60kloc had been written five times, and 
reminded him of Blaise Pascal's:

    "If I had more time, I would have written a shorter letter."

-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: LuisGLopez
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <1129455400.774601.298280@z14g2000cwz.googlegroups.com>
Or Antoine de Saint-Exupéry:

Perfection is attained not when there is nothing left to add, but when
there is nothing left to take away.

:-)

Luis.
From: justinhj
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <1129572425.359820.127320@g14g2000cwa.googlegroups.com>
I'm staggered that someone would take delivery of an application that
can clearly be demonstrated to do what it was supposed to do and then
ask "how many lines of code is it?"

Why would they care?

Justin
From: ··············@hotmail.com
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <1129574711.877999.246440@g47g2000cwa.googlegroups.com>
justinhj wrote:
> I'm staggered that someone would take delivery of an application that
> can clearly be demonstrated to do what it was supposed to do and then
> ask "how many lines of code is it?"
>
> Why would they care?
>
> Justin

The cynical answer is that some people think software (or other
technical work) is simply a matter of labor. In which case, the amount
of code written is proportional to the amount of labor expended, and a
measure of delivered value per dollar.

More probably, it's a psychological reaction.

A very short app tends to create the suspicion that the bid was padded
for high profit margin rather than for the actual amount of work
required. Even in a competitive bidding process, the customer might not
be sure he is savvy enough to get the right price, and he could feel
that his inexperience is being exploited, or even that he is being
ridiculed. He is no longer confident that he can show off the result to
his boss: "Look at this fantastic app! And I got a great deal for the
company! It was a ton of work for Kenny, but I negotiated him down to a
great price."

Also, one might be suspicious that, while it technically meets the bid
requirements, it might be shoddy in other ways that aren't immediately
apparent, and possibly should have been included in the bid
requirements. It might lack robustness or scalability, or something
else that might be hard to detect in a demo. Sure, this house made out
of rinky-dink cardboard looks nice now, but what happens when it rains
or in a stiff wind?

Even if the customer has experience, it's probably calibrated on a Java
scale, and he thinks he is getting only 10% of what he expected. And,
to top it off, he might be asked why he was foolish enough to hire a
wild Lispnik who doesn't know how to write a large application.

Picture the kid on Christmas morning, who's been eager to open that
huge box under the tree, and finds it's mostly empty space, with a
Faberge egg inside. Sure, it's pretty, but it's not at all what he was
hoping for.
From: Rob Warnock
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <ZZ6dnVrvCOTwzsneRVn-uQ@speakeasy.net>
[OT, I know, but...]

··············@hotmail.com <············@gmail.com> wrote:
+---------------
| Picture the kid on Christmas morning, who's been eager to open that
| huge box under the tree, and finds it's mostly empty space, with a
| Faberge egg inside. Sure, it's pretty, but it's not at all what he was
| hoping for.
+---------------

My Dad did that to my Mom one year: a *huge* box, inside of
which was a bunch of packing material nested within which
was a smaller box, and a smaller one inside that, and so on,
until the innermost tiny box, which contained a beautiful ring.
*She* certainly wasn't disappointed!!  ;-}


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Bill
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <9260d$435ed030$40014c70$16275@DIALUPUSA.NET>
Rob Warnock wrote:
>
> My Dad did that to my Mom one year: a *huge* box, inside of
> which was a bunch of packing material nested within which
> was a smaller box, and a smaller one inside that, and so on,
> until the innermost tiny box, which contained a beautiful ring.
> *She* certainly wasn't disappointed!!  ;-}
> 
For Christmas last year, I gave my dad a medium-large, very heavy 
package, leading to this scene:

"It's the CD I wanted, great!  Let's see...  Packing peanuts...  And 
bricks!"

I think he enjoyed the joke as much as the CD.

Bill
From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <3TV4f.2467$h25.830@news-wrt-01.rdc-nyc.rr.com>
··············@hotmail.com wrote:
> justinhj wrote:
> 
>>I'm staggered that someone would take delivery of an application that
>>can clearly be demonstrated to do what it was supposed to do and then
>>ask "how many lines of code is it?"
>>
>>Why would they care?
>>
>>Justin
> 
> 
> The cynical answer is that some people think software (or other
> technical work) is simply a matter of labor. In which case, the amount
> of code written is proportional to the amount of labor expended, and a
> measure of delivered value per dollar.

Yes, my boss fears possible business partners and customers will react 
that way.

Our most enthusiastic business partner brought in their technical guy 
who visited the Franz site to read up on AllegroStore, saw the demo, and 
then said he did not need to speak to me, he could see what was going on 
and that the substance had to be there to do the things the demo was 
doing. ie, He was able to work backwards from the functionality to the 
design.

Not many people have someone that strong to turn to, so they look for a 
warm fuzzy some other way (man-years? LOC? Oracle?) desperately hoping 
they get it right.

It does not help that two guys wrote 95% of the thing, my boss has no 
cred in the industry, and a fairy godfather turned out to have a limp 
wand. So to date we have a Cinderella story where the Prince cannot get 
past her humble origins despite two enchanting evenings in her company.

-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: Ulrich Hobelmann
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <3rjegaFija2fU1@individual.net>
··············@hotmail.com wrote:
> A very short app tends to create the suspicion that the bid was padded
> for high profit margin rather than for the actual amount of work
> required. Even in a competitive bidding process, the customer might not
> be sure he is savvy enough to get the right price, and he could feel
> that his inexperience is being exploited, or even that he is being
> ridiculed. He is no longer confident that he can show off the result to
> his boss: "Look at this fantastic app! And I got a great deal for the
> company! It was a ton of work for Kenny, but I negotiated him down to a
> great price."

Then they don't understand that LOC are not a measure of productivity, 
but of cost, as Dijkstra IIRC said.  Maintenance costs for the client 
might have a direct relation to the size of this code-blob.

> Also, one might be suspicious that, while it technically meets the bid
> requirements, it might be shoddy in other ways that aren't immediately
> apparent, and possibly should have been included in the bid
> requirements. It might lack robustness or scalability, or something
> else that might be hard to detect in a demo. Sure, this house made out
> of rinky-dink cardboard looks nice now, but what happens when it rains
> or in a stiff wind?

Concise code is rarely shoddy.  Usually it (parts of it) were rewritten 
or refactored one or two times, otherwise it wouldn't be as short.

> Even if the customer has experience, it's probably calibrated on a Java
> scale, and he thinks he is getting only 10% of what he expected. And,
> to top it off, he might be asked why he was foolish enough to hire a
> wild Lispnik who doesn't know how to write a large application.

Well, tell the client to look at the functionality, not the LOC.  Or ask 
them *first* if the program satisfies them, and only then give them the 
code.

> Picture the kid on Christmas morning, who's been eager to open that
> huge box under the tree, and finds it's mostly empty space, with a
> Faberge egg inside. Sure, it's pretty, but it's not at all what he was
> hoping for.

Imagine the guy who wants a cellphone and gets a huge 
1980s-phone-in-a-suitcase instead, or vice versa.  Size matters, but 
remember to sell it right.

-- 
Blessed are the young for they shall inherit the national debt.
	Herbert Hoover
From: Jens Axel Søgaard
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <4354c7e7$0$38655$edfadb0f@dread12.news.tele.dk>
> ··············@hotmail.com wrote:
> 
>> A very short app tends to create the suspicion that the bid was padded
>> for high profit margin rather than for the actual amount of work
>> required. Even in a competitive bidding process, the customer might not
>> be sure he is savvy enough to get the right price, and he could feel
>> that his inexperience is being exploited, or even that he is being
>> ridiculed. He is no longer confident that he can show off the result to
>> his boss: "Look at this fantastic app! And I got a great deal for the
>> company! It was a ton of work for Kenny, but I negotiated him down to a
>> great price."

Hmm. Do you think the customer would be any happier, if the
macro expanded code were shipped instead?

-- 
Jens Axel S�gaard
From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <bR65f.3077$h25.1613@news-wrt-01.rdc-nyc.rr.com>
Jens Axel S�gaard wrote:
>> ··············@hotmail.com wrote:
>>
>>> A very short app tends to create the suspicion that the bid was padded
>>> for high profit margin rather than for the actual amount of work
>>> required. Even in a competitive bidding process, the customer might not
>>> be sure he is savvy enough to get the right price, and he could feel
>>> that his inexperience is being exploited, or even that he is being
>>> ridiculed. He is no longer confident that he can show off the result to
>>> his boss: "Look at this fantastic app! And I got a great deal for the
>>> company! It was a ton of work for Kenny, but I negotiated him down to a
>>> great price."
> 
> 
> Hmm. Do you think the customer would be any happier, if the
> macro expanded code were shipped instead?
> 

I am guessing you are assuming that a domain-specific language is what 
makes the app so small. Not so. Lisp syntax gets a lot of credit just in 
itself, then the big built-in library, then a table-driven design, tehn 
Cells, and then just that the app need not do so much computation as be 
readily configurable (the table-driven design).


-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: Thomas F. Burdick
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <xcvirvuenx1.fsf@conquest.OCF.Berkeley.EDU>
Kenny Tilton <·······@nyc.rr.com> writes:

> Jens Axel S�gaard wrote:
>
> > Hmm. Do you think the customer would be any happier, if the
> > macro expanded code were shipped instead?
> 
> I am guessing you are assuming that a domain-specific language is what 
> makes the app so small. Not so. Lisp syntax gets a lot of credit just in 
> itself, then the big built-in library, then a table-driven design, tehn 
> Cells, and then just that the app need not do so much computation as be 
> readily configurable (the table-driven design).

For those like Jens that are only looking at one side of things: there
are two really easy ways to leverage the power of Lisp, macros and
interpreters/compilers.  Cells is more or less an interpreter, and
it's great for building other domain interpreters on top of it.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | Free Mumia Abu-Jamal! |
     ,--'    _,'   | Abolish the racist    |
    /       /      | death penalty!        |
   (   -.  |       `-----------------------'
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Jens Axel Søgaard
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <43555426$0$38701$edfadb0f@dread12.news.tele.dk>
Thomas F. Burdick wrote:
> Kenny Tilton <·······@nyc.rr.com> writes:
>>Jens Axel S�gaard wrote:

>>>Hmm. Do you think the customer would be any happier, if the
>>>macro expanded code were shipped instead?
>>
>>I am guessing you are assuming that a domain-specific language is what 
>>makes the app so small. Not so. Lisp syntax gets a lot of credit just in 
>>itself, then the big built-in library, then a table-driven design, tehn 
>>Cells, and then just that the app need not do so much computation as be 
>>readily configurable (the table-driven design).
> 
> For those like Jens that are only looking at one side of things: there
> are two really easy ways to leverage the power of Lisp, macros and
> interpreters/compilers.  Cells is more or less an interpreter, and
> it's great for building other domain interpreters on top of it.

I hope you and Kenny know the question wasn't serious.

-- 
Jens Axel S�gaard
From: Thomas F. Burdick
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <xcvfyqxevhf.fsf@conquest.OCF.Berkeley.EDU>
Jens Axel S�gaard <······@soegaard.net> writes:

> Thomas F. Burdick wrote:
> > Kenny Tilton <·······@nyc.rr.com> writes:
> >>Jens Axel S�gaard wrote:
> 
> >>>Hmm. Do you think the customer would be any happier, if the
> >>>macro expanded code were shipped instead?
> >>
> >>I am guessing you are assuming that a domain-specific language is what 
> >>makes the app so small. Not so. Lisp syntax gets a lot of credit just in 
> >>itself, then the big built-in library, then a table-driven design, tehn 
> >>Cells, and then just that the app need not do so much computation as be 
> >>readily configurable (the table-driven design).
> > 
> > For those like Jens that are only looking at one side of things: there
> > are two really easy ways to leverage the power of Lisp, macros and
> > interpreters/compilers.  Cells is more or less an interpreter, and
> > it's great for building other domain interpreters on top of it.
> 
> I hope you and Kenny know the question wasn't serious.

Of course.  But joking comments can sometimes offer the opportunity to
attack pet-peeve misconceptions.  For example, try to badmouth GO
around me :-)

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | Free Mumia Abu-Jamal! |
     ,--'    _,'   | Abolish the racist    |
    /       /      | death penalty!        |
   (   -.  |       `-----------------------'
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Peder O. Klingenberg
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <kspsq126pk.fsf@beto.netfonds.no>
···@conquest.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> For example, try to badmouth GO around me :-)

Silly game, played by wimps.  Now Poker, _there's_ a *mans* game.

:)

...Peder...
-- 
I wish a new life awaited _me_ in some off-world colony.
From: Christopher Koppler
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <1129718265.626785.214670@g14g2000cwa.googlegroups.com>
Peder O. Klingenberg schrieb:

> ···@conquest.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
>
> > For example, try to badmouth GO around me :-)
>
> Silly game, played by wimps.  Now Poker, _there's_ a *mans* game.
>
> :)

No, poker is a nerds game.
*Russian roulette* is the *mans* game.

:)

-- 
Christopher
From: Jens Axel Søgaard
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <4354fe2d$0$38668$edfadb0f@dread12.news.tele.dk>
Kenny Tilton wrote:
> Jens Axel S�gaard wrote:

>> Hmm. Do you think the customer would be any happier, if the
>> macro expanded code were shipped instead?
> 
> I am guessing you are assuming that a domain-specific language is what 
> makes the app so small. Not so. Lisp syntax gets a lot of credit just in 
> itself, then the big built-in library, then a table-driven design, tehn 
> Cells, and then just that the app need not do so much computation as be 
> readily configurable (the table-driven design).

Guilty :-)

But even programs that use builtin forms will normally get
larger after macro expansion.

-- 
Jens Axel S�gaard
From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <Td85f.3083$h25.434@news-wrt-01.rdc-nyc.rr.com>
Jens Axel S�gaard wrote:
> Kenny Tilton wrote:
> 
>> Jens Axel S�gaard wrote:
> 
> 
>>> Hmm. Do you think the customer would be any happier, if the
>>> macro expanded code were shipped instead?
>>
>>
>> I am guessing you are assuming that a domain-specific language is what 
>> makes the app so small. Not so. Lisp syntax gets a lot of credit just 
>> in itself, then the big built-in library, then a table-driven design, 
>> tehn Cells, and then just that the app need not do so much computation 
>> as be readily configurable (the table-driven design).
> 
> 
> Guilty :-)

if it makes you feel better, the application itself constitutes a DSL. 
But that is different than saying a DSL was used to create it.

> 
> But even programs that use builtin forms will normally get
> larger after macro expansion.
> 

I see. Given low observable LOC, you persist in a quest for the missing 
"dark LOC" which must be supporting the extensive application 
functionality. Repeating the sin of equating LOC with power.

Ten more years in meditation for you, grasshopper. :)

-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: Jens Axel Søgaard
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <435553b6$0$38701$edfadb0f@dread12.news.tele.dk>
Kenny Tilton wrote:

>> But even programs that use builtin forms will normally get
>> larger after macro expansion.
> 
> I see. Given low observable LOC, you persist in a quest for the missing 
> "dark LOC" which must be supporting the extensive application 
> functionality. Repeating the sin of equating LOC with power.
> 
> Ten more years in meditation for you, grasshopper. :)

Well, as they say, the customer is always right.

-- 
Jens Axel S�gaard

Excerpt from a conversation between a customer support person and a
customer working for a well-known military-affiliated research lab:

Support:  "You're not our only customer, you know."
Customer: "But we're one of the few with tactical nuclear weapons."
From: Kenny Tilton
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <wlT4f.2447$h25.2059@news-wrt-01.rdc-nyc.rr.com>
justinhj wrote:
> I'm staggered that someone would take delivery of an application that
> can clearly be demonstrated to do what it was supposed to do...

They had seen a great demo. Lots of crappy software can be used to do a 
great demo. Just carefully avoid the stuff that does not work. And who 
knows how good is the code, even if it all works?

>... and then
> ask "how many lines of code is it?"
> 
> Why would they care?

Just getting familiar with the rough outline of the beast before asking 
harder questions.

-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state 
I finally won out over it."
     Elwood P. Dowd, "Harvey", 1950
From: Steven M. Haflich
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <a205f.4596$Zv5.4121@newssvr25.news.prodigy.net>
Alexander Burger wrote:
> Pico Lisp now comes with a complete chess program,
> in only 458 lines of code.  Developed just for
> the fun of programming.
> 
> ASCII board display, unlimited undo/redo,
> board position save+load, analysis and autoplay.
> 
> Neither strong nor fast, but should play correct chess
> (castling, pawn promotion, en passant capture etc.).

This suggests an interesting problem:  Devise the smallest
possible program that plays legal chess, however poorly.
The program must conform to the accepted rules and generate
legal rules when possible, but there is no consideration
given to generating winning moves.

I suspect a solution can be written in significantly less
than 458 lines, and I also suspect that the winning language
would be Prolog rather than Lisp.  This is based on the
obswervation that legal-move generation in chess is defined
rather more-naturally declaritively than algorithmically.
From: Jon Harrop
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <4354f7fd$0$73604$ed2619ec@ptn-nntp-reader03.plus.net>
Steven M. Haflich wrote:
> I suspect a solution can be written in significantly less
> than 458 lines, and I also suspect that the winning language
> would be Prolog rather than Lisp.  This is based on the
> obswervation that legal-move generation in chess is defined
> rather more-naturally declaritively than algorithmically.

This would make an interesting language benchmark. :-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com
From: justinhj
Subject: Re: Chess in 458 Lines
Date: 
Message-ID: <1129651797.032141.100260@g49g2000cwa.googlegroups.com>
Stefan Ram wrote:
> Alexander Burger <···@software-lab.de> writes:
> >Pico Lisp now comes with a complete chess program, in only 458
> >lines of code. Developed just for the fun of programming.
>
>   The first computer program I bought was called "MICROCHESS"
>   and was for the 6502. It fitted into 1 KByte of memory.
>   It was distributed as a small booklet, you had to type it in.
>
> http://www.6502.org/source/games/uchess/uchess.pdf

Wow it's even commented really nicely. Impressive.

Justin