Main
Date: 25 Aug 2006 19:07:42
From: Dave (from the UK)
Subject: Program for Sanny to generate next post.
Sanny, here is a program which you can use to generate the next
newsgroups post about your program. It will give allow you to
concentrate your efforts on improving the program, whilst generating
ratings that are no less accurate than what you have already.

It compiles OK on my Sun with either gcc or Sun's cc.

teal /export/home/drkirkby % /opt/SUNWspro/bin/cc sanny.c
teal /export/home/drkirkby % gcc -Wall sanny.c

#include <stdio.h >
#include <stdlib.h >

#define LEVELS 4 /* The number of levels the program plays at */

static int intcompare(const void *p1, const void *p2);

int main(int argc, char **argv)
{
char mode[][20]={"beginner","easy","normal","master"};
int ratings[LEVELS];
int i;

/* Generate some spam */
printf("Play Chess at: http://www.getclub.com/Chess.html\n\n");
printf("Our team of programmers have found the bug so now the
program\n");
printf("at http://www.getclub.com/Chess.html plays\n");
printf("faster and stronger.\n\n");
printf("These are the current ratings.\n");
printf("Only masters should attempt the master level if they want\n");
printf("to have any chance of winning.\n\n");

/* Generate the ratings */
for (i=0; i<LEVELS; ++i)
ratings[i]=rand();

/* Sort them */
qsort((void *) ratings,LEVELS, sizeof(int), intcompare);

for (i=0; i<LEVELS; ++i)
printf("%s has a FIDE rating of %d\n",mode[i],ratings[i]);

/* Save typing */
printf("\nBye\nSanny\n\n");
/* Generate more spam */
printf("Play Chess at: http://www.getclub.com/Chess.html\n");
exit(0);
}

static int intcompare(const void *p1, const void *p2)
{
int i = *((int *)p1);
int j = *((int *)p2);

if (i > j)
return (1);
if (i < j)
return (-1);
return (0);
}

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)




 
Date: 01 Sep 2006 06:09:14
From: Taylor Kingston
Subject: Re: Bugs are still thick as flies on ...

David Richerby wrote:
> <[email protected]> wrote:
> > David Richerby wrote:
> >> Taylor Kingston <[email protected]> wrote:
> >>> Other feelings of comparable accuracy:
> >>>
> >>> That the brontosaurus was thin at the ends and thick in the middle.
> >>
> >> I'm sorry, Miss Elk, but there's actually no such thing as a
> >> brontosaurus.

I figured that since you knew the Bonzo Dog Band song, you'd be the
one to notice my Python references, Dave.

> >> http://en.wikipedia.org/wiki/Brontosaurus
> >
> > Enlightening.
>
> This led to a very amusing round of the BBC quiz show QI (`Quite
> Interesting'). They usually have a round where the question has an
> answer that seems obvious but is actually wrong. If you give this
> answer, a siren sounds and you lose points. Alan Davies usually falls
> into the trap. In this case,
>
> Stephen Fry (quizmaster): Name a dinosaur beginning with B.
> Alan Davies buzzes: Brontosaurus! (Looks very pleased for being so
> clever)
>
> Siren sounds. Many points lost.
>
> I haven't had time to see if the clip's available on the BBC website
> at
>
> http://www.bbc.co.uk/comedy/qi/

Most unfair. Like the late, great biologist Stephen Jay Gould,
*_and_* the United States Postal Service, I much prefer Brontosaurus
(Thunder Lizard!) over Apatosaurus (deceptive lizard). So what if O.C
sh, when he first described Apatosaurus in 1877 and then
Brontosaurus in 1879, didn't realize he was dealing with the same
species? (Nobody else did until 1903.) As Gould wrote in "Bully for
Brontosaurus" (W.W. Norton & Co., 1991): "Brontosaurus soon became
everyone's typical sauropod -- indeed *_the_* canonical dinosaur of
popular consciousness, from the Sinclair logo to Disney's Fantasia ..."
The USPS took a bunch of flak from nit-picking Apato-nazis when a
1989 issue of dinosaur-themed 25-cent stamps included one labeled
"Brontosaurus." They were even accused of "fostering scientific
illiteracy"! Postal Bulletin 21744 had this dignified reply: "Although
now recognized by the scientific community as Apatosaurus, the name
Brontosaurus was used for the stamp because it is more familiar to the
general population." Gould comments: "Names fixed in popular usage may
be validated even if older designations have technical priority."
So take that, BBC! Take that, Apato-nazis! Bully for Brontosaurus!



  
Date: 01 Sep 2006 15:00:01
From: David Richerby
Subject: Re: Bugs are still thick as flies on ...
Taylor Kingston <[email protected] > wrote:
> Most unfair. Like the late, great biologist Stephen Jay Gould,
> *_and_* the United States Postal Service, I much prefer Brontosaurus
> (Thunder Lizard!) over Apatosaurus (deceptive lizard).

Taylor, you know as well as I do that the USPS hasn't delivered mail
to sauropods for millions of years so its preferences there are
somewhat out of date.


Dave.

--
David Richerby Microsoft Goldfish (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ fish that's really hard to use!


   
Date: 01 Sep 2006 20:06:30
From:
Subject: Re: Bugs are still thick as flies on ...
David Richerby <[email protected] > wrote:
> Taylor Kingston <[email protected]> wrote:
> > Most unfair. Like the late, great biologist Stephen Jay Gould,
> > *_and_* the United States Postal Service, I much prefer Brontosaurus
> > (Thunder Lizard!) over Apatosaurus (deceptive lizard).
>
> Taylor, you know as well as I do that the USPS hasn't delivered mail
> to sauropods for millions of years so its preferences there are
> somewhat out of date.

Now, Dave. What would a subject of the Queen know about the Postal Service
here in the Colonies? I rarely receive mail more than one week after its
postk date, unless it's from London. ;-)

--
Nick. Support severely wounded and disabled Veterans and their families!

Thank a Veteran and Support Our Troops. You are not forgotten. Thanks ! ! !
~Semper Fi~


 
Date: 30 Aug 2006 22:46:06
From: Sanny
Subject: ALL BUGS have been REMOVED
ALL BUGS have been REMOVED

Play Chess at: http://www.GetClub.com/Chess.html

Now you can play multiplayer also.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



  
Date: 31 Aug 2006 09:11:37
From: Dave (from the UK)
Subject: Re: ALL BUGS have been REMOVED
Sanny wrote:
> ALL BUGS have been REMOVED
>
> Play Chess at: http://www.GetClub.com/Chess.html
>
> Now you can play multiplayer also.
>
> Bye
> Sanny
>
> Play Chess at: http://www.GetClub.com/Chess.html
>

Wow, you must have worked hard. From the recent comments from others
about the quality of your chess program, now you have removed ALL the bugs.

I'm pleased for you. Does that mean you will only need these lines now:


#include <stdio.h >

int main(int argc, char **argv)
{
int i;


/* Generate some spam */
for(i=0; i<5;++i)
printf("Play Chess at: http://www.getclub.com/Chess.html\n");

/* Save typing */
printf("\nBye\nSanny\n\n");

/* Generate more spam, in case someone forgot the URL */
for(i=0; i<2;++i)
printf("Play Chess at: http://www.getclub.com/Chess.html\n");
}
--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


 
Date: 30 Aug 2006 13:10:00
From:
Subject: Re: Bugs have been Removed.
jaxter wrote:
> Personally, because most programmers are human I expect them to make
> human errors even in well-defined domains;

This is a realistic expectation.

> but I don't expect them to release those errors to the rest of humanity to
> discover and report. I expect them to find them and eliminate them,
> secretly if necessary.

This is an unrealistic expectation.

Due to real-world constraints such as budgets and timelines, bug-free
software is rare even for well-defined, verifiable programs.

However, Sanny's "team of programmers" has had lots of time to develop
this, and his software is probably <10,000 lines of code. Given the
number of defects reported his development and testing methodology is
almost certainly flawed.

If you lack programming expertise, it's often worthwhile to hire an
experienced develop to come up with a design and process to follow.



 
Date: 30 Aug 2006 13:10:00
From:
Subject: Re: Bugs have been Removed.
jaxter wrote:
> Personally, because most programmers are human I expect them to make
> human errors even in well-defined domains;

This is a realistic expectation.

> but I don't expect them to release those errors to the rest of humanity to
> discover and report. I expect them to find them and eliminate them,
> secretly if necessary.

This is an unrealistic expectation.

Due to real-world constraints such as budgets and timelines, bug-free
software is rare even for well-defined, verifiable programs.

However, Sanny's "team of programmers" has had lots of time to develop
this, and his software is probably <10,000 lines of code. Given the
number of defects reported his development and testing methodology is
almost certainly flawed.

If you lack programming expertise, it's often worthwhile to hire an
experienced develop to come up with a design and process to follow.



 
Date: 30 Aug 2006 07:35:56
From: jaxter
Subject: Re: Bugs have been Removed.
I believe what Alkhimey was trying to express was that:

- there is no valid reason for a bug to appear in a chess program,
other than pure human error, since all of the necessary functions are
already very well-defined and well-behaved (i.e. no undefined behavior,
no asymptotic behavior, no possible undefined inputs/input ranges,
etc.). -

In other words, this is a well-trodden path.

In support of Alkhimey's point, you only have to look at the number of
chess engines that can be connected to one of a large number of
web-browser-based chess software clients such as Winboard, using (yes,
another standard) the UCI interface to communicate back and forth. The
facts that there are both a UCI standard and a strong practitioner base
(and conventions, too) in chess engine design says this work by Sanny
is not innovation - it's reinventing the wheel (and at least in part at
some of this web community's expense (in time), by the looks of it).

In other endeavors, where this is the first work in the area, there is
no trodden path to follow, and a bit of experimentation is almost
unavoidable. That's where Alkimey seems to be saying bugs are excusable
[my words, of course, not his, again].

Personally, because most programmers are human I expect them to make
human errors even in well-defined domains; but I don't expect them to
release those errors to the rest of humanity to discover and report. I
expect them to find them and eliminate them, secretly if necessary.

jaxter

David Richerby wrote:
> Alkhimey <[email protected]> wrote:
> > Bugs shouldn't occour in chess program becouse there is no reason
> > for them to occour.
>
> You have obviously never written a computer program in your life.
>
>
> Dave.
>
> --
> David Richerby Poisonous Psychotic Watch (TM): it's
> www.chiark.greenend.org.uk/~davidr/ like a precision chronometer but it
> wants to kill you and it'll kill you
> in seconds!



  
Date: 30 Aug 2006 18:14:48
From: Dave (from the UK)
Subject: Re: Bugs have been Removed.
jaxter wrote:

> Personally, because most programmers are human I expect them to make
> human errors even in well-defined domains; but I don't expect them to
> release those errors to the rest of humanity to discover and report.

Are you serious? Of course bugs will appear in released versions. It's
almost impossible to remove all the bugs from non-trivial code and even
more unlikely for one person alone to find them.

> I
> expect them to find them and eliminate them, secretly if necessary.

I'm sure everyone would like to release software, having removed all
bugs in total secrecy, but it will just never happen. I assume you have
never written a non-trivial computer program.

However, I do feel Sanny could do a lot more testing himself and rely
far less on others. If he took all the time he spends writing newsgroups
posts and devoted that time to developing an automated test procedure,
playing his program against crafty for example, crafty could report 99%
of the bugs he appears to have. Illegal moves, moving twice etc.

He could also get an objective measure of strength too. He could weaken
crafty and then determine how his program compares in 100 games and how
it does when he makes changes. He would be using an opponent that is at
least consistent, whereas humans are likely to differ in their alertness
in different times they play.

He could try other chess engines too. GNU chess for example. Then
perhaps release it and see how well it does against humans. But at least
get rid of 98% of the bugs.

If Sanny run his web pages though a validator, that would report 99% of
the errors in his web pages. It might highlight why half the names are
often shown improperly on my browser.

I've never written a chess program, so have not studied in detail how to
best write/debug one, but I'm sure I would do a lot of the debugging by
testing with automated software.

One program I wrote I test by compiling it on many computers in an
automated fashion. Then a test suite runs on each computer and I receive
the details of any test failures. Sure problems occurred I'd not
foreseen, such as when run on a Cray, where sizeof(short) was 8, which I
was not expecting at all and had not tested the size.

But Sanny takes a different approach to me. I think mine is better.

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


  
Date: 30 Aug 2006 16:57:33
From: David Richerby
Subject: Re: Bugs have been Removed.
jaxter <[email protected] > wrote:
> David Richerby wrote:
>> Alkhimey <[email protected]> wrote:
>>> Bugs shouldn't occour in chess program becouse there is no reason
>>> for them to occour.
>>
>> You have obviously never written a computer program in your life.
>
> I believe what Alkhimey was trying to express was that:
>
> - there is no valid reason for a bug to appear in a chess program,
> other than pure human error, since all of the necessary functions
> are already very well-defined and well-behaved (i.e. no undefined
> behavior, no asymptotic behavior, no possible undefined inputs/input
> ranges, etc.). -

Human error an extremely valid and important reason for bugs to appear
in computer programs. We've known that bugs are likely in even the
simplest programs since the 1940s.

http://www.cl.cam.ac.uk/Relics/jpegs/edsac99.30.jpg

The second entry reads, ``May 7th [1949]. Machine still operating --
table of squares several times. Table of primes attempted --
programme incorrect...'' Sir Maurice Wilkes reked that this
failure to correctly write a program to print out the primes less than
100 (or the first ten primes or something like that) caused him to
realise that he would be spending most of his life not writing but
debugging computer programs.

A chess engine is a difficult thing to write. It's a very complex
piece of code and can have lots of very subtle bugs in it --
particularly hash table bugs. As I recall, a lot of the strength of
Fruit was attributed to its having been very, very carefully debugged.


> Personally, because most programmers are human I expect them to make
> human errors even in well-defined domains; but I don't expect them to
> release those errors to the rest of humanity to discover and report.

You have obviously never used a computer program in your life.


Dave.

--
David Richerby Poetic Cat (TM): it's like a cat but
www.chiark.greenend.org.uk/~davidr/ it's in verse!


 
Date: 28 Aug 2006 18:43:10
From: help bot
Subject: Re: Bugs are still thick as flies on ...

Taylor Kingston wrote:

> That llamas are larger than frogs.


Nonsense. In the Pleistocene era, I believe, there was
a frog which susbsisted by eating brontosaur eggs, sea
turtles, french fries, and seaweed. This creature grew
nearly as large as Larry Parr's ego, and in fact, even
Tyranosaurus Rex steered clear, on account of its
countless poison glands in the skin. OTOH, in the
Cryassic (or was it the Jurrasic?) period, a giant llama-
like creature once roamed the wetlands of Pangaea,
forraging on palms and firs, and this creature grew so
tall it could see over Paul Bunyan's head, all the way
to where his ox, Babe, lay resting in the midnight sun
(yes, at that time the sun rose at 9 pm EST and set in
the East around mid-morning). Ah, the good old days....

Yet all these "giant" (by modern day standards) creatures
pale in comparison to the giant turtle upon whose back the
world was set, and the elephant whose own back supported
the turtle.

Right now, I have just been kicked off of Sanny's Web
site about four times in a row -- just as before, while I am
winning. Sanny's program does not "like" to lose, and
it seems to go bonkers at times. Worst of all, his
specifications require that you win at least two games
against human opponents, but I can't get any humans
to play me, even when there are one or two logged on
there.

-- help bot



 
Date: 28 Aug 2006 12:03:42
From: Taylor Kingston
Subject: Re: Bugs are still thick as flies on ...

Dave (from the UK) wrote:
> I may be wrong, but I do get the feeling Sanny is probably not going
> about it to the right way to reduce the bugs in his programs.

Other feelings of comparable accuracy:

That the brontosaurus was thin at the ends and thick in the middle.
That sheep's bladders are ineffective against earthquakes.
That you cannot chop down a tree with a herring.
That no one expects the Spanish Inquisition.
That llamas are larger than frogs.



  
Date: 01 Sep 2006 14:31:48
From: Kenneth Sloan
Subject: Re: Bugs are still thick as flies on ...
"Taylor Kingston" <[email protected] > writes:

> So take that, BBC! Take that, Apato-nazis! Bully for Brontosaurus!
>

"off with their heads!"

--
Kenneth Sloan [email protected]
Computer and Information Sciences (205) 934-2213
University of Alabama at Birmingham FAX (205) 934-5473
Birmingham, AL 35294-1170 http://www.cis.uab.edu/sloan/


  
Date: 29 Aug 2006 10:11:32
From: David Richerby
Subject: Re: Bugs are still thick as flies on ...
Taylor Kingston <[email protected] > wrote:
> Dave (from the UK) wrote:
>> I may be wrong, but I do get the feeling Sanny is probably not going
>> about it to the right way to reduce the bugs in his programs.
>
> Other feelings of comparable accuracy:
>
> That the brontosaurus was thin at the ends and thick in the middle.

I'm sorry, Miss Elk, but there's actually no such thing as a
brontosaurus.

http://en.wikipedia.org/wiki/Brontosaurus


Dave.

--
David Richerby Revolting Confusing Tongs (TM):
www.chiark.greenend.org.uk/~davidr/ it's like a pair of tongs but you
can't understand it and it'll turn
your stomach!


 
Date: 28 Aug 2006 11:34:59
From:
Subject: Re: Bugs have been Removed.
Dave (from the UK) wrote:
> I may be wrong, but I do get the feeling Sanny is probably not going
> about it to the right way to reduce the bugs in his programs.

According to Sanny, "It is very difficult to understand what is linking
to which line of code." This implies it's more spaghetti-code than
well-designed modules.

Further, he's either entirely missing or has a mediocre test process.
It's possibly he simply checks that he can make a few moves and then
publishes it.



 
Date: 27 Aug 2006 23:49:21
From: Sanny
Subject: Re: You were CHECK MATED.

help bot wrote:
> Sanny wrote:
> > > While we are on the subject, why can't your programmers
> > > fix the problem where the program makes you capture its
> > > King (after it has made an illegal move)? The complaints
> > > about this issue will never go away, even if your program
> > > gets strong enough to crush Taylor Kingston. :)
> >
> >
> > Programmers have fixed the Problem of King Capture. Well not yet Tested
> > have you seen King Captured in recent games?
>
>
> Yes, I have. But not nearly as often as before.
>

It was corrected Yesterday, So all the Games you started before that
made King Captured. Now on No King Captures All legal Moves.

In Brief here is what we have

All Legal Moves
Moves In Time
Better Moves

This is what is needed in a Chessgame.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 27 Aug 2006 23:15:31
From: help bot
Subject: Re: You were CHECK MATED.

Dave (from the UK) wrote:

> WORKS !! You must be joking.
>
> You really do you have your head up your **** so far you can't see what
> is going on around you.
>
> To me, it indicates a lack of attention to detail, which would rather
> explain the problems your program has. Do your "programmers" (which I
> assume means just you) ignore compiler warnings in the same way they
> (you>) ignore HTML errors? If so, it could perhaps explain the huge
> number of bugs you seem to have.
>
> Some problems (spelling, ascetic etc) will not make a lot of difference,


Asthetic errors aside, your acidic comments do remind me
of what you call a "bug" below:

In the window where games can be replayed after the fact,
the finish, or mating move, is just chopped off, like someone's
head in a horror film, leaving us guessing. Obviously, visitors
would much rather be able to see the game in its entirety.


-- help bot



 
Date: 27 Aug 2006 23:07:20
From: help bot
Subject: Re: You were CHECK MATED.

Sanny wrote:
> > While we are on the subject, why can't your programmers
> > fix the problem where the program makes you capture its
> > King (after it has made an illegal move)? The complaints
> > about this issue will never go away, even if your program
> > gets strong enough to crush Taylor Kingston. :)
>
>
> Programmers have fixed the Problem of King Capture. Well not yet Tested
> have you seen King Captured in recent games?


Yes, I have. But not nearly as often as before.

To me, the simplest way to write a chess program is to
treat the King as just another piece, but then weed out
moving into check as not a legal move, just as moving
off the 8 by 8 board is not legal. But there will always be
new players for whom this is upsetting.

-- help bot



 
Date: 27 Aug 2006 22:59:47
From: Sanny
Subject: Re: You were CHECK MATED.

> > So why waste time putting
> > </html> , When without it everything works.
>
>
> WORKS !! You must be joking.


I have put </html > Now I hope everything is OK.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



  
Date: 28 Aug 2006 09:52:44
From: Dave (from the UK)
Subject: Re: You were CHECK MATED.
Sanny wrote:

> I have put </html> Now I hope everything is OK.

Thanks, you have taken one bit of advice from me!

If you fixed the other errors related to how you include the javascript,
you might find peoples browsers behaved more consistently. I'm not
saying that is the problem, but it might be. Browsers are designed to
work to a specification set by the W3C. If you send data which does not
conform to that spec, the behavior of the browser can be undefined. Some
browsers might work fine, others not at all and others might well behave
in a manner you don't intend.

Someone else has told you of problems with Firefox and I suspect you
will find a lot of people are using Firefox. Development on Internet
Explorer seems to have almost stopped and it is always playing 'catchup'
to Firefox now.

Also remember, if a current version of a browser works with your site,
and the next version does not, it will not necessarily be a bug in the
browser. Since you are sending undefined data to the browser, the way
the next version of the same browser behaves may well be different.

I can't help feeling it would be worth your time sorting out the web
page - at least you will know that is not the source of problems
reported. Realistically it should not take too long to do - perhaps an
hour or two at the most.

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


 
Date: 27 Aug 2006 22:45:04
From: Sanny
Subject: Re: You were CHECK MATED.

> While we are on the subject, why can't your programmers
> fix the problem where the program makes you capture its
> King (after it has made an illegal move)? The complaints
> about this issue will never go away, even if your program
> gets strong enough to crush Taylor Kingston. :)


Programmers have fixed the Problem of King Capture. Well not yet Tested
have you seen King Captured in recent games?

Bye
Sanny


Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 27 Aug 2006 22:43:43
From: Sanny
Subject: Re: You were CHECK MATED.
> While we are on the subject, why can't your programmers
> fix the problem where the program makes you capture its
> King (after it has made an illegal move)? The complaints
> about this issue will never go away, even if your program
> gets strong enough to crush Taylor Kingston. :)
>

Programmers has fixed the Problem of King Capture. Well not yet Tested
have seen King Captured in recent games?

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 27 Aug 2006 13:01:47
From: help bot
Subject: Re: You were CHECK MATED.

Sanny wrote:
> > > RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess
> >
> > An interesting "HTML" web page. It starts
> >
> > <html>
> >
> > but there is no
> >
> > </html>
>
> Most of the Players play using Microsoft Internet Explorer and
> Netscape.
>
> 99% can play my games without any problems So why waste time putting
> </html> , When without it everything works. can you list names of
> browsers which will give errors for my site along with their usage.
>
> Thanks for your Advices.


Sanny, I am using Firefox, and there are some strange things
which happen during games.

One of these is that, just as the program makes its move, it
will automatically open another browser window showing my
"home page" on your site. I have to stop and close this window
every time as it is distracting. This doesn't happen every game,
but in some games it happens several times. I have wondered
if it is possible that someone is trying to check my home page,
and their actions are causing the window to pop up.

Another issue is that your program, no matter which level it is
set to, seems to kick me off just when I am about to win -- just
like a human player, refusing to admit loss. :)

As for "user-friendliness", I sometimes wonder if the other
players displayed on one screen can "hear" my requests to
play them, since I rarely get any response except some of
disappearing from view. It would be better if there was a
quick, easy way to tell which players are truly available, and
which are tied up in a game, for example. Of course, there
are often so few players (if any) that I cannot get the required
games vs. human opponents.

While we are on the subject, why can't your programmers
fix the problem where the program makes you capture its
King (after it has made an illegal move)? The complaints
about this issue will never go away, even if your program
gets strong enough to crush Taylor Kingston. :)

-- help bot



 
Date: 27 Aug 2006 11:59:46
From: Alkhimey
Subject: Re: Bugs have been Removed.
> I once took a class in which it was stated flatly that, including
> debugging, the average professional programmer churned out a
> "whopping" twenty lines of code per working day. I was stunned,
> as I believed our problems with bugs were mainly related to us
> students not having any experience, and to the fact that many
> apparently could not think in a logical manner, but were taking
> the class anyway in hopes of making the big bucks.

In GUI software, maybe. But here we are talking about a chess program.
Bugs shouldn't occour in chess program becouse there is no reason for
them to occour. The problem is very well defined and the rules of chess
can't be misunderstood. The things Sanny describe as bugs may be
indicator of that his program is not playing well. If real bug occours,
than the programmers aren't really proffesional. For example, someone
stated that the program is giving pieces for no reason. This is a bug
and a sireous one, probably someone srew up in the evaluation function.

help bot wrote:
> Alkhimey wrote:
>
> > > it is very
> > > difficult to understand what is linking to which line of code
> >
> > If this is the case than you should replace your programmers.
>
>
> I once took a class in which it was stated flatly that, including
> debugging, the average professional programmer churned out a
> "whopping" twenty lines of code per working day. I was stunned,
> as I believed our problems with bugs were mainly related to us
> students not having any experience, and to the fact that many
> apparently could not think in a logical manner, but were taking
> the class anyway in hopes of making the big bucks.
>
> IMO, Sanny's program has gotten quite a bit faster lately,
> and in fact I recently saw the number "10" appear in the
> window which apparently indicates the depth of search,
> admittedly in an endgame position.
>
> -- help bot



  
Date: 28 Aug 2006 11:15:35
From: David Richerby
Subject: Re: Bugs have been Removed.
Alkhimey <[email protected] > wrote:
> Bugs shouldn't occour in chess program becouse there is no reason
> for them to occour.

You have obviously never written a computer program in your life.


Dave.

--
David Richerby Poisonous Psychotic Watch (TM): it's
www.chiark.greenend.org.uk/~davidr/ like a precision chronometer but it
wants to kill you and it'll kill you
in seconds!


   
Date: 28 Aug 2006 14:07:29
From: Dave (from the UK)
Subject: Re: Bugs have been Removed.
David Richerby wrote:
> Alkhimey <[email protected]> wrote:
>
>>Bugs shouldn't occour in chess program becouse there is no reason
>>for them to occour.
>
>
> You have obviously never written a computer program in your life.
>
>
> Dave.
>

So true.

I doubt there is a non-trivial program written that has no bugs. Sure,
one can write a hello world that is bug free, but beyond that bugs are
inevitable.

Then of course there is the operating system and the compiler, so even
if the program was bug free, that is no guarantee it will run perfectly.
I've had compilers generate bugs (Microsoft's Quick C would often fail
to work if an integer was defined as 'int', but worked fine if one used
'static int').

I've never written "safety critical" software, but I have written
software to control a gas blender used for medical experiments on
humans. Failures would have been uncomfortable, but not dangerous. It
makes you think a bit more about coding!!

I'm also aware of one safety critical software bug that could have
killed someone (an intravenous giving set would under some circumstances
pump huge volumes of a drug into someone. I'm not sure if someone died
as a result of that or not - I suspect not, as the **** did not really
hit the fan!!!)

I may be wrong, but I do get the feeling Sanny is probably not going
about it to the right way to reduce the bugs in his programs.

His original attitude (later changed I would admit) of dismissing the
fact his web page did not have a </html >:


"99% can play my games without any problems So why waste time putting
</html > , When without it everything works."

AND his objections some time back to using a validator since people view
web pages with browsers, and not validators, make me think he is not
giving himself the best chance of writing a program with a low number of
bugs.

Of course Sanny (and/or his team of programmers) might take a very
different attitude to coding web pages than writing he (they) do writing
Java code. But it's hard to believe someone who dismissed errors on
their web pages like a lack of </html > would not dismiss compiler
warnings or other processes which one might consider at not "best
practice".

I assume Sanny wants to make some money from this, but if not, why not
release it under the GPL and let others look at the code? They might
find problems and suggest solutions. Before doing that, write some
documentation which describes how the software should work. Doing that
alone will probably eliminate some bugs, as all too often when we write
how our programs work, we realise we don't understand what we wrote.

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


    
Date: 28 Aug 2006 15:09:40
From: David Richerby
Subject: Re: Bugs have been Removed.
Dave (from the UK) <[email protected] > wrote:
> I'm also aware of one safety critical software bug that could have
> killed someone

Google for `Therac-25' for the standard example of a software bug that
did kill people.


> I may be wrong, but I do get the feeling Sanny is probably not going
> about it to the right way to reduce the bugs in his programs.

I may be wrong but I agree with you. :-)


Dave.

--
David Richerby Technicolor Tool (TM): it's like
www.chiark.greenend.org.uk/~davidr/ a handy household tool but it's in
realistic colour!


     
Date: 28 Aug 2006 17:43:35
From: Dave (from the UK)
Subject: Re: Bugs have been Removed.
David Richerby wrote:
> Dave (from the UK) <[email protected]> wrote:
>
>>I'm also aware of one safety critical software bug that could have
>>killed someone
>
>
> Google for `Therac-25' for the standard example of a software bug that
> did kill people.
>

I was aware of that one - but was more closely involved with the other
issue on the intravenous giving set. The company involved was indirectly
paying my salary, as I worked as a researcher in the medical physics
department of a university.

>>I may be wrong, but I do get the feeling Sanny is probably not going
>>about it to the right way to reduce the bugs in his programs.
>
>
> I may be wrong but I agree with you. :-)

Sanny should take note and at least consider the possibility that I am
correct and you are right to agree with me.

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


 
Date: 27 Aug 2006 05:40:32
From: Taylor Kingston
Subject: Re: Bugs have been Removed.

Sanny wrote:
> I am happy to find Easy level has beaten Nomorechess in one game.
>
> Thats a good improvement. Nomorechess played 40 games without loss but
> then Easy level succeded in beating him in a game.

It would be quite wrong to claim this game as evidence of any
improvement in the program. It played quite badly, for example losing a
piece early on, as has been its habit for months. But somehow
Nomorechess managed to play worse. Nomorechess was clearly winning at
several points, but he then would make serious mistakes that gave away
his advantage and eventually threw the game to the program.



 
Date: 27 Aug 2006 02:21:17
From: Sanny
Subject: Re: You were CHECK MATED.
> > RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess
>
> An interesting "HTML" web page. It starts
>
> <html>
>
> but there is no
>
> </html>

Most of the Players play using Microsoft Internet Explorer and
Netscape.

99% can play my games without any problems So why waste time putting
</html > , When without it everything works. can you list names of
browsers which will give errors for my site along with their usage.

Thanks for your Advices.

Bye
Sanny



  
Date: 27 Aug 2006 10:50:43
From: Dave (from the UK)
Subject: Re: You were CHECK MATED.
Sanny wrote:
>>>RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess
>>
>>An interesting "HTML" web page. It starts
>>
>><html>
>>
>>but there is no
>>
>></html>
>
>
> Most of the Players play using Microsoft Internet Explorer and
> Netscape.

Do you ever look at the statistics from your web server and see what
browsers are being used? I suspect you will find under 1% using
Netscape. Firefox is likely to be pretty high up.

> 99% can play my games without any problems

Em, there seems to be quite a few problems reported about browsers
needing refreshing and locking up. Why do you keep giving instructions
to people about their game being saved and how to get at it?

> So why waste time putting
> </html> , When without it everything works.


WORKS !! You must be joking.

You really do you have your head up your **** so far you can't see what
is going on around you.

To me, it indicates a lack of attention to detail, which would rather
explain the problems your program has. Do your "programmers" (which I
assume means just you) ignore compiler warnings in the same way they
(you >) ignore HTML errors? If so, it could perhaps explain the huge
number of bugs you seem to have.

Some problems (spelling, ascetic etc) will not make a lot of difference,
but its difficult to predict how failing to code the web pages will or
will not affect people.

> can you list names of
> browsers which will give errors for my site along with their usage.

Many, judging by the reports I see. People saying they need to close and
reopen their browsers, the need to press refresh ... etc etc.

I just looked at the game above and see I can't replay it to the start -
it always shows the first moved played. That is a bug - I'm using
Mozilla on SPARC, although I doubt that is a browser issue, but just the
underlying program.

> Thanks for your Advices.

There's not much point, as you never seem to take it.

> Bye
> Sanny
>


--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


   
Date: 28 Aug 2006 11:12:20
From: David Richerby
Subject: Re: You were CHECK MATED.
Dave (from the UK) <[email protected] > wrote:
> Sanny wrote:
>> Most of the Players play using Microsoft Internet Explorer and
>> Netscape.
>
> Do you ever look at the statistics from your web server and see what
> browsers are being used? I suspect you will find under 1% using
> Netscape. Firefox is likely to be pretty high up.

Depends how closely you look at the logs. Most web browsers claim to
be some version of Mozilla or Internet Explorer, even if they're not.


> Some problems (spelling, ascetic etc) will not make a lot of difference,
^^^^^^^^^
Um, `aesthetic'? :-)


Dave.

--
David Richerby Impossible Book (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ romantic novel but it can't exist!


 
Date: 27 Aug 2006 00:49:11
From: help bot
Subject: Re: Bugs have been Removed.

Sanny wrote:
> > complicated than merely taking my 1969 rating and performing
> > a simple calculation. Objectively, Sanny's program used to be
> > so slow that this was all people talked about. Now the issue
> > has morphed to "bugs", and whether or not the program is
> > going to be good enough to beat players like Taylor Kingston
> > and me.
>
> The computer was hanging pieces because of a bug. I feel you didn't
> refreshed your Browser for new game and played with Buggy Program.
>
> Now start in a new Page and tell me if it still hangs pieces.
>
> This time it will be tough for all players to beat even its Normal
> Level.
>
> I am happy to see Easy level was able to Check Mate you for the first
> time. Soon we are going to see such wins against all good players.
>
> MISSION (TK) is still ahead.
>
> Bye
> Sanny
>
> Play Chess at: http://www.GetClub.com/Chess.html


I am fairly certain that I refreshed my browser, because
we have been reminded to do this counless times when
reporting bugs. Most often, I close the browser and start
a game in a freshly-opened one. But sometimes I just
click the refresh button and play again in the same browser.

Many of these bugs only occur late in the game, so I
dobt they are caused by the browser "remembering" the
position of pieces wrong.

I am having trouble forcing myself to think before moving,
because when the program moves very quickly, I have to
immediately switch back from my other browser (where I
am reading) and reply. It "feels" more like a blitz game,
and I am not in the habit of losing on time! :)

-- help bot



 
Date: 27 Aug 2006 00:34:30
From: Sanny
Subject: Re: You were CHECK MATED.

> So, is it now programmed to *adjudicate* positions as
> soon as a mate is detected? I thought that since it
> could not recognise checkmate on itself, this was not
> even possible. Instead of chopping off the final "move"
> where I normally capture its King, it has now lopped off
> about 3 moves!


This is the First time you lost. When Computer wins it always sees
Mate in 1/2/3. As the Computer has found a Mate and it gives itself a
win.

Bye
Sanny.

Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 27 Aug 2006 00:23:32
From: help bot
Subject: Re: You were CHECK MATED.

Sanny wrote:
> > This is true. And the program only had to cheat one
> > time! Sanny, this is another game where your program
> > reverted back to claiming a win by moving twice in a
> > row, without allowing for a reply in between. Near as
> > I can tell, the program spat out: Q-d2 check, and in
> > place of allowing any reply, it continued with QxK
> > "mate".
> >
>
> It was a case of Mate in 2.
>
> RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess
>
> Here is the Recorded game after Q-d2 Check your king can go only to
> K-h3.
>
> And then the Black can Move Q-g2 and Check Mate you.
>
> Black had 2 Bishops stopping all your King Move.
>
> Incase you bring Rook in between R-e2, the Qxe2 check and again Mate.


You are right, it is a forced mate after Q-d2+ (which the
program never played) ...R-e2 (which I never even got a
chance to play), Qxe2+ Kh3 (forced), Qg2++.

So, is it now programmed to *adjudicate* positions as
soon as a mate is detected? I thought that since it
could not recognise checkmate on itself, this was not
even possible. Instead of chopping off the final "move"
where I normally capture its King, it has now lopped off
about 3 moves!

This reminds me of a postal game I once had. My
opponent send me a card which stated I had been
checkmated, though in fact I had not even begun the
process! That one was a smothered mate, and I felt
somehow cheated by not getting to experience the
pain, move by move. :)

-- help bot



 
Date: 27 Aug 2006 00:05:24
From: Sanny
Subject: Re: Bugs have been Removed.
> complicated than merely taking my 1969 rating and performing
> a simple calculation. Objectively, Sanny's program used to be
> so slow that this was all people talked about. Now the issue
> has morphed to "bugs", and whether or not the program is
> going to be good enough to beat players like Taylor Kingston
> and me.

The computer was hanging pieces because of a bug. I feel you didn't
refreshed your Browser for new game and played with Buggy Program.

Now start in a new Page and tell me if it still hangs pieces.

This time it will be tough for all players to beat even its Normal
Level.

I am happy to see Easy level was able to Check Mate you for the first
time. Soon we are going to see such wins against all good players.

MISSION (TK) is still ahead.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 26 Aug 2006 23:56:26
From: Sanny
Subject: You were CHECK MATED.
> This is true. And the program only had to cheat one
> time! Sanny, this is another game where your program
> reverted back to claiming a win by moving twice in a
> row, without allowing for a reply in between. Near as
> I can tell, the program spat out: Q-d2 check, and in
> place of allowing any reply, it continued with QxK
> "mate".
>

It was a case of Mate in 2.

RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess

Here is the Recorded game after Q-d2 Check your king can go only to
K-h3.

And then the Black can Move Q-g2 and Check Mate you.

Black had 2 Bishops stopping all your King Move.

Incase you bring Rook in between R-e2, the Qxe2 check and again Mate.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



  
Date: 27 Aug 2006 10:01:36
From: Dave (from the UK)
Subject: Re: You were CHECK MATED.
Sanny wrote:
>> This is true. And the program only had to cheat one
>>time! Sanny, this is another game where your program
>>reverted back to claiming a win by moving twice in a
>>row, without allowing for a reply in between. Near as
>>I can tell, the program spat out: Q-d2 check, and in
>>place of allowing any reply, it continued with QxK
>>"mate".
>>
>
>
> It was a case of Mate in 2.
>
> RECORDED GAME: http://www.getclub.com/playgame.php?id=DM3199&game=Chess

An interesting "HTML" web page. It starts

<html >

but there is no

</html >

Do you think some of the problems you have with peoples browsers needing
refreshing might be that the web page you are serving is not valid? (The
lack of an </html > is just one of *many* problems).

I know you have dismissed the idea of running your home page through a
validator before (there were about 30 errors or so) but don't you think
your "programmers" should look at perhaps making sure the games have
valid HTML? If not, how can you expect peoples browsers to behave properly.

I suggest rather than type more newsgroup posts, you take some time to
go to a bookshop, purchase a book on software engineering (on by
Peterson is pretty good), along with a book on HTML.

You need to get the basics right I feel. But who am I to say?

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


 
Date: 26 Aug 2006 23:52:41
From: help bot
Subject: Re: Bugs have been Removed.

[email protected] wrote:
> Sanny wrote:
> > I am happy to find Easy level has beaten Nomorechess in one game.
>
> Congratulations. If you won 1/40 games, your ELO is 1000 points less
> than his. You only need to ask nomorechess for his rating to have an
> accurate estimate of your own.


Hey, hey!

But no so fast. Many of these games were played against
the Advance level, which is a whole different ball game from
blitzing against the Easy level.

Against Advance level, Sanny has drawn me once and lost
all the rest, while against Easy level his results are considerably
better, obviously due to my careless/faster play.

There have also been games against the other levels, which
I have all won. On top of this, Sanny's program is constantly
"improving", or changing. This makes things quite a bit more
complicated than merely taking my 1969 rating and performing
a simple calculation. Objectively, Sanny's program used to be
so slow that this was all people talked about. Now the issue
has morphed to "bugs", and whether or not the program is
going to be good enough to beat players like Taylor Kingston
and me.

-- help bot



 
Date: 26 Aug 2006 23:36:24
From:
Subject: Re: Bugs have been Removed.
Sanny wrote:
> I am happy to find Easy level has beaten Nomorechess in one game.

Congratulations. If you won 1/40 games, your ELO is 1000 points less
than his. You only need to ask nomorechess for his rating to have an
accurate estimate of your own.

http://tournaments.tantrix.co.uk/ratings/difftaba.shtml



 
Date: 26 Aug 2006 23:33:09
From: help bot
Subject: Re: Bugs have been Removed.

Sanny wrote:
> I am happy to find Easy level has beaten Nomorechess in one game.
>
> Thats a good improvement. Nomorechess played 40 games without loss but
> then Easy level succeded in beating him in a game.


This is true. And the program only had to cheat one
time! Sanny, this is another game where your program
reverted back to claiming a win by moving twice in a
row, without allowing for a reply in between. Near as
I can tell, the program spat out: Q-d2 check, and in
place of allowing any reply, it continued with QxK
"mate".

---

This is a game where I attempted to speed up my
play in order to rack up more "wins" in less time, and
as a result, I only managed to make things more
difficult. After that game, I have reverted back to
taking some time to think, before moving. Don't
forget that, without cheating of any kind, the program
did achieve one draw against me on the Advance level,
though there is no provision for this score and it is thus
not indicated.

For the record, although I have put far less thought
into my own moves against Easy level, I think it is
fair to say that it hangs pieces quite frequently. The
only question is, how often one hangs them back.

-- help bot



 
Date: 26 Aug 2006 23:14:25
From: Sanny
Subject: Re: Bugs have been Removed.
I am happy to find Easy level has beaten Nomorechess in one game.

Thats a good improvement. Nomorechess played 40 games without loss but
then Easy level succeded in beating him in a game.

Bye
Sanny

Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 26 Aug 2006 13:02:25
From: help bot
Subject: Re: Bugs have been Removed.

Alkhimey wrote:

> > it is very
> > difficult to understand what is linking to which line of code
>
> If this is the case than you should replace your programmers.


I once took a class in which it was stated flatly that, including
debugging, the average professional programmer churned out a
"whopping" twenty lines of code per working day. I was stunned,
as I believed our problems with bugs were mainly related to us
students not having any experience, and to the fact that many
apparently could not think in a logical manner, but were taking
the class anyway in hopes of making the big bucks.

IMO, Sanny's program has gotten quite a bit faster lately,
and in fact I recently saw the number "10" appear in the
window which apparently indicates the depth of search,
admittedly in an endgame position.

-- help bot



 
Date: 26 Aug 2006 05:44:58
From: Alkhimey
Subject: Re: Bugs have been Removed.
> it is very
> difficult to understand what is linking to which line of code

If this is the case than you should replace your programmers.


Sanny =D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):

> > printf("Our team of programmers have found the bug so now the
> > program\n");
> > printf("at http://www.getclub.com/Chess.html plays\n");
> > printf("faster and stronger.\n\n");
> > printf("These are the current ratings.\n");
> > printf("Only masters should attempt the master level if they want\n"=
);
> > printf("to have any chance of winning.\n\n");
>
> Correct this is the way my Program has progressed.
>
> Each time the game is modified 1-2 bugs come out. And when the Bugs are
> removed the Program plays much better.
>
> Every month my Program becomes twice better. Soon each one of you will
> be beaten by my Program.
>
> Bugs are something you can never avoid when large number of lines of
> code are written changing it leads to new errors as it is very
> difficult to understand what is linking to which line of code.
>
> But I am happy my programmers remove all the Bugs they find after
> Improvements.
>
> Once I am satisfied with the Game Performance. Other things will be
> thought about.
>=20
> Bye
> Sanny.
>=20
> Play Chess at: http://www.GetClub.com/Chess.html



 
Date: 26 Aug 2006 03:59:32
From: Sanny
Subject: Bugs have been Removed.

> printf("Our team of programmers have found the bug so now the
> program\n");
> printf("at http://www.getclub.com/Chess.html plays\n");
> printf("faster and stronger.\n\n");
> printf("These are the current ratings.\n");
> printf("Only masters should attempt the master level if they want\n");
> printf("to have any chance of winning.\n\n");

Correct this is the way my Program has progressed.

Each time the game is modified 1-2 bugs come out. And when the Bugs are
removed the Program plays much better.

Every month my Program becomes twice better. Soon each one of you will
be beaten by my Program.

Bugs are something you can never avoid when large number of lines of
code are written changing it leads to new errors as it is very
difficult to understand what is linking to which line of code.

But I am happy my programmers remove all the Bugs they find after
Improvements.

Once I am satisfied with the Game Performance. Other things will be
thought about.

Bye
Sanny.

Play Chess at: http://www.GetClub.com/Chess.html



  
Date: 28 Aug 2006 10:31:41
From: Simon Krahnke
Subject: Re: You were CHECK MATED.
* help bot <[email protected] > (08:07) schrieb:

> To me, the simplest way to write a chess program is to
> treat the King as just another piece, but then weed out
> moving into check as not a legal move, just as moving
> off the 8 by 8 board is not legal.

It's not that simple. Not moving the king into check is not as easy as
to not to leave the board. And moving a pinned piece is yet another way
to put the king into check. And the king may already be in check and you
don't do anything about it.

The easiest way is to generate pseudo legal moves, that is moves that
may put the king into check, and after doing them test if the king is in
check.

Only if one has the data structures that know pinned pieces and which
squares are under attack it is easy to have a fast legal move generator.

mfg, simon .... l


 
Date: 25 Aug 2006 19:30:00
From: Dave (from the UK)
Subject: Re: Program for Sanny to generate next post.
Dave (from the UK) wrote:
> Sanny, here is a program which you can use to generate the next
> newsgroups post about your program.

Oops, I forgot to seed the random number generator! Not that it will
affect the accuracy, but just to be pedantic. Corrected source code is
below.




#include <stdio.h >
#include <stdlib.h >
#include <time.h >

#define LEVELS 4 /* The number of levels the program plays at */

static int intcompare(const void *p1, const void *p2);

int main(int argc, char **argv)
{
char mode[][20]={"beginner","easy","normal","master"};
int ratings[LEVELS];
int i;

/* Seed the RNG from the time of day */
srand ( time(NULL) );

/* Generate some spam */
printf("Play Chess at: http://www.getclub.com/Chess.html\n\n");
printf("Our team of programmers have found the bug so now the
program\n");
printf("at http://www.getclub.com/Chess.html plays\n");
printf("faster and stronger.\n\n");
printf("These are the current ratings.\n");
printf("Only masters should attempt the master level if they want\n");
printf("to have any chance of winning.\n\n");

/* Generate the ratings */
for (i=0; i<LEVELS; ++i)
ratings[i]=rand();

/* Sort them */
qsort((void *) ratings,LEVELS, sizeof(int), intcompare);

for (i=0; i<LEVELS; ++i)
printf("%s has a FIDE rating of %d\n",mode[i],ratings[i]);

/* Save typing */
printf("\nBye\nSanny\n\n");
/* Generate more spam */
printf("Play Chess at: http://www.getclub.com/Chess.html\n");
exit(0);
}

static int intcompare(const void *p1, const void *p2)
{
int i = *((int *)p1);
int j = *((int *)p2);

if (i > j)
return (1);
if (i < j)
return (-1);
return (0);
}

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)


  
Date: 28 Aug 2006 11:03:43
From: David Richerby
Subject: Re: Program for Sanny to generate next post.
Dave (from the UK) <[email protected] > wrote:
> static int intcompare(const void *p1, const void *p2)
> {
> int i = *((int *)p1);
> int j = *((int *)p2);
>
> if (i > j)
> return (1);
> if (i < j)
> return (-1);
> return (0);
> }

return ((i > j) - (i < j))*(i != j);

is probably faster on a modern machine as it saves branches. (Like it
matters when you're sorting an array of four ints...)

Also, return is a keyword, not a function, so you don't need
parentheses around the return value.


Dave.

--
David Richerby Surprise Chicken (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ farm animal but not like you'd expect!


   
Date: 28 Aug 2006 12:46:15
From: Dave (from the UK)
Subject: Re: Program for Sanny to generate next post.
David Richerby wrote:
> Dave (from the UK) <[email protected]> wrote:
>
>>static int intcompare(const void *p1, const void *p2)
>>{
>> int i = *((int *)p1);
>> int j = *((int *)p2);
>>
>> if (i > j)
>> return (1);
>> if (i < j)
>> return (-1);
>> return (0);
>>}
>
>
> return ((i > j) - (i < j))*(i != j);

> is probably faster on a modern machine as it saves branches. (Like it
> matters when you're sorting an array of four ints...)

Using your algorithm and sorting 800,000 numbers:

time a.out
3.14u 0.02s 0:03.17 99.6%

Using the original one, which incedently cut and pasted from the Sun
manpage for qsort.

time a.out
2.35u 0.02s 0:02.38 99.5%

So on my CPUs, your algorithm is slower. I have an Opteron box here
running Solaris, but I can't be bothered to test it on that, but of
course that is a much newer CPU than these UltraSPARC IIs. (I looked at
your web pages, so I know you do know what Suns are!!)

> Also, return is a keyword, not a function, so you don't need
> parentheses around the return value.

Again, I lifted that bit directly from the manpage:

% man -s 3c qsort

EXAMPLES
Example 1: Program sorts.

The following program sorts a simple array:

#include <stdlib.h >
#include <stdio.h >

static int
intcompare(const void *p1, const void *p2)
{
int i = *((int *)p1);
int j = *((int *)p2);

if (i > j)
return (1);
if (i < j)

SunOS 5.10 Last change: 6 Dec 2004 1

Standard C Library Functions qsort(3C)

return (-1);
return (0);
}

--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: [email protected]
Hitting reply will work for a few months only - later set it manually.

http://witm.sourceforge.net/ (Web based Mathematica front end)