Chess2u
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Chess2uLog in

SecondChess

descriptionSecondChess EmptySecondChess

more_horiz
SecondChess (WB)

Secondchess is a chess engine by Emilio Díaz, based on firstchess by Pham Hong Nguyen

Its main goal is to add the neccesary code to firstchess in order to make it play real chess, especially adding the rules for castle and en passant capture

to compile just "gcc secondchess.c -o secondchess -Ofast"

https://github.com/pocopito/secondchess

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi all

This is my first post in this forum. As the developer of secondchess I apreciate Steve's entry, and just wanted to add a couple of details about this humble engine.
The spirit of secondchess is quite the same than the one of firstchess: develop an easy to read and understand chess program for those who want to learn how a chess engine works. The very first steps were adding castle and eps, and so far it seems it's been done. A little modification of the eval function was also done, in order to make secondchess to play a chess game with  bit more of "understanding".
The code is GPL so anyone who's interested can develop its own engine starting from secondchess.

Needless to say, any comments and sugestions, specially in order to make the code easiert o understand are welcome.

Regards
 
  E Diaz

PS: For those who could be interested, there's a somehow stable version of the engine on this link:
https://github.com/emdio/secondchess/tags

Last edited by pocopito on Tue Dec 17, 2013 9:32 am; edited 1 time in total (Reason for editing : Update url)

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi Emilio, when will the exe be available?

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Thomas Miller wrote:
Hi Emilio, when will the exe be available?


Hi Thomas

Actually the main point of secondchess is its source code: it just means to be a (hopefuly) useful tool for people interested on learning how a chess engine works. Its eval function is really simple (just material balance and piece square tables for bishop, kinght and king), and despite it's not completely a "woodpusher", I guess it has almost no interest to play a game against it (of course it's something I do frequently, but it has more to do with searching for bugs).
Besides, only in the last days I've worked on implementing the xboard protocol, so currently the only way to play against secondchess is from the (ugly) terminal.

On the other side, when I was thinking about the content of this response, I thought it could be a good idea to have a couple of executables (linux and windows, and probably also xboard and no xboard support) available from github, just in case someone wants to try the engine, and hopefully, report some bugs. So thanks for the suggestion: I guess in the next days I'll upload some execs and will update the info here.

Regards

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Just added executable files for linux 32 and 64 bit.
https://github.com/pocopito/secondchess/blob/master/secondchess32Linux
https://github.com/pocopito/secondchess/blob/master/secondchess64Linux

In the next days I'll try to get some windows compilations.


Regards

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
SecondChess TM (WB)
http://www3.telus.net/tmokonen/SecondChess.rar

SecondChess plays illegal moves, any idea?

descriptionSecondChess EmptyRe: SecondChess

more_horiz
jnhes wrote:
SecondChess TM (WB)
http://www3.telus.net/tmokonen/SecondChess.rar

SecondChess plays illegal moves, any idea?


Thanks for the windows executable. I'm testing it on an XP machine and seems to work fine.

Related to the illegal moves, could you provide any hint in order to reproduce it? (I'm sorry there's no fen edition utility for cases like this)

Regards

E Diaz

PS: Is it a problem if I temporally add this rar (or the link to it) in my github?

descriptionSecondChess EmptyRe: SecondChess

more_horiz
pocopito wrote:
jnhes wrote:
SecondChess TM (WB)
http://www3.telus.net/tmokonen/SecondChess.rar

SecondChess plays illegal moves, any idea?


Thanks for the windows executable. I'm testing it on an XP machine and seems to work fine.

Related to the illegal moves, could you provide any hint in order to reproduce it? (I'm sorry there's no fen edition utility for cases like this)

Regards

E Diaz

PS: Is it a problem if I temporally add this rar (or the link to it) in my github?

From here:
http://computer-chess.org/forum/index.php?mode=thread&id=1935

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Thanks for the post and the advice. Secondches has a huge bug in the en pasant capture that I'm working right now on.

Regards

E Diaz

descriptionSecondChess EmptyCompiling SecondChess in Windows7 VisStudio cmd prompt

more_horiz
Thanks for SecondChess source.
I cannot get it to compile on Win7 with VisStudio2010 cmd line compile:
....\SecondChess>cl secondchess.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

secondchess.c
secondchess.c(806) : error C2143: syntax error : missing ';' before 'type'
secondchess.c(809) : error C2143: syntax error : missing ';' before 'type'
secondchess.c(812) : error C2065: 'i' : undeclared identifier
secondchess.c(812) : error C2065: 'i' : undeclared identifier
secondchess.c(812) : error C2065: 'i' : undeclared identifier
secondchess.c(814) : error C2065: 'i' : undeclared identifier
secondchess.c(818) : error C2065: 'score' : undeclared identifier
secondchess.c(818) : error C2065: 'i' : undeclared identifier
secondchess.c(822) : error C2065: 'i' : undeclared identifier
secondchess.c(825) : error C2065: 'score' : undeclared identifier
secondchess.c(825) : error C2065: 'i' : undeclared identifier
secondchess.c(828) : error C2065: 'score' : undeclared identifier
secondchess.c(828) : error C2065: 'i' : undeclared identifier
secondchess.c(831) : error C2065: 'score' : undeclared identifier
secondchess.c(831) : error C2065: 'i' : undeclared identifier
secondchess.c(834) : error C2065: 'score' : undeclared identifier
secondchess.c(834) : error C2065: 'i' : undeclared identifier
secondchess.c(837) : error C2065: 'score' : undeclared identifier
secondchess.c(837) : error C2065: 'i' : undeclared identifier
secondchess.c(841) : error C2065: 'i' : undeclared identifier
secondchess.c(843) : error C2065: 'score' : undeclared identifier
secondchess.c(843) : error C2065: 'i' : undeclared identifier
secondchess.c(845) : error C2065: 'i' : undeclared identifier
secondchess.c(848) : error C2065: 'score' : undeclared identifier
secondchess.c(848) : error C2065: 'i' : undeclared identifier
secondchess.c(851) : error C2065: 'score' : undeclared identifier
secondchess.c(851) : error C2065: 'i' : undeclared identifier
secondchess.c(854) : error C2065: 'score' : undeclared identifier
secondchess.c(854) : error C2065: 'i' : undeclared identifier
secondchess.c(857) : error C2065: 'score' : undeclared identifier
secondchess.c(857) : error C2065: 'i' : undeclared identifier
secondchess.c(860) : error C2065: 'score' : undeclared identifier
secondchess.c(860) : error C2065: 'i' : undeclared identifier
secondchess.c(867) : error C2065: 'score' : undeclared identifier
secondchess.c(868) : error C2065: 'score' : undeclared identifier
secondchess.c(1659) : error C2275: 'clock_t' : illegal use of this type as an ex
pression
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\time.h(82
) : see declaration of 'clock_t'
secondchess.c(1659) : error C2146: syntax error : missing ';' before identifier
'start'
secondchess.c(1659) : error C2065: 'start' : undeclared identifier
secondchess.c(1660) : error C2275: 'clock_t' : illegal use of this type as an ex
pression
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\time.h(82
) : see declaration of 'clock_t'
secondchess.c(1660) : error C2146: syntax error : missing ';' before identifier
'stop'
secondchess.c(1660) : error C2065: 'stop' : undeclared identifier
secondchess.c(1661) : error C2143: syntax error : missing ';' before 'type'
secondchess.c(1664) : error C2065: 'start' : undeclared identifier
secondchess.c(1665) : error C2065: 'start' : undeclared identifier
secondchess.c(1671) : error C2065: 'stop' : undeclared identifier
secondchess.c(1672) : error C2065: 't' : undeclared identifier
secondchess.c(1672) : error C2065: 'stop' : undeclared identifier
secondchess.c(1672) : error C2065: 'start' : undeclared identifier
secondchess.c(1673) : error C2065: 't' : undeclared identifier
secondchess.c(1675) : error C2143: syntax error : missing ';' before 'type'
secondchess.c(1678) : error C2065: 'decimal_score' : undeclared identifier
secondchess.c(1678) : error C2065: 'decimal_score' : undeclared identifier
secondchess.c(1685) : error C2065: 'decimal_score' : undeclared identifier
secondchess.c(1685) : error C2065: 't' : undeclared identifier
secondchess.c(1828) : error C2275: 'MOVE' : illegal use of this type as an expre
ssion
secondchess.c(138) : see declaration of 'MOVE'
secondchess.c(1828) : error C2146: syntax error : missing ';' before identifier
'moveBuf'
secondchess.c(1828) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1828) : error C2109: subscript requires array or pointer type
secondchess.c(1829) : error C2143: syntax error : missing ';' before 'type'
secondchess.c(1914) : error C2065: 'movecnt' : undeclared identifier
secondchess.c(1914) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1914) : warning C4047: 'function' : 'MOVE *' differs in levels of
indirection from 'int'
secondchess.c(1914) : warning C4024: 'Gen' : different types for formal and actu
al parameter 2
secondchess.c(1917) : error C2065: 'movecnt' : undeclared identifier
secondchess.c(1918) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1918) : error C2109: subscript requires array or pointer type
secondchess.c(1918) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1918) : error C2109: subscript requires array or pointer type
secondchess.c(1926) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1926) : error C2109: subscript requires array or pointer type
secondchess.c(1930) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1930) : error C2109: subscript requires array or pointer type
secondchess.c(1934) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1934) : error C2109: subscript requires array or pointer type
secondchess.c(1938) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1938) : error C2109: subscript requires array or pointer type
secondchess.c(1944) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1944) : error C2109: subscript requires array or pointer type
secondchess.c(1947) : error C2065: 'moveBuf' : undeclared identifier
secondchess.c(1947) : error C2109: subscript requires array or pointer type
secondchess.c(1947) : error C2198: 'MakeMove' : too few arguments for call

I could not get my copy of FirstChess to compile either....

Anyway I have dl'd the Windows binary/exe from this page for SecondChess.
However I would be grateful if some expert C programmer could sort out the code to compile with MS VisStudio2010 compiler. I'm sure it isn't too hard but my programming/coding skills are very limited right now. I am trying to learn C & chess programming & hope to improve my coding skill rapidly!

Many thanks

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi richardpd

Could you paste the very source code that gave this errors messages? I'm not a windows programmer myself, but due to the number and the type of errors it seems to be something related to code standards.

Regards

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Sure...
Spoiler :


BTW I played SecondChess in Arena 5 min time control & I won on time. Can move speed be improved?See:
[Event "Computer chess game"]
[Site "RICHARD-PC"]
[Date "2012.04.22"]
[Round "?"]
[White "Richard"]
[Black "SecondChess"]
[Result "1-0"]
[BlackElo "2000"]
[ECO "C44"]
[Opening "Open Game"]
[Time "01"]
[Variation "Inverted Hanham"]
[WhiteElo "2400"]
[TimeControl "300"]
[Termination "time forfeit"]
[PlyCount "37"]
[WhiteType "human"]
[BlackType "program"]

1. e4 d5 2. Nc3 d4 3. Nce2 e5 4. Nf3 Nc6 5. d3 Bg4 6. Ng3 Nf6 7. Be2 Bb4+
8. Bd2 Bxf3 9. Bxf3 O-O 10. O-O Bxd2 11. Qxd2 Rb8 12. a3 Ra8 13. Nf5 Ne8
14. Bg4 Nd6 15. f4 Re8 16. Nxd6 cxd6 17. f5 Qh4 18. h3 Rad8 19. Rf2 ...
{Black forfeits on time} 1-0


Best wishes

UPDATE-I just removed 'spoiler' tags from this post-I did not add them-did they add in automatically or did someone add them?
NEXT UPDATE-I have replaced 'spoiler' tags on this code now (see Victors post about this).I still do not know how/who put this tag here to start with! (not sure 'spoiler' is the best name for these either- why not 'show/hide'? Nevermind...:-)

Last edited by richardpd on Sun Apr 22, 2012 1:05 pm; edited 2 times in total (Reason for editing : adding spoiler tags)

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Maybe this could help:
http://msdn.microsoft.com/en-us/library/ewcf0002%28v=vs.80%29.aspx

The xboard implementation in secondchess is very simplistic, and it won't recognize anything related to time controls. Sorry for that, but right now I'm focused on other parts of the code.
When you can compile your own executables, you can modify the max_depth parameter. It'll make the engine to play faster (and worse), but of course won't fix the "this time control stuff isn't for me" issue.
In the scidVSpc I've got secondchess to play full games against other engines setting a time control of fixed time per move.

Regards

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
The link hasn't helped me & I have spent too much time this morning googling for help & trying to fix the code. For some reason cl compiler thinks syntax errors and undeclared variables around line 785-790....& too many other errors. I am not a proficient C/C++ programmer-surely someone here on this forum is & knows how to & can fix this easily?
(also why does the code I posted earlier not now show-just 'spoiler'?).


Update: I remembered I once looked at TinyCC compiler & sure enough I had a copy on my drive-so I used tcc compiler to compile secondchess.c & it worked (after I had added tcc to my windows path).
It still bugs me that MSVisStudio 2010 cl compiler baulks at this code-so the code is probably not strictly standards compliant? Still using tcc compiler is a backup/temporary option which will suffice for now and maybe useful again.

Last edited by richardpd on Sun Apr 22, 2012 11:25 am; edited 1 time in total (Reason for editing : update)

descriptionSecondChess EmptyRe: SecondChess

more_horiz


In Otros(in spahish) in rigth opciones the messenger.

I could not compile a few days ago when asked.
Too many errors with VisualC + +.

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Well, I guess I've solved the hideous en passant bug. After some quick tests it seems to work now fine. Right now I'm testing it playing many games in fast controls, but in any case the improve is good enough to update the code in the github repository. So please replace the old code ASAP with the new one:
https://github.com/pocopito/secondchess


Best regards and thanks everybody who is testing the code.

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Emilio
My compile problems persist as now trying to compile the latest 1.24v secondchess. c with tcc I get xboard type error eg:

Code:

SecondChess>tcc secondchess.c
secondchess.c:2000: incompatible types for redefinition of 'xboard'

Any idea why & how to fix?
Best wishes

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi Richard

Thanks for testing and for the feedback.
I'm not quite sure how the xboard part works, but check this: Right under the "main" section:
/*
****************************************************************************
* Main program *
****************************************************************************
*/

//void xboard();


Check either the "void xboard()" part is either commented or not, and just change to the opposite :) (I've seen that with different compilers I need one or the other option.)

Regards

Emilio

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Emilio
Thanks for your quick reply-your fix worked (I uncommented xboard).
Then I compiled fine (tcc) & played my second game & I lost on time!!!
(I'm having a bad day.....) Game pgn below:

[Event "Computer chess game"]
[Site "RICHARD-PC"]
[Date "2012.04.25"]
[Round "?"]
[White "Richard"]
[Black "SecondChess"]
[Result "0-1"]
[BlackElo "2000"]
[ECO "A18"]
[Opening "English"]
[Time "17:22:55"]
[Variation "Mikenas, Flohr, 4...d4"]
[WhiteElo "2400"]
[TimeControl "300"]
[Termination "time forfeit"]
[PlyCount "114"]
[WhiteType "human"]
[BlackType "program"]

1. e4 d5 2. Nc3 d4 3. Nce2 e6 4. Nf3 Nc6 5. e5 a6 6. Ng3 Qd5 7. d3 Nxe5 8.
Nxe5 Qxe5+ 9. Qe2 Bb4+ 10. Bd2 Bxd2+ 11. Kxd2 Qf4+ 12. Ke1 Nf6 13. Qd2
Qxd2+ 14. Kxd2 O-O 15. Be2 Bd7 16. Bf3 Rad8 17. Bxb7 a5 18. Ba6 Bc6 19. f3
Ra8 20. Bc4 Rab8 21. b3 Bd5 22. Bxd5 exd5 23. Rae1 a4 24. Re7 Rbc8 25. Nf5
axb3 26. axb3 c5 27. Ra1 Ra8 28. Rxa8 Rxa8 29. Rc7 g6 30. Ne7+ Kf8 31. Nc6
Kg8 32. Ra7 Rxa7 33. Nxa7 c4 34. b4 Kh8 35. b5 Kg8 36. b6 Nd7 37. b7 Nb8
38. Nc8 Kf8 39. dxc4 dxc4 40. Nd6 c3+ 41. Kd3 Nc6 42. Nb5 Ne5+ 43. Kxd4
Nc6+ 44. Kxc3 Kg8 45. Kc4 Na5+ 46. Kc5 Nxb7+ 47. Kb6 Nd8 48. c4 Ne6 49. c5
Nf4 50. c6 Nd5+ 51. Kb7 f6 52. c7 Nxc7 53. Kxc7 Kf8 54. Nd4 Kg8 55. Kd7 Kf7
56. g4 h5 57. h3 Kg7 58. ... {White forfeits on time} 0-1

I was surprised SecondChess played quicker-I was expecting it to time out like my first game! So it's one all (game score) and now I'll have to play a deciding game....
Thanks

descriptionSecondChess EmptyRe: SecondChess

more_horiz
richardpd wrote:
Emilio
Thanks for your quick reply-your fix worked (I uncommented xboard).
Then I compiled fine (tcc) & played my second game & I lost on time!!!
(I'm having a bad day.....) Game pgn below:

[Event "Computer chess game"]
[Site "RICHARD-PC"]
[Date "2012.04.25"]
[Round "?"]
[White "Richard"]
[Black "SecondChess"]
[Result "0-1"]
[BlackElo "2000"]
[ECO "A18"]
[Opening "English"]
[Time "17"]
[Variation "Mikenas, Flohr, 4...d4"]
[WhiteElo "2400"]
[TimeControl "300"]
[Termination "time forfeit"]
[PlyCount "114"]
[WhiteType "human"]
[BlackType "program"]

1. e4 d5 2. Nc3 d4 3. Nce2 e6 4. Nf3 Nc6 5. e5 a6 6. Ng3 Qd5 7. d3 Nxe5 8.
Nxe5 Qxe5+ 9. Qe2 Bb4+ 10. Bd2 Bxd2+ 11. Kxd2 Qf4+ 12. Ke1 Nf6 13. Qd2
Qxd2+ 14. Kxd2 O-O 15. Be2 Bd7 16. Bf3 Rad8 17. Bxb7 a5 18. Ba6 Bc6 19. f3
Ra8 20. Bc4 Rab8 21. b3 Bd5 22. Bxd5 exd5 23. Rae1 a4 24. Re7 Rbc8 25. Nf5
axb3 26. axb3 c5 27. Ra1 Ra8 28. Rxa8 Rxa8 29. Rc7 g6 30. Ne7+ Kf8 31. Nc6
Kg8 32. Ra7 Rxa7 33. Nxa7 c4 34. b4 Kh8 35. b5 Kg8 36. b6 Nd7 37. b7 Nb8
38. Nc8 Kf8 39. dxc4 dxc4 40. Nd6 c3+ 41. Kd3 Nc6 42. Nb5 Ne5+ 43. Kxd4
Nc6+ 44. Kxc3 Kg8 45. Kc4 Na5+ 46. Kc5 Nxb7+ 47. Kb6 Nd8 48. c4 Ne6 49. c5
Nf4 50. c6 Nd5+ 51. Kb7 f6 52. c7 Nxc7 53. Kxc7 Kf8 54. Nd4 Kg8 55. Kd7 Kf7
56. g4 h5 57. h3 Kg7 58. ... {White forfeits on time} 0-1

I was surprised SecondChess played quicker-I was expecting it to time out like my first game! So it's one all (game score) and now I'll have to play a deciding game....
Thanks

Could you please send me link to the latest build?

descriptionSecondChess EmptyRe: SecondChess

more_horiz
richardpd wrote:
Emilio
Thanks for your quick reply-your fix worked (I uncommented xboard).
Then I compiled fine (tcc) & played my second game & I lost on time!!!
(I'm having a bad day.....) Game pgn below:
...

I was surprised SecondChess played quicker-I was expecting it to time out like my first game! So it's one all (game score) and now I'll have to play a deciding game....
Thanks


I'm glad the trick worked!

If the engine is playing faster, it can be due to several reasons:
-You modified the max_depth parameter to a lower value (which'd make the engine play faster but, of course, worse)
-Maybe you applied an optimization option in the compilation, but it seems tcc has nothing like this
-If in the search function you switch from

Code:

else
{
//value = Quiescent(alpha, beta);
value = -Eval();
}


to

Code:

else
{
value = Quiescent(alpha, beta);
//value = -Eval();
}


The engine will play slower.

In any case I'm glad you're enjoying it. If while reading the code you find some parts hard to understand, please let me know, as the main goal of secondchess is being a useful tool for anyone interested on how a chess engine works.

Regards

Emilio

PS: secondchess has no opening book or random on its code, so if you want to get some variations in the game, the "novelties" must be made by you
PS': take into account that despite you're playing games with time control seondchess has no idea of this issue. I mean, it won't play faster when you set a shorter time control.

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi Emilio
Since my last post I have played quite a few games versus SecondChess-some I win & some I lose.
Like the game I posted earlier all the games I have played as White with 1.e4 & SecondChess always replies 1.d5 (Scandinavian opening).
I do not mind this as it gives me practice in this opening!!(one day I will let SecondChess play white!!).

Meanwhile I have been trying to learn C programming from internet resources and playing around trying to make my own C console chess engine.
This will take a while as my C programming expertise/skill is basic!
I do hope to look at SecondChess C sourcecode and understand it more now I know more of C language!
If I look at it & get queries I will ask for your help & many thanks for trying to make this engine understandable to a fledgling/beginner chess programmer-this is very helpful! smile

I am posting this from my login on my wife's desktop computer Win7, where I have just compiled SecondChess so I can play it on this computer(my computer is updating Ubuntu as I type-although it dual boots with Win7 -via KVM switch...).I did this in Geany editor for windows (this uses gcc compiler that is from DevC++ which is in the Win7 path).
It compiled with some error messages which I post below but it runs fine in Arena.

I thought you might be interested in the compile errors/warnings:

gcc -Wall -c "secondchess.c" (in directory: C:\pocopito-secondchess-v0.1-30-gc8db4a0\pocopito-secondchess-c8db4a0)
secondchess.c: In function `Gen':
secondchess.c:530: warning: implicit declaration of function `IsInCheck'
secondchess.c:531: warning: implicit declaration of function `IsAttacked'
secondchess.c: In function `GenCaps':
secondchess.c:603: warning: unused variable `row'
secondchess.c: In function `TakeBack':
secondchess.c:1432: warning: unused variable `i'
secondchess.c: In function `perft':
secondchess.c:1767: warning: unused variable `value'
secondchess.c:1772: warning: unused variable `tmpMove'
Compilation finished successfully.

Doesn't seem to be any major issue here but you may want to consider fixing the code for the GCC compiler?
I have not tried it with VisStudioExpress cl.exe as I did initially on my machine! (As per my orginal post here. Also I have now more experience with various C compilers on Win7 eg cl.exe, tcc, gcc, lcc etc & various IDE eg MSVisStudioExpress/DevC++/Geany!).

Best wishes smile

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Hi Richard

I'm glad to read the good news, specially the one related to the use of geany+gcc in order to compile secondchess without problems under windows. Probably I'll add this info to the README file, and I guess I myself will use it in order to provide windows executables. Thanks for the info!

One little tip: if you want to play something different to the scandinavian, you can undo the d5 move played by black, make the move you desire. After that the engine will play white automatically, but all you have to do is just undo its move and play as white again.

I myself am not a good C programmer, and actually one of the reasons I started this little project was to refresh and improve my C skills.

Thanks for the compiler warnings. I guess most of them are due to the fact that currently secondchess is in an unstable stage, and some of the tests I do leave bad code such as unused vars.
By the way, as you're working under linux, give a try to the clang compiler. It works quite like gcc, but very often the kind of info it provides is more human friendly:
http://clang.llvm.org/diagnostics.html

I'm not sure if I provided this info on a previous post, but just in case:

This is a nice forum about chess programming:
http://talkchess.com/forum/index.php

And this is a nice wikispace about the same topic:
http://chessprogramming.wikispaces.com/

Cheers

E Diaz

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Emilio
Many thanks for your prompt & helpful reply and all your help with SecondChess.
I'm sure our Chess & C programming will progress well!
Best wishes smile

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Emilio
I have been running SecondChess in Arena GUI but I've just tried it in console mode-but the board display there is not so good. Have you noticed that?
With a minor adjustment to PrintBoard function this is fixed eg:
Presently I have this console output:-

Code:

Second Chess, by Emilio Diaz
 Help
 d: display board
 MOVE: make a move (e.g. b1c3, a7a8q, e1g1)
 on: force computer to move
 quit: exit
 sd n: set engine depth to n plies
 undo: take back last move
sc> e2e4
 +---+---+---+---+---+---+---+---+
 8 | r | n | b | q | k | b | n | r |
 +---+---+---+---+---+---+---+---+
 7 | p | p | p | p | p | p | p | p |
 +---+---+---+---+---+---+---+---+
 6 |  |  |  |  |  |  |  |  |
 +---+---+---+---+---+---+---+---+
 5 |  |  |  |  |  |  |  |  |
 +---+---+---+---+---+---+---+---+
 4 |  |  |  |  | P |  |  |  |
 +---+---+---+---+---+---+---+---+
 3 |  |  |  |  | * |  |  |  |
 +---+---+---+---+---+---+---+---+
 2 | P | P | P | P |  | P | P | P |
 +---+---+---+---+---+---+---+---+
 1 | R | N | B | Q | K | B | N | R |
 +---+---+---+---+---+---+---+---+
    a  b  c  d  e  f  g  h
Search result: move = d7d5; nodes = 0, evaluations = 4074706, moves made = 45130
41, depth = 6, score = 0.85, time = 3.26s, knps = 0.00
 +---+---+---+---+---+---+---+---+
 8 | r | n | b | q | k | b | n | r |
 +---+---+---+---+---+---+---+---+
 7 | p | p | p |  | p | p | p | p |
 +---+---+---+---+---+---+---+---+
 6 |  |  |  | * |  |  |  |  |
 +---+---+---+---+---+---+---+---+
 5 |  |  |  | p |  |  |  |  |
 +---+---+---+---+---+---+---+---+
 4 |  |  |  |  | P |  |  |  |
 +---+---+---+---+---+---+---+---+
 3 |  |  |  |  |  |  |  |  |
 +---+---+---+---+---+---+---+---+
 2 | P | P | P | P |  | P | P | P |
 +---+---+---+---+---+---+---+---+
 1 | R | N | B | Q | K | B | N | R |
 +---+---+---+---+---+---+---+---+
    a  b  c  d  e  f  g  h
CASTLE: 15
sc>





SO...on changing PrintBoard function to:-

Code:


void PrintBoard()
{
   char pieceName[] = "PNBRQKpnbrqk";
   int i;
   for (i = 0; i < 64; i++)
   {
      if ((i & 7) == 0)
      {
         printf("    +---+---+---+---+---+---+---+---+\n");
         if (i <= 56)
         {
            printf(" %2d |", 8 - (((unsigned) i) >> 3));
         }
      }
      if (piece[i] == EMPTY)
         printf("  |");
      else if (piece[i] == EPS_SQUARE)
         printf(" * |");
      else
      {
         printf(" %c |", pieceName[piece[i] + (color[i] == WHITE ? 0 : 6)]);
      }
      if ((i & 7) == 7)
         printf("\n");
   }
   printf("    +---+---+---+---+---+---+---+---+\n      a  b  c  d  e  f  g  h\n");
}




this outputs a better board at the console eg:


Code:


Second Chess, by Emilio Diaz
 Help
 d: display board
 MOVE: make a move (e.g. b1c3, a7a8q, e1g1)
 on: force computer to move
 quit: exit
 sd n: set engine depth to n plies
 undo: take back last move
sc> e2e4
    +---+---+---+---+---+---+---+---+
  8 | r | n | b | q | k | b | n | r |
    +---+---+---+---+---+---+---+---+
  7 | p | p | p | p | p | p | p | p |
    +---+---+---+---+---+---+---+---+
  6 |  |  |  |  |  |  |  |  |
    +---+---+---+---+---+---+---+---+
  5 |  |  |  |  |  |  |  |  |
    +---+---+---+---+---+---+---+---+
  4 |  |  |  |  | P |  |  |  |
    +---+---+---+---+---+---+---+---+
  3 |  |  |  |  | * |  |  |  |
    +---+---+---+---+---+---+---+---+
  2 | P | P | P | P |  | P | P | P |
    +---+---+---+---+---+---+---+---+
  1 | R | N | B | Q | K | B | N | R |
    +---+---+---+---+---+---+---+---+
      a  b  c  d  e  f  g  h
Search result: move = d7d5; nodes = 0, evaluations = 4074706, moves made = 45130
41, depth = 6, score = 0.85, time = 3.23s, knps = 0.00
    +---+---+---+---+---+---+---+---+
  8 | r | n | b | q | k | b | n | r |
    +---+---+---+---+---+---+---+---+
  7 | p | p | p |  | p | p | p | p |
    +---+---+---+---+---+---+---+---+
  6 |  |  |  | * |  |  |  |  |
    +---+---+---+---+---+---+---+---+
  5 |  |  |  | p |  |  |  |  |
    +---+---+---+---+---+---+---+---+
  4 |  |  |  |  | P |  |  |  |
    +---+---+---+---+---+---+---+---+
  3 |  |  |  |  |  |  |  |  |
    +---+---+---+---+---+---+---+---+
  2 | P | P | P | P |  | P | P | P |
    +---+---+---+---+---+---+---+---+
  1 | R | N | B | Q | K | B | N | R |
    +---+---+---+---+---+---+---+---+
      a  b  c  d  e  f  g  h
CASTLE: 15
sc>


I hope you can see the difference and do not mind me asking and showing this!?
Thanks
smile

descriptionSecondChess EmptyRe: SecondChess

more_horiz
Permissions in this forum:
You cannot reply to topics in this forum