Programming chess engine
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: Programming chess engine
The header file conio.h is a non-standard header file.
However, it is not needed anyway. Just comment it out.
However, it is not needed anyway. Just comment it out.
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Just remove #include <conio.h> ?
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: Programming chess engine
Yes. Remove it. It isn't needed.
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
I get error message if I remove it and try to compile...
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: Programming chess engine
What error message do you get?
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Code: Select all
Documents/firstchess.c: In function ‘int Eval()’:
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
unsigned char value_piece[6] = {VALUE_PAWN, VALUE_KNIGHT, VALUE_BISHOP, VALUE_ROOK, VALUE_QUEEN, VALUE_KING};
^
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c: In function ‘void ComputerThink(unsigned char)’:
Documents/firstchess.c:616:48: warning: large integer implicitly truncated to unsigned type [-Woverflow]
score = Search(-MATE, MATE, max_depth, &mm3);
^
Documents/firstchess.c:616:48: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c: At global scope:
Documents/firstchess.c:661:23: error: ‘::main’ must return ‘int’
void main()
^
Documents/firstchess.c: In function ‘int main()’:
Documents/firstchess.c:687:30: error: too many arguments to function ‘int MakeMove()’
MakeMove(bestMove);
^
Documents/firstchess.c:497:13: note: declared here
static int MakeMove()
^
Documents/firstchess.c:697:30: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘char (*)[256]’ [-Wformat=]
sscanf (buf, "%s", &s);
^
Documents/firstchess.c:714:13: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
return;
^
-
- Posts: 616
- Joined: Thu May 19, 2011 1:35 am
Re: Programming chess engine
Change:
void main()
to:
int main(void)
void main()
to:
int main(void)
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Code: Select all
Documents/firstchess.c: In function ‘int Eval()’:
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
unsigned char value_piece[6] = {VALUE_PAWN, VALUE_KNIGHT, VALUE_BISHOP, VALUE_ROOK, VALUE_QUEEN, VALUE_KING};
^
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c:313:124: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c: In function ‘void ComputerThink(unsigned char)’:
Documents/firstchess.c:616:48: warning: large integer implicitly truncated to unsigned type [-Woverflow]
score = Search(-MATE, MATE, max_depth, &mm3);
^
Documents/firstchess.c:616:48: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Documents/firstchess.c: In function ‘int main()’:
Documents/firstchess.c:687:30: error: too many arguments to function ‘int MakeMove()’
MakeMove(bestMove);
^
Documents/firstchess.c:497:13: note: declared here
static int MakeMove()
^
Documents/firstchess.c:697:30: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘char (*)[256]’ [-Wformat=]
sscanf (buf, "%s", &s);
^
Documents/firstchess.c:714:13: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
return;
^
Re: Programming chess engine
I didn't remember firstchess to have these issues at compiling.
Maybe you can give a try to secondchess. It was my own project some years ago, and it's basically firstchess + castle + ep. So the code isn't much more complex than first chess:
https://github.com/emdio/secondchess
BTW in the repo there is a chart_functions.png image with the relations between the functions.
Hope this helps
Maybe you can give a try to secondchess. It was my own project some years ago, and it's basically firstchess + castle + ep. So the code isn't much more complex than first chess:
https://github.com/emdio/secondchess
BTW in the repo there is a chart_functions.png image with the relations between the functions.
Hope this helps
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Yes, now I have had more time to write code, I should put more time to it in the near future. I have finished my tictactoe, which can be found at https://github.com/matrix110/Tictactoe. No quality guarantees, I just tested that it compiles
I have to admit that I haven`t looked much into C programs because C and C++ are separate languages. Not much time to chessprogramming though. I know that the engine needs to be well planned, otherwisely can happen old-fashioned
I have to admit that I haven`t looked much into C programs because C and C++ are separate languages. Not much time to chessprogramming though. I know that the engine needs to be well planned, otherwisely can happen old-fashioned