bug-xboard
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WG: WG: [Bug-xboard] New address@hidden mailing list


From: Daniel Mehrmann
Subject: WG: WG: [Bug-xboard] New address@hidden mailing list
Date: Mon, 3 Nov 2003 22:56:11 +0100

Example for bullshit code. Don't look about static vars and coding. It's
only testing dummy core code without GUI.
This should never be add to WB ;)
But idea is interesting for enines which don't support draw feature.

Daniel


void
ZippyDraw(request, score, depth)
int request; /* 0 no request 1 opponent offer draw 2 New Game */
int score;
int depth;
{
        static int drawCounter; /* 0.00 engine score */
        static int lastDrawMove; /* Last move we offer a draw */
        static int RatingDiff; /* Diff between our rating */
        int drawFactor = 0; /* Setup which score is draw. Default is 0
*/

        char str[MSG_SIZ];
        
        /* If request 1 we only become a offer from opponent. We
           don't save engine score and looking about some stuff to
           accept or decline the draw.
           If resquest 0 the engine make a new move and we looking 
           to the last program score before that move. If 0.00 the 
           counter will be ++. 
         
           If the score is not zero we reset the counter to zero.
        */

        if (request == 0) {
                if (score == drawFactor || (score < 0 && score > -10)) {
                        if (depth > 1) drawCounter++;
                                if (drawCounter >= 5 && (currentMove -
lastDrawMove) > 20 &&
                                        currentMove > 40 && depth > 1) {
                                        /* rating check */
                                        if (RatingDiff > 50) {
                                                        sprintf(str,
"whisper Winboard-DM: ZippyDraw: No draw offer - Rating of opponent to
low \n");
                                                        SendToICS(str);
                                                        drawCounter = 0;
                                                        return;
                                        }
                                        if (appData.debugMode)
fprintf(debugFP, 
                                                "Offer draw. counter:
%d\n", drawCounter);
                                                sprintf(str, "kibitz
Winboard-DM: ZippyDraw = counter %d; LastDraw: %d; \n",
        
drawCounter, lastDrawMove);
                                                SendToICS(str);
                                                sprintf(str, "draw \n");
                                                SendToICS(str);
                                                lastDrawMove =
currentMove;
                                }
                } else {
                        drawCounter = 0;
                }
        } else if (request == 1) {
                if (drawCounter >= 5 && currentMove > 40 &&  depth >= 1
&& score <= drawFactor && 
                        RatingDiff < 50) {
                        if (appData.debugMode) fprintf(debugFP, "accept
draw \n");
                                sprintf(str, "kibitz Winboard-DM:
ZippyDraw = counter %d; LastDraw: %d; score %d R-Diff %d \n",
                                          drawCounter, lastDrawMove,
score, RatingDiff);
                        SendToICS(str);
                        sprintf(str, "draw\n");
                        SendToICS(str);
                        return;

                }
                if (score < -50 && depth > 1) {
                                        if (appData.debugMode)
fprintf(debugFP, "draw \n");            
                                        sprintf(str, "kibitz
Winboard-DM: ZippyDraw = counter %d; LastDraw: %d; score %d R-Diff %d
\n",
                                                drawCounter,
lastDrawMove, score, RatingDiff);
                                        SendToICS(str);
                                        sprintf(str, "draw\n");
                                        SendToICS(str);
                                        return;
                } else { 
                        if (appData.debugMode) fprintf(debugFP, "decline
Draw \n");
                                sprintf(str, "kibitz Winboard-DM:
ZippyDraw = counter %d; LastDraw: %d; R-Diff %d\n",
                                          drawCounter, lastDrawMove,
RatingDiff);

                                SendToICS(str);
                                sprintf(str, "kibitz No thank you. I
wanna play \n");
                                SendToICS(str);
                }
        } else {
                /* request 2 = new game - reset data */
        
                drawCounter = 0;
                lastDrawMove = 0;
                /* read rating */
        
                if (gameMode == IcsPlayingBlack) {
                        RatingDiff = gameInfo.blackRating -
gameInfo.whiteRating;
                } else if (gameMode == IcsPlayingWhite) {
                        RatingDiff = gameInfo.whiteRating -
gameInfo.blackRating;
                }
                sprintf(str, "whisper Winboard-DM: ZippyDraw = enable
dynamic draw; R-Diff %d \n", RatingDiff);
                SendToICS(str);
        }       
}


-----Urspr√ľngliche Nachricht-----
Von: Mark Ioli [mailto:address@hidden 
Gesendet: Montag, 3. November 2003 18:16
An: Daniel Mehrmann; address@hidden
Betreff: Re: WG: [Bug-xboard] New address@hidden mailing list


Well, I'll most likely be working on the WinBoard pieces, most of my gui
programming experience is with Windows and the Win32 API. I've just
joined the project, so I'm not working on anything specific right now,
I've been looking through the Bug/ToDo list for now, becoming more
familiar with the code. Tim says you have a lot of patches to merge into
what will become 4.2.7, so I was planning on holding off on diving in
too deep until then. We'll have to all have a general discussion at some
point about where to start, where this is all going, there seems to be a
lot of possibilities beyond bugfixes. One of the old ToDos is splitting
the code into multiple files, some of the files are pretty huge. I've
been looking at some of the feature adds that might be somewhat simple
to implement as well, but again, we're in a semi-freeze on the code
right now, I don't want to introduce any new features right now. Anyway,
those are my thoughts for now, glad to be aboard :)

Mark

 
--- Daniel Mehrmann <address@hidden> wrote:
> Hi,
> 
> Thanks tim.
> 
> Hi Mark, can y tell me more about your part of development x/winboard 
> ? What are y doing ? Sorry, i'm easy curiously ;)
> 
> Greetings,
> Daniel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]