What is maximum rating per programmed line...

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

What is maximum rating per programmed line...

Post by JBNielsen »

I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
mar
Posts: 2552
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

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

Post by mar »

JBNielsen wrote:I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
Ask HGM. I guess he has about 1 elo per character in uMax.
Daniel White
Posts: 33
Joined: Wed Mar 07, 2012 4:15 pm
Location: England

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

Post by Daniel White »

JBNielsen wrote:I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
Line counts are essentially meaningless in C - very few parts of the language require newlines (as far as I'm aware only preprocessor directives need to be on their own line). I would imagine any top C engine could easily be made into a handful of lines.

Elo per character is perhaps a more interesting metric, in which case microMax by H.G.M. probably comes out on top.
User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 1:31 pm

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

Post by pocopito »

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

mar wrote:
JBNielsen wrote:I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
Ask HGM. I guess he has about 1 elo per character in uMax.
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;}
Uri Blass
Posts: 10102
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

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

Post by Uri Blass »

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 does not use null move pruning or hash tables
and it is easy to make something better in less lines of code.

The relative bad part of tscp is not the evaluation function
and if you want to improve it you can be more succesful in improving the search then improving the evaluation.

Micromax is clearly stronger than tscp based on 40/4 CCRL list.

266 Micro-Max 4.8 1835 +11 −11
304 Tscp 1.81 1559 +16 −16

result in a direct CCRL match between them is
20-4 for MicroMax with 6 draws.
mar
Posts: 2552
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

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

Post by mar »

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;}
:lol:
Daniel White
Posts: 33
Joined: Wed Mar 07, 2012 4:15 pm
Location: England

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

Post by Daniel White »

diep wrote:
mar wrote:
JBNielsen wrote:I just wondered... How strong a chessengine can you make with fx 3.000 lines of C?
Ask HGM. I guess he has about 1 elo per character in uMax.
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;}
Slightly better:

Code: Select all

main(){char b[9];puts("draw?");gets(b);if(*b-'y')puts("resign");}
However I prefer H.G.M's definition of a chess engine: http://home.hccnet.nl/h.g.muller/definition.txt.
User avatar
hgm
Posts: 27701
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: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?
User avatar
hgm
Posts: 27701
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 »

pocopito wrote: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 ...
Micro-Max is not really obfuscated, in contrast to Toledo. The fact that it is not very readable is mainly due to all the variables having single character names, tosave characters. But giving them helpful names is not something that drives up the number of lines. Just the number of characters.

The number of lines in micro-Max is only slightly over 100. And the lines are not particularly long; most contain just one or two simple statements, (like assignments). I actually have a version with intelligible variable names on my website ( http://home.hccnet.nl/h.g.muller/maximax.txt ) of one of the earlier micro-Max versions.