Soberango 0.00.0 (chess engine) realized.

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

frisian wrote:
Luis Babboni wrote:I must read again the rest about macros.
Edit: I could not find even the word macro in FB Help!!
For searching under index you must use the hole keyword #macro in other words as it's used in the program listing.
...
Thanks!
frisian wrote:

Code: Select all

'Halfmove:
      If espacios = 5 Then 
         hmV = hmV * 10 + val(Char)
      End If
Comments are removed for a better view of the code.
This piece of code does not need to know what the size is, it works on numbers from 0 to 1000000000. Sweet and simple.
The more code you have the greater chance you have on errors. Keep It Simple, Stupid.
Thanks again, I will fix it in future versions and I´ll take more care to it from now on in new code.
frisian wrote:
Luis Babboni wrote:Sorry if I´m asking a fool question:
You be sure if is not just cause Soberango scores are always from white side no matter the side Soberango is playing
If that's the case you have a problem, all chess programs rate good position and/or more pieces then there opponent with a positive number. And bad position and/or less pieces with a negative number regardless off the color they are playing with. The working of Xboard and Arena is based on that principle.
Actually I think it could make my code more complicated but I do not think it make some kind of compability problem with Xboard or any GUI.
In any case I made a question about it in TalkChess.com :
http://talkchess.com/forum/viewtopic.ph ... 717#685717
to be sure after your warning!

Thanks frisian for your time!
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

I have an answer and is like you said in some things not important for the moment but that could make try it problems in future!
I´ll make a change that seems to be easy that is just change the sign when corresponding in show thinking.

Thanks again!
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

In talkchess.com http://talkchess.com/forum/index.php was made a tournament with 460 chess engines.
Taking in account theire skill levels, the engines was divided in "A"; "B"; "C"; "D"; "E" and "Promotion" groups and version 0.09.8 of Soberango was preclasified in position 54º out of 60 engines in the "Promotion" group, that is, in the last group.

I think it had much more luck than could be spected, but the fact was that ended in position 20º and was promoted to play in group "E" in the next tournament! :-)

Code: Select all

Promotion Group 

Code:
     Final Standings 
                                      ELO  Score    (Tie)  1    2    3    4    5    6    7    8    9    10   11   12 
-------------------------------------------------------------------------------------------------------------------------------------- 
 1: Embla 0.97 64-bit                 1620 9.5 / 12  80.5  43b+ 29w- 19b+ 39w+  8w- 22b= 28w+ 10b+ 37w+  7b+  9w+  3w+  (+9 -2 =1) 
 2: Spartan 1.0                       1598 9.0 / 12  84.0  60b+ 37w+  8w=  4w+ 15b+  7w- 21b+  9b+  6w+  3b-  5w= 10b+  (+8 -2 =2) 
 3: Storm 0.6                         1633 8.5 / 12  88.0  41b= 28w+ 16w+  9b- 11b+ 15w= 24w+  4b= 21w+  2w+ 12w+  1b-  (+7 -2 =3) 
 4: Belzebub 0.67                     1648 8.5 / 12  88.0  40w+ 33b= 11w+  2b- 10w+  5b= 18b=  3w= 22b+ 15w+  8w=  9w+  (+6 -1 =5) 
 5: Vapor 0.01r12                     1626 8.5 / 12  75.5  46w= 39b- 35b+ 43w+ 16w+  4w= 37b- 26b+ 27w+ 38b+  2b= 21w+  (+7 -2 =3) 
 6: Pooky 2.7                         1633 8.0 / 12  84.0  32b+ 18w+ 13w+ 15w- 37b= 23b+ 38w+  8w+  2b-  9b-  7w= 17b+  (+7 -3 =2) 
 7: Mizar 3.0                         1666 8.0 / 12  84.0  45w+ 23b+ 26w+ 38w= 21b+  2b+  8b- 37w+  9b-  1w-  6b= 12w+  (+7 -3 =2) 
 8: ArcBishop80 1.0                   1643 7.5 / 12  92.5  19w+ 24b+  2b= 21w=  1b+  9w+  7w+  6b- 15w= 12b-  4b= 13b=  (+5 -2 =5) 
 9: Tristram 4.16                     1667 7.5 / 12  92.0  16w= 10b+ 33b+  3w+ 38b+  8b- 15w+  2w-  7w+  6w+  1b-  4b-  (+7 -4 =1) 
10: St Andersen 1.31 64-bit           1469 7.5 / 12  82.5  17b=  9w- 41b+ 46w+  4b- 43w+ 16b+  1w- 40w+ 21b+ 23b+  2w-  (+7 -4 =1) 
11: DChess 1.0.2                      1642 7.5 / 12  80.5  28b= 41w+  4b- 47b+  3w- 39w+ 14w+ 12b- 13w- 25b+ 34w+ 22b+  (+7 -4 =1) 
12: Jester 0.84                       1669 7.5 / 12  78.5  34b+ 26w- 45b+ 27w+ 40b= 21w- 23b+ 11w+ 38w+  8w+  3b-  7b-  (+7 -4 =1) 
13: Rainman 0.7.5                     1595 7.5 / 12  75.5  53w+ 54w+  6b- 32b+ 23w- 26b+ 22b= 21w- 11b+ 16b= 30w+  8w=  (+6 -3 =3) 
14: Mscp 1.6h                         1548 7.5 / 12  70.0  50w+ 15b- 43b= 17w+ 44w+ 37w- 11b- 45b= 36w= 40b+ 38b+ 23w+  (+6 -3 =3) 
15: Simon 1.3 64-bit                  1628 7.0 / 12  87.0  30w+ 14w+ 29b+  6b+  2w-  3b=  9b- 40w+  8b=  4b- 17w- 26w+  (+6 -4 =2) 
16: Piranha 0.5                       1478 7.0 / 12  82.5   9b= 17w+  3b- 34w+  5b- 46b+ 10w- 44w+ 24b+ 13w= 22w= 18b=  (+5 -3 =4) 
17: PolarChess 1.3                    1664 7.0 / 12  78.0  10w= 16b- 28w+ 14b- 25b= 20w+ 26b- 53b+ 39w+ 27w+ 15b+  6w-  (+6 -4 =2) 
18: Needle 0.531                      1560 7.0 / 12  71.5  56w+  6b- 49w- 54b+ 29w+ 27b+  4w= 38b- 23w- 31w+ 37b+ 16w=  (+6 -4 =2) 
19: Apep 1.01                         1465 7.0 / 12  68.5   8b- 20w+  1w- 59b+ 36b- 48w+ 49b- 25w- 53w+ 46b+ 43w+ 30b+  (+7 -5 =0) 
20: Soberango 0.09.8                  1061 7.0 / 12  62.5  24w- 19b- 60b+ 57w+ 41b- 17b- 30w- 56b+ 47w+ 50w+ 33w+ 27b+  (+7 -5 =0) 

21: Philemon C                        1588 6.5 / 12  86.5  48w+ 44b+ 27w+  8b=  7w- 12b+  2w- 13b+  3b- 10w- 24w+  5b-  (+6 -5 =1) 
22: Minimardi 1.3                     1383 6.5 / 12  81.0  27w- 42b+ 23b= 33w+ 49b+  1w= 13w= 24b=  4w- 34b+ 16b= 11w-  (+4 -3 =5) 
23: VanillaChess 2.6g                 1569 6.5 / 12  80.0  58b+  7w- 22w= 25b+ 13b+  6w- 12w- 28b+ 18b+ 37b+ 10w- 14b-  (+6 -5 =1) 
24: Damas 9                           1557 6.5 / 12  75.0  20b+  8w- 40w- 56b+ 31b+ 36w+  3b- 22w= 16w- 44w+ 21b- 37w+  (+6 -5 =1) 
25: IQ23.003                          1627 6.5 / 12  70.0  44b- 48b+ 47w= 23w- 17w= 45b= 46w= 19b+ 31b= 11w- 39w+ 38w+  (+4 -3 =5) 
26: Zotron 4.46                       1571 6.0 / 12  78.5  35w+ 12b+  7b- 37b- 45w+ 13w- 17w+  5w- 49b+ 30b- 32w+ 15b-  (+6 -6 =0) 
27: Violet 4.0                        1628 6.0 / 12  77.0  22b+ 47w+ 21b- 12b- 30w+ 18w- 32b+ 49w+  5b- 17b- 41w+ 20w-  (+6 -6 =0) 
28: Numpty 2017 64-bit                1444 6.0 / 12  76.5  11w=  3b- 17b- 42w+ 34w+ 30b+  1b- 23w- 44b- 51w+ 49w+ 31w=  (+5 -5 =2) 
29: Hokus-Pokus 0.6.3                 1544 6.0 / 12  73.0  42w+  1b+ 15w- 40b- 18b- 31b= 35w+ 34w- 33w= 41b- 55w+ 47b+  (+5 -5 =2) 
30: TonysChess 0.02                   1385 6.0 / 12  71.5  15b- 50b+ 44w- 52w+ 27b- 28w- 20b+ 32w+ 45b+ 26w+ 13b- 19w-  (+6 -6 =0) 
31: Skiull 0.1 64-bit                 1537 6.0 / 12  69.5  55b+ 38b- 34w= 36b= 24w- 29w= 47w+ 39b= 25w= 18b- 40w+ 28b=  (+3 -3 =6) 
32: Blikskottel 0.8                   1435 6.0 / 12  69.0   6w- 51b+ 54b+ 13w- 39b= 49w= 27w- 30b- 35w+ 36b+ 26b- 43b+  (+5 -5 =2) 
33: ACE2                              1566 6.0 / 12  68.0  52b+  4w=  9w- 22b- 43b- 57b+ 50w- 51w+ 29b= 45w+ 20b- 44b+  (+5 -5 =2) 
34: Alibaba 1.40                      1507 6.0 / 12  67.0  12w- 58w+ 31b= 16b- 28b- 59w+ 43b+ 29b+ 46w+ 22w- 11b- 41w=  (+5 -5 =2) 
35: Project Invincible 2.10           1189 6.0 / 12  66.0  26b- 36w=  5w- 50b+ 48w- 52w+ 29b- 41w= 32b- 53b+ 45b+ 46w+  (+5 -5 =2) 
36: AdaChess 20161108 64-bit          1627 6.0 / 12  66.0  39b- 35b= 59w+ 31w= 19w+ 24b- 45w- 50b+ 14b= 32w- 44w= 49b+  (+4 -4 =4) 
37: LarsenVB 00501                    1526 5.5 / 12  85.5  57w+  2b- 46b+ 26w+  6w= 14b+  5w+  7b-  1b- 23w- 18w- 24b-  (+5 -6 =1) 
38: ChessRikus 1.466                  1613 5.5 / 12  82.0  49b+ 31w+ 39w+  7b=  9w- 40b+  6b- 18w+ 12b-  5w- 14w- 25b-  (+5 -6 =1) 
39: Joanna2002 1.06                   1324 5.5 / 12  77.0  36w+  5w+ 38b-  1b- 32w= 11b- 41b+ 31w= 17b- 49w= 25b- 50w+  (+4 -5 =3) 
40: Pwned 1.3 64-bit                  1466 5.5 / 12  75.5   4b- 56w+ 24b+ 29w+ 12w= 38w- 44b+ 15b- 10b- 14w- 31b- 52w+  (+5 -6 =1) 
41: Satana.2.4.19.64-bit              1387 5.5 / 12  71.5   3w= 11b- 10w- 58b+ 20w+ 44b- 39w- 35b= 55w+ 29w+ 27b- 34b=  (+4 -5 =3) 
42: Iota 1.0 32-bit                    965 5.5 / 12  49.5  29b- 22w- 50w= 28b- 57w- 55b- 60w+ 59b+ 51b- 58b+ 56w+ 54w+  (+5 -6 =1) 
43: CeruleanJS 0.1.1 Blizzard 64-bit  1297 5.0 / 12  76.0   1w- 55b+ 14w=  5b- 33w+ 10b- 34w- 47b= 54b+ 48w+ 19b- 32w-  (+4 -6 =2) 
44: Eden 0.0.13                       1377 5.0 / 12  73.5  25w+ 21w- 30b+ 49b= 14b- 41w+ 40w- 16b- 28w+ 24b- 36b= 33w-  (+4 -6 =2) 
45: Tarrasch Toy Engine 0.906         1473 5.0 / 12  72.5   7b- 52w+ 12w- 51b+ 26b- 25w= 36b+ 14w= 30w- 33b- 35w- 55b+  (+4 -6 =2) 
46: Ozwald 0.43                       1313 5.0 / 12  72.0   5b= 53b+ 37w- 10b- 47w+ 16w- 25b= 55w+ 34b- 19w- 48w+ 35b-  (+4 -6 =2) 
47: Toledo Nanochess Jan/11/2010      1549 5.0 / 12  66.0  51w+ 27b- 25b= 11w- 46b- 53w+ 31b- 43w= 20b- 57w+ 52b+ 29w-  (+4 -6 =2) 
48: GrayMatter SVN1604                1192 5.0 / 12  59.5  21b- 25w- 51w- 55w+ 35b+ 19b- 53w- 58w+ 50b+ 43b- 46b- 57w+  (+5 -7 =0) 
49: KillerQueen 2.0b3                 1282 4.5 / 12  70.5  38w- 57b+ 18b+ 44w= 22w- 32b= 19w+ 27b- 26w- 39b= 28b- 36w-  (+3 -6 =3) 
50: GiuChess 1.0                      1004 4.5 / 12  65.5  14b- 30w- 42b= 35w- 58b+ 56b+ 33b+ 36w- 48w- 20b- 51w+ 39b-  (+4 -7 =1) 
51: Zoe 0.1                           1020 4.5 / 12  55.0  47b- 32w- 48b+ 45w- 59b= 54w- 52w+ 33b- 42w+ 28b- 50b- 60w+  (+4 -7 =1) 
52: Neurone XXVI                      1123 4.5 / 12  53.5  33w- 45b- 55w+ 30b- 56w= 35b- 51b- 60b+ 58w+ 54w+ 47w- 40b-  (+4 -7 =1) 
53: Gringo 1.4.9b                     1205 4.0 / 12  56.5  13b- 46w- 56b- 60w+ 54w+ 47b- 48b+ 17w- 19b- 35w- 58w+ 59b-  (+4 -8 =0) 
54: Yawce 0.16                        1508 4.0 / 12  55.5  59w+ 13b- 32w- 18w- 53b- 51b+ 55b- 57w+ 43w- 52b- 60w+ 42b-  (+4 -8 =0) 
55: Youk 1.05                          960 4.0 / 12  55.0  31w- 43w- 52b- 48b- 60b+ 42w+ 54w+ 46b- 41b- 59w+ 29b- 45w-  (+4 -8 =0) 
56: Talvmenni 0.1                     1067 4.0 / 12  54.5  18b- 40b- 53w+ 24w- 52b= 50w- 57b= 20w- 59w+ 60b= 42b- 58w=  (+2 -6 =4) 
57: NSVChess 0.14                      948 4.0 / 12  52.5  37b- 49w- 58w= 20b- 42b+ 33w- 56w= 54b- 60w+ 47b- 59w+ 48b-  (+3 -7 =2) 
58: Byak 8.10.40 64-bit               1145 2.5 / 12  53.0  23w- 34b- 57b= 41w- 50w- 60w= 59b+ 48b- 52b- 42w- 53b- 56b=  (+1 -8 =3) 
59: Acqua 20160918                     545 2.5 / 12  52.5  54b- 60w+ 36b- 19w- 51w= 34b- 58w- 42w- 56b- 55b- 57b- 53w+  (+2 -9 =1) 
60: Raffaela 2.15                     1218 1.0 / 12  55.5   2w- 59b- 20w- 53b- 55w- 58b= 42b- 52w- 57b- 56w= 54b- 51b-  (+0 -10 =2) 
-------------------------------------------------------------------------------------------------------------------
Rank 1 to 20 will play in Group E next edition 

Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

Hi people again after a lot of time!

I´m thinking in starting a new code for Soberango and I´m revisiting old suggestions.

Here is one from Frisian:
frisian wrote: ...
Also calling lot’s of SubRoutine’s is waist of time, especial routine’s that only called from one places.
Better incorporate SubRoutine’s into one. ‘MuevePeon.bas’ has several subroutine’s that should be made into one big subroutine.
...
One of the reason to use SubRoutines for me, is to could use the same names for some minor parameters. I use common shared for important ones and "local values" for minor ones.

Is a wrong idea for a chess program? The use of Subroutines slowdown the program as much as it is better to use more names for minor parameters than use Subroutines? Could Macros be usefull for this purposes?

Thanks!
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Soberango 0.00.0 (chess engine) realized.

Post by jj2007 »

Luis Babboni wrote:The use of Subroutines slowdown the program as much as it is better to use more names for minor parameters than use Subroutines? Could Macros be usefull for this purposes?
Replacing SUBs with macros is a good idea only in a tight loop that calls a very short SUB. The overhead for calling a sub is only a few cycles, insignificant if your SUB needs thousands of cycles e.g. for a call to the OS.
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

jj2007 wrote:
Luis Babboni wrote:The use of Subroutines slowdown the program as much as it is better to use more names for minor parameters than use Subroutines? Could Macros be usefull for this purposes?
Replacing SUBs with macros is a good idea only in a tight loop that calls a very short SUB. The overhead for calling a sub is only a few cycles, insignificant if your SUB needs thousands of cycles e.g. for a call to the OS.
Thanks jj!

I think I just need to not abuse of the subroutines then. In fact I did it and seems that this was the Frisian warning!
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Soberango 0.00.0 (chess engine) realized.

Post by caseih »

Abuse subroutines? On the contrary, use them liberally to organize your code and make your logical structures and flow clear and simple. If you have some code that's longer than a few screen fulls, break that code out into a subroutine (modularize, and test). If your code is easy to understand, then it stands a much greater chance of actually being fast, and much easier to debug, profile, and optimize.

Worrying about the overhead of subroutines is a premature optimization unless you've proven that is a problem, pure and simple. Once your code is written, then you profile it to determine exactly where the slow spots really are, identify those that actually matter, and then focus your optimization attempts there. Sadly tools for profiling FB code are lacking, but if you use the C backend, you can use any C profiler tool on it.

I'm not sure FB supports inline subroutines explicitly, but if you used the gcc backend and specified optimizations, the compiler would automatically do that, making subroutines as fast as macros.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Soberango 0.00.0 (chess engine) realized.

Post by grindstone »

@Luis Babboni:
Regarding to the SUBs I agree with caseih.

If identical variable names is your only problem, maybe have a look at NAMESPACE.
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

Thanks guys!

This is what I mean when I said I abuse of subroutines:
Image

10 in red is a subroutine that make calls, in blue, to red subroutines that are all of about the same size than 6 in red that is the only one I expanded to made all the image visible.

The subroutine 10 is called may be thousends of times per second.
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

Another question.

Actually, once per move that means before start searching the tree of posibilities, Soberango change by random the order of the pieces that it will use to study theires movements.
Cause this, actually in the tree search that are subroutines that be run thousends of times per second, I have code like this:

if m=mp(5) then...

Where mp(5) is not the "piece 5" but the actual piece ordered in 5th place. As i said, that order change for each movement.

My question is if this code (with wich it need to search into an array) could slowdown the program more than if after make the random new order but before start searching the tree (that means I need to do it just once per move not thousends of times per move), I assigned values for example like this:

mp1=mp(1)
mp2=mp(2)
mp3=mp(3)
mp4=mp(4)
mp5=mp(5)

and then instead of use thousends of time per second the actual line if m=mp(5) then... I´ll use thousends of times per second:

if m=mp5 then...

Thanks!
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Soberango 0.00.0 (chess engine) realized.

Post by caseih »

You could probably pick more descriptive names for your subroutines. And if you find that you're working mostly with global variables that can be an indication that you might want to consider using a class to hold your shared variables, and make your subs and functions members of that class. Also you may want to consider using functions instead of subroutines, and returning results from calculations, rather than rely on lots of potentially conflicting global variables. Sometimes shared state is unavoidable. But if you can avoid it as much as possible it will make your code easier to understand and less likely to have clashing variable names.

The question to ask yourself is, if you set this project aside for 6 months or a year, when you came back to it would you be able to understand what you had done?
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

This is a test I did about my second question:
Image

Seems the second way is faster but I do not understand why the great cnahge in times specially in fisrt way to do it.
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

Re: Soberango 0.00.0 (chess engine) realized.

Post by Luis Babboni »

caseih wrote: ... you might want to consider using a class to hold your shared variables, and make your subs and functions members of that class. Also you may want to consider using functions instead of subroutines...
I think you are right.... but for this I need to learn what are class and functions, I still use not much more knowledge that I had when programming my Sinclair Spectrum! :-D
I´ll try to take a look about that, thanks!
caseih wrote: The question to ask yourself is, if you set this project aside for 6 months or a year, when you came back to it would you be able to understand what you had done?
Actually I´m reading the code after more than a year and, with surprise, I understand it mostly, far more than I spected. (I think coudl be cause programming is not my work, that what I did more than an year ago was my last work on programming)
Last edited by Luis Babboni on Aug 21, 2018 13:58, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Soberango 0.00.0 (chess engine) realized.

Post by caseih »

I was just about to suggest you test it and see if that would make a difference.

Yes, caching results of an array lookup can be a good optimization. I do this in Python from time to time.

It's hard to generalize from such a short and arbitrary test. Perhaps FBC is caching the value of a(7) for you as an optimization. You might want to choose a random element of a() for each test, rather than the arbitrary a(7) lookup may be optimized right out by the compiler.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Soberango 0.00.0 (chess engine) realized.

Post by paul doe »

Luis Babboni wrote:Seems the second way is faster but I do not understand why the great cnahge in times specially in fisrt way to do it.
The test is mostly trivial so this is inconclusive. However, it does seem to me that the difference is hardly noticeable, no? If you average them, you'll find that, for all practical purposes, they are inconsequential.

You're approaching optimization exactly in the opposite way; that is, you should optimize algorithms and data structures first (generalities), then see if those minutiae are really a bottleneck in you code (most likely they aren't). Generally, you should approach optimization in the following order:
  • Data structures
  • Data structures
  • Algorithms
  • Some more data structures
  • Everything else
=D

That is, the speed of your code mostly depends on using the proper data structures, coupled with appropriate algorithms. In your case, if you're using a decision tree, see if you can optimize there first, especially traversal operations.
Post Reply