What is maximum rating per programmed line...

Discussion of chess software programming and technical issues.

Moderator: Ras

diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: What is maximum rating per programmed line...

Post by diep »

hgm wrote:
diep wrote:Oh one elopoint a character, that's easy to beat:

Code: Select all

int main(){char b[9];printf("draw?");gets(b);if(b[0]!='y')printf("resign\n");return 0;}
Well, you are the umptieth person to suggest something like that. But why do you think that would have any Elo at all? There already exist engines that have negative Elo without resigning every game (and occasionally winning one). And what you propose would be crushed by it. It would even lose 100-0 from Brutus Random...

Besides, I don't think that 'resigning' counts as playing Chess. On the contrary, it expresses refusal to play it any longer. So why would a program that resigns be considered a Chess program at all?
Oh well i remember the young Diepeveen, age 15 or so, playing his international tournament in Berlin and in the last round an italian was my opponent. He doesn't show up initially (it's allowed to be 1 hour late),
then finally when he shows up he looks extremely busy. Murmurs
some excuse about his flight back to italy and problems with it.

Offers a draw as he had to leave, and the young Diepeveen completely impressed by the big show he saw, the young Diepeveen took that of course.

So this program could be 2300 rated.

In case some of those 2300 guys do not accept the draw, the elo system basically no longer loses you elo when you're 750 elo worse.

So the program can be somewhere between 1550 and 2300 rated :)

Vincent

p.s. the most important thing of course is that this convincingly beats micromax in elo per character - and it saves you out a LOT of trouble writing micromax :)
ZirconiumX
Posts: 1361
Joined: Sun Jul 17, 2011 11:14 am
Full name: Hannah Ravensloft

Re: What is maximum rating per programmed line...

Post by ZirconiumX »

Diep mark 2:

Code: Select all

 int main(){char b[9];printf("draw?");gets(b);if(*b!='y')printf("you lose\n");return 0;}
This version cannot lose a single game.

Problem, Houdini?

Matthew:out
tu ne cede malis, sed contra audentior ito
JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: What is maximum rating per programmed line...

Post by JBNielsen »

pocopito wrote:Well, I guess this is an "it depends" case.
Are you thinking of something like micro-max or toledo, that are written in a few more than 1000 _characters_? On the other hand if you're thinking about something written in a more readable way, I guess that TSCP itself has around 2600 lines of C code (I guess it implements alpha-beta + null move + qscent + move ordering, and many of the lines are coments), its strength isn't that bad and I guess there's a lot of possibilities to improve for example in the evaluation function.

Regards

E Diaz
I was thinking of a normal written program. normal variable names, normal length of lines (ca 80 char) - comment lines do not count.
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: What is maximum rating per programmed line...

Post by lucasart »

JBNielsen wrote:I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
Lines of code don't make any sense, especially in C. Here's an example that should make it obvious:
1/ compact form

Code: Select all

int sign = x > 0 ? 1 : (x < 0 ? -1 : 0);
2/ long form

Code: Select all

int sign;
if (x > 0)
{
	sign = 1;
}
else if (x < 0)
{
	sign = -1;
}
else
{
	sign = 0;
}
The code generated by the compiler will (or should) be exactly the same. 1/ uses one line while 2/ uses 13 lines. And I'm not even cheating by concatenating several statemts on the same line, or counting comments or empty lines.

Sometimes using a long form style makes the code more readable (not in this case obviously as 1/ is clerly more readable), and readability should always be preffered to lines of code, especially as the compiled result is the same anyway.

PS: Have a look here
http://cloc.sourceforge.net/
maybe that tool allows some less distorted LOC counting, although it cannot prevent the flaw I pointed out above (except for the {} perhaps).
Last edited by lucasart on Sun Aug 05, 2012 5:58 pm, edited 1 time in total.
User avatar
hgm
Posts: 28452
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: What is maximum rating per programmed line...

Post by hgm »

JBNielsen wrote:I was thinking of a normal written program. normal variable names, normal length of lines (ca 80 char) - comment lines do not count.
That would be about 150 lines then. Maximax fulfills your conditions, and has 284 lines. But many of those are comments, and many of them are much shorter than 80 characters (not counting the trailing comments), so normally you would combine them if it were not to create space for the comments.

Code: Select all

/***************************************************************************/
/*                               micro-Max,                                */
/* A chess program smaller than 2KB (of non-blank source), by H.G. Muller  */
/***************************************************************************/
/* version 3.2 (2000 characters) features:                                 */
/* - recursive negamax search                                              */
/* - quiescence search with recaptures                                     */
/* - recapture extensions                                                  */
/* - (internal) iterative deepening                                        */
/* - best-move-first 'sorting'                                             */
/* - a hash table storing score and best move                              */
/* - full FIDE rules (expt under-promotion) and move-legality checking     */

/* This version is for reference only, with all variable names changed to  */
/* be more indicative of their meaning, and better layout & more comments. */
/* There is no guarantee, though, that it still compiles or runs.          */

#include <stdio.h>
#include <math.h>

#define F(I,S,N) for(I=S;I<N;I++)
#define W(A) while(A)
#define K(A,B) *(int*)(Zobrist+A+(B&8)+S*(B&7))
#define J(A) K(ToSqr+A,Board[ToSqr])-K(FromSqr+A,Piece)-K(CaptSqr+A,Victim)

#define HASHSIZE 16777224
struct _ 
{ int  Key, Score;
  char From, To, Draft;
} HashTab[HASHSIZE];                                   /* hash table, 16M+8 entries*/

int V=112, M=136, S=128, INF=8e3, C=799,               /* V=0x70=rank mask, M=0x88 */
    Rootep, Nodes, i; 

char RootEval, InputFrom, InputTo,
PieceVal[] = {0,1,1,3,-1,3,5,9},                       /* relative piece values    */
StepVecs[] =                                           /* step-vector lists        */
         {-16,-15,-17,0,                               /* white Pawn               */
           1,16,0,                                     /* Rook                     */
           1,16,15,17,0,                               /* Q,K, also used for B, bP */
          14,18,31,33,0,                               /* Knight                   */
          7,-1,11,6,8,3,6,                             /* first direction per piece*/
          6,3,5,7,4,5,3,6},                            /* initial piece setup      */
Board[129],                                            /* board: half of 16x8+dummy*/
Zobrist[1035],                                         /* hash translation table   */
  
Sym[] = ".?+nkbrq?*?NKBRQ";                            /* piece symbols on printout*/

int Search(int Side, int Alpha, int Beta, int Eval, int HashKeyLo, int HashKeyHi,
                                                    int epSqr, int LastTo, int Depth)
{                       
  int j, StepVec, BestScore, Score, IterDepth, h, i=8, SkipSqr, RookSqr;
  char Victim, PieceType, Piece, FromSqr, ToSqr, BestFrom, BestTo, CaptSqr, StartSqr;
  struct _*Hash = HashTab;

  /* Hash probe. On miss (Internal) Iterative Deepening starts at IterDepth=0,     */
  /* without move hint. On a hit we start IID from the hashed values, except       */
  /* when the depth is already sufficient. In this case, if the bound type OK,     */
  /* we use the hashed score immediately, and otherwise we just do the last        */
  /* iteration starting with the hash move.                                        */
                                                       /* lookup pos. in hash table*/
  j = (Side*epSqr^HashKeyLo) & HASHSIZE-9;             /* try 8 consec. locations  */
  while((h=HashTab[++j].Key) && h-HashKeyHi && --i);   /* first empty or match     */
  Hash += i ? j : 0;                                   /* dummy A[0] if miss & full*/
  if(Hash->Key)                                        /* hit: pos. is in hash tab */
  { IterDepth = Hash->Draft; 
    Score     = Hash->Score;
    BestFrom  = Hash->From;                            /* examine stored data      */
    if(IterDepth >= Depth)                             /* if depth sufficient:     */
    { if(Score >=  Beta|BestFrom&S &&
         Score <= Alpha|BestFrom&8
        ) return Score;                                /* use if window compatible */
      IterDepth = Depth-1;                             /* or use as iter. start    */
    } 
    BestFrom &= ~0x88; 
    BestTo    = Hash->To;                              /*      with best-move hint */
    BestTo    = IterDepth ? BestTo : 0;                /* don't try best at d=0    */
  } else IterDepth = BestFrom = BestTo = 0;            /* start iter., no best yet */
  
  Nodes++;                                             /* node count (for timing)  */
  
  /* We have to search the current node; deepen the search in steps of one         */
  /* starting from the hashed data as if it were the previous iteration.           */
  /* In the root (LastTo==8) we deepen until node count or max. depth reached.     */

  while(IterDepth++ < Depth |                          /* iterative deepening loop */
       LastTo==8 & Nodes<1e7 & IterDepth<98)           /* at root until node limit */
  { /* Each iteration consist of a move-generation run, immediately searching      */
    /* all moves as they are generated. The best move from the previous iter-      */
    /* ation (still contained in BestFrom, BestTo) is slipped in front, though.    */
    /* To make this easier, move generation starts at StartSqr = BestFrom.         */
    /* The S-bit of BestTo indicates if there is a valid best move to try.         */
    FromSqr = StartSqr = BestFrom;                    /* start scan at prev. best  */
    ToSqr  |= 8 & ToSqr>>4;                            /* request try noncastl. 1st*/
    BestScore = IterDepth>1 ? -INF : Eval;             /* unconsidered:static eval */
    do      
    { Piece = Board[FromSqr];                          /* scan board looking for   */
      if(Piece & Side)                                 /*  own piece (inefficient!)*/
      { StepVec = PieceType = Piece&7;                 /* set StepVec > 0          */
        j = StepVecs[PieceType+16];                    /* first step vector Piece  */
        while(StepVec = PieceType>2&StepVec<0 ? -StepVec : -StepVecs[++j])                    
                                                       /* loop over directions o[] */
        {replay:                                       /* resume normal after best */
          /* For each direction we scan ToSqr along the ray startig at FromSqr.    */
          ToSqr   = FromSqr;
          SkipSqr = RookSqr = S;                       /* S = 0x80 = dummy square  */
          do
          { CaptSqr = ToSqr += StepVec;                /* ToSqr traverses ray      */

            /* FromSqr, ToSqr here scan through all tentative moves. If there      */
            /* is an old best move to try first, this is indicated in the 8-bit    */
            /* of BestTo (which was copied from the S-bit), and we overrule the    */
            /* generated ToSqr (which might ly at other distance or in direction)  */
            /* We then test if ToSqr is on the board, if we have an e.p. capture,  */
            /* are blocked by an own piece, and if Pawn moves are valid.           */
            if(BestTo & 8) 
              CaptSqr = ToSqr = BestTo&~0x88;          /* sneak-in prev. best move */
            if(ToSqr & 0x88) break;                    /* board edge hit (M=0x88)  */
            if(PieceType<3 & ToSqr==epSqr)
              CaptSqr = ToSqr^16;                      /* shift CaptSqr if e.p.    */
            Victim = Board[CaptSqr];
            if(Victim & Side |                         /* capture own              */
               PieceType<3 & !(StepVec&7) != !Victim   /*            bad pawn mode */
              ) break;      

            /* If we get here, we have a pseudo-legal move in (FromSqr, ToSqr).    */
            /* We check it for King capture (or Rook capture after castling).      */
            /* This can give a beta cutoff, as can the stand-pat score in QS.      */
            i = 99*PieceVal[Victim&7];                 /* value of victim piece    */
            if(i<0 ||                                  /* K capt. or               */
                      epSqr-S && Board[epSqr] &&       /* non-empty epSqr:castling */
                      ToSqr-epSqr<2 & epSqr-ToSqr<2    /*             bad castling */
              ) BestScore = INF;     
            if(BestScore >= Beta) goto cutoff;         /* abort on fail high       */
             
            /* We now have a move to search. If there is depth left, we different- */
            /* ially update the evaluation, Make the move, Search it recursively   */
            /* UnMake it, and update the best score & move. If not, we ignore it.  */
            if(h = IterDepth - (ToSqr!=LastTo))        /* remaining depth(-recapt.)*/
            { Score = PieceType<6 ? Board[FromSqr+8]-Board[ToSqr+8] : 0;
                                                       /* center positional pts.   */

              /* Make move & evaluate                                              */
              Board[RookSqr] = Board[CaptSqr] = Board[FromSqr] = 0;
              Board[ToSqr]   = Piece&31;               /* do move, strip virgin-bit*/
              if(!(RookSqr&0x88))
              { Board[SkipSqr] = Side+6;               /* castling: put Rook       */
                Score += 30;                           /*                 & score  */
              }                                     

              if(PieceType<3)                          /* pawns:                   */
              { Score -=                               /* structure, undefended    */
                9*(((FromSqr-2)&M||Board[FromSqr-2]!=Piece) + /* squares plus bias */
                   ((FromSqr+2)&M||Board[FromSqr+2]!=Piece) - 1); 
                if(ToSqr+StepVec+1&S)
                { Board[ToSqr] |= 7;                   /* promote Pawn to Queen,   */
                  i += C;                              /*                add score */
              } }
              
              Score = -Search(                         /* recursive eval. of reply */
                              24-Side,                 /* opponent color           */
                             -Beta-(Beta>Eval),        /* new Alpha (delayed gain!)*/
                              BestScore>Alpha ? -BestScore : -Alpha,  /* New Beta  */
                             -Eval-Score-i,            /* New Eval                 */
                              HashKeyLo+J(0),          /* New HashKeys             */
                              HashKeyHi+J(8)+SkipSqr-S,/* SkipSqr-S!=0 on castling */
                              SkipSqr, ToSqr, h);      /* New epSqr, LastTo, Depth */

              Score -= Score>Eval;                     /* delayed-gain penalty     */

              /* If the Search routine was called as move-legality checker, we     */
              /* now return before unmaking the move if it was the input move.     */
              if(LastTo==9)                            /* called as move-legality  */
                                                       /*   checker                */
              { if(Score!=-INF & FromSqr==InputFrom & ToSqr==InputTo)/* move found */
                { RootEval = -Eval-i;                  /* update eval, material    */
                  Rootep   = SkipSqr;
                  return Beta;                         /*   & not in check, signal */
                } 
                Score = BestScore;                     /* (prevent fail-lows on    */
              }                                        /*   K-capt. replies)       */

              /* UnMake move                                                       */
              Board[RookSqr] = Side+38;                /* undo move,RookSqr can be */
              Board[SkipSqr] = Board[ToSqr] = 0;       /*                    dummy */
              Board[FromSqr] = Piece;
              Board[CaptSqr] = Victim;

              /* Process score. If the move just searched was a previous best      */
              /* move that was tried first, we take its Score and redo the first   */
              /* ray of this piece. Otherwise update best score and move.          */
              if(BestTo&8)                            /* Move just done was in-    */
              { BestScore = Score;                    /*     serted previous best  */
                BestTo   &= ~8;                       
                goto replay;
              }                                       /* redo original first move  */

              if(Score>BestScore)
              { BestScore = Score;                    /* update max,               */
                BestFrom  = FromSqr;                  /* best move,                */
                BestTo    = ToSqr | S&RookSqr;        /* mark non-castling with S  */
            } }

            /* Determine if we have to continue scanning this ray. We must stop    */
            /* on a capture, or if the piece is a non-slider, with the exceptions  */
            /* of double moves for Pawns and King (castlings!). Such double moves  */
            /* cause setting of the SkipSqr, that otherwise is equal to the dummy S*/
            Victim += PieceType<5;                    /* fake capt. for nonsliding */
            if(PieceType<3&6*Side+(ToSqr&0x70)==S     /* pawn on 3rd/6th, or       */
                ||(Piece&~24)==36 &                   /* virgin K,                 */
                   j==7 &&                            /* moving sideways,          */
                   RookSqr&0x88 &&                    /* RookSqr not yet set       */
                   Board[RookSqr=(FromSqr|7)-(StepVec>>1&7)]&32 &&
                                                      /* virgin Rook in corner     */
                   !(Board[RookSqr^1]|Board[RookSqr^2]) /* 2 empty sqrs. next to R */
              ) { SkipSqr = ToSqr; Victim--; }        /* unfake capt., enable e.p. */

            /* continue ray scan if move was non-capture                           */
          } while(!Victim);                           /* if not capt. continue ray */ 

    } } } while((FromSqr=FromSqr+9&~0x88)-StartSqr);  /* next sqr. of board, wrap  */

    /* All moves have been searched; wrap up iteration by testing for check- or    */
    /* stalemate, which leave Score at -INF. Call Search with Depth=1 after null   */
    /* move to determine if we are in check. Finally store result in hash.         */
cutoff:     
    if(BestScore>INF/4 | BestScore<-INF/4)
      IterDepth=99;                                   /* mate is indep. of depth   */
    BestScore = BestScore+INF ? BestScore :           /* best loses K: (stale)mate */
               -Search(24-Side, -INF, INF, 0, HashKeyLo, HashKeyHi, S, LastTo, 1)/2;

    if(!Hash->Key | (Hash->From&M)!=M | Hash->Draft<=IterDepth) 
                                                      /* if new/better type/depth: */
    { Hash->Key    = HashKeyHi;                       /* store in hash,            */
      Hash->Score  = BestScore;
      Hash->Draft  = IterDepth;
      HashTab->Key = 0;                               /* dummy stays empty         */
      Hash->From   = BestFrom |                       /* From & bound type         */
                     8*(BestScore>Alpha) |            /*    encoded in X S,8 bits  */
                     S*(BestScore<Beta);              /* (8=lower, S=upper bound)  */
      Hash->To     = BestTo;                         
    }                                                 

    /* End of iteration. Start new one if more depth was requested                 */
    /*  if(LastTo==8)printf("%2d ply, %9d searched, %6d by (%2x,%2x)\n",
                                IterDepth-1,Nodes,BestScore,BestFrom,BestTo&0x77); */
  }

  /* return best score (and in root also best move) after all iterations are done. */
  if(LastTo&8)
  { InputFrom = BestFrom;
    InputTo   = BestTo & ~0x88;
  }
  return BestScore;
}

int main(void)
{
 int j, Side=8, *ptr, InBuf[9];                            /* 8=white, 16=black  */

 /* Initialize board and piece-square table (actually just a square table).      */
 for(i=0;i<8;i++)                                          /* initial board setup*/
 {Board[i] = (Board[i+0x70] = StepVecs[i+24]+40)+8;        /* Pieces             */
  Board[i+0x10] = 18; Board[i+0x60] = 9;                   /* black, white Pawns */
  for(j=0;j<8;j++) Board[16*j+i+8]=(i-4)*(i-4)+(j-3.5)*(j-3.5); 
                                                           /*common pce-sqr table*/
 }                                                         /*(in unused half b[])*/
 for(i=0x88; i<1035; i++) Zobrist[i]=rand()>>9;

 while(1)                                                  /* play loop          */
 {for(i=0;i<121;i++)
   printf(" %c", i&8&&(i+=7) ? '\n' : Sym[Board[i]&15]);   /* print board        */
  ptr = InBuf; while((*ptr++ = getchar()) > '\n');         /* read input line    */
  Nodes=0;
  if(*InBuf-'\n')
  {InputFrom=InBuf[0]-16*InBuf[1]+C;                       /* parse entered move */
   InputTo  =InBuf[2]-16*InBuf[3]+C;
  } else Search(Side,-INF,INF,RootEval,1,1,Rootep,8,0);    /* or think up one    */
  for(i=0;i<HASHSIZE;i++)HashTab[i].Key=0;                 /* clear hash table   */
  if(Search(Side,-INF,INF,RootEval,1,1,Rootep,9,2)==INF)
    Side^=24;                                              /* check legality & do*/
 }
 return 0;
}
User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 1:31 pm

Re: What is maximum rating per programmed line...

Post by pocopito »

lucasart wrote:
PS: Have a look here
http://cloc.sourceforge.net/
maybe that tool allows some less distorted LOC counting, although it cannot prevent the flaw I pointed out above (except for the {} perhaps).
Interesting tool!

Just for curiosity, this is the result using wc and cloc in the folder where TSCP's code is placed:

Code: Select all

$ wc -l *.c
  540 board.c
  123 book.c
  197 data.c
  400 eval.c
  300 fen.c
  710 main.c
  338 search.c
 2608 total
$ cloc *.c
defined(%hash) is deprecated at /usr/bin/cloc line 1277.
	(Maybe you should just omit the defined()?)
       7 text files.
       7 unique files.                              
       0 files ignored.

http://cloc.sourceforge.net v 1.53  T=0.5 s (14.0 files/s, 5216.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                                7            355            296           1957
-------------------------------------------------------------------------------
SUM:                             7            355            296           1957
-------------------------------------------------------------------------------
Two first meanings of the dutch word "leren":
1. leren [vc] (learn, larn, acquire) acquire or gain knowledge or skills.
2. leren [v] (teach, learn, instruct) impart skills or knowledge to.
User avatar
hgm
Posts: 28452
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: What is maximum rating per programmed line...

Post by hgm »

diep wrote:So the program can be somewhere between 1550 and 2300 rated :)

Vincent

p.s. the most important thing of course is that this convincingly beats micromax in elo per character - and it saves you out a LOT of trouble writing micromax :)
Unfortunately the rating is not determined by an occasional draw against a 2300-rated fool, but by the millions of losses (and no wins) against all those opponents with sub-zero ratings. The only thing you prove is that you cannot determine the rating of a minus-1000-rated player by playing it against 2300-rated players.

So no, resigning does not beat anything, convincingly or otherwise...
Piotr Cichy
Posts: 75
Joined: Sun Jul 30, 2006 11:13 pm
Location: Kalisz, Poland

Re: What is maximum rating per programmed line...

Post by Piotr Cichy »

pocopito wrote:Well, I guess this is an "it depends" case.
Are you thinking of something like micro-max or toledo, that are written in a few more than 1000 _characters_? On the other hand if you're thinking about something written in a more readable way, I guess that TSCP itself has around 2600 lines of C code (I guess it implements alpha-beta + null move + qscent + move ordering, and many of the lines are coments), its strength isn't that bad and I guess there's a lot of possibilities to improve for example in the evaluation function.

Regards

E Diaz
TSCP is obviously not a program with short source code. For example, nanoSzachy 4.0 has about 1200 lines of code (38020 bytes) and pikoSzachy 4.0 about 800 lines (24247 bytes). And this is "clean" code, not "obfuscated" like in case of microMax (there are comments, long variable names etc). Both programs are optimized for size, but size of executable file and not size of source code. The size of exe files is: 30.5 KB (nano) and 9.5 KB (piko). And they are much stronger than TSCP or microMax:

CEGT 40/4:

Code: Select all

NanoSzachy 4.0 x64   2381
PikoSzachy 4.0       2289
TSCP 1.81            1734
CCRL 40/40:

Code: Select all

NanoSzachy 4.0 64-bit 	2563
Micro-Max 4.8 (DM-PII)	1699
Jan Brouwer
Posts: 201
Joined: Thu Mar 22, 2007 7:12 pm
Location: Netherlands

Re: What is maximum rating per programmed line...

Post by Jan Brouwer »

Piotr Cichy wrote:
TSCP is obviously not a program with short source code. For example, nanoSzachy 4.0 has about 1200 lines of code (38020 bytes) and pikoSzachy 4.0 about 800 lines (24247 bytes). And this is "clean" code, not "obfuscated" like in case of microMax (there are comments, long variable names etc). Both programs are optimized for size, but size of executable file and not size of source code. The size of exe files is: 30.5 KB (nano) and 9.5 KB (piko). And they are much stronger than TSCP or microMax:

CEGT 40/4:

Code: Select all

NanoSzachy 4.0 x64   2381
PikoSzachy 4.0       2289
TSCP 1.81            1734
CCRL 40/40:

Code: Select all

NanoSzachy 4.0 64-bit 	2563
Micro-Max 4.8 (DM-PII)	1699
This is impressive!

My program happens to have exactly the same strength as NanoSzachy at the moment, but its source code is 10x as large!
If you ever decide to open source your program, it could well become a popular starting point for new chess programmers at this playing strength - source code size intersection.
Pablo Vazquez
Posts: 155
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: What is maximum rating per programmed line...

Post by Pablo Vazquez »

Piotr Cichy wrote:
pocopito wrote:Well, I guess this is an "it depends" case.
Are you thinking of something like micro-max or toledo, that are written in a few more than 1000 _characters_? On the other hand if you're thinking about something written in a more readable way, I guess that TSCP itself has around 2600 lines of C code (I guess it implements alpha-beta + null move + qscent + move ordering, and many of the lines are coments), its strength isn't that bad and I guess there's a lot of possibilities to improve for example in the evaluation function.

Regards

E Diaz
TSCP is obviously not a program with short source code. For example, nanoSzachy 4.0 has about 1200 lines of code (38020 bytes) and pikoSzachy 4.0 about 800 lines (24247 bytes). And this is "clean" code, not "obfuscated" like in case of microMax (there are comments, long variable names etc). Both programs are optimized for size, but size of executable file and not size of source code. The size of exe files is: 30.5 KB (nano) and 9.5 KB (piko). And they are much stronger than TSCP or microMax:

CEGT 40/4:

Code: Select all

NanoSzachy 4.0 x64   2381
PikoSzachy 4.0       2289
TSCP 1.81            1734
CCRL 40/40:

Code: Select all

NanoSzachy 4.0 64-bit 	2563
Micro-Max 4.8 (DM-PII)	1699
Indeed it is quite impressive. I think we both follow the same philosophy of trying to keep the code short at a reasonable strength, but my program is both bigger and weaker than yours. It's a pity that they aren't open source.