Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What is Botvinnik's legacy to computer chess?

Author: James Robertson

Date: 13:00:39 02/21/00

Go up one level in this thread


On February 21, 2000 at 05:51:43, blass uri wrote:

>On February 20, 2000 at 20:11:45, Tom Kerrigan wrote:
>
>>On February 20, 2000 at 18:44:33, blass uri wrote:
>>
>>>On February 20, 2000 at 15:08:18, Tom Kerrigan wrote:
>>>
>>>>I wrote the first version of TSCP in about 4 hours.
>>>>
>>>>-Tom
>>>
>>>Some questions:
>>>
>>>1)Do you mean to say that this program could play chess after 4 hours and that
>>>there were no bugs like playing illegal moves?
>>
>>The first version was in its final form after 4 hours.
>>
>>>2)Did you copy part of it from previous work that you did on you more
>>>complicated chess program?
>>
>>No.
>>
>>>3)How much time did you use for fixing bugs?
>>
>>About one of the three hours.
>>
>>-Tom
>
>You are a good programmer.
>I decided to try to do a stupid C program that can play chess without copying
>from other people.
>
>I do not care about speed in this program and I only try to do a program that
>choose a random legal move and play it.
>
>After 1 hour I even did not start my move generator.
>James robertson claims that I only need to do a move generator but I do not
>agree.

Of course you would need another function (probably just main) to collect input.

>
>I need to use most of the time about the move generator but not only about it.
>
>I am not sure if I can do it in 24 hours when I do not include time of stopping
>to develop the program(Doing it in 24 hours without stopping is a bigger problem
>because I have to work about it when I am tired)
>
>
>I am not an experienced programmer and here is what I could do after 1 hour.
>I even did not start the move generator
>I do not use board[64] but board[8][8] because I think that it is more simple to
>generate moves in this case.
>
>Is there something that I do wrong?

I think you could improve the speed of development by taking uncessary
complexity. For instance, the most complicated part of your code is also
unecessary; instead of preparing the board with complicated potentially buggy
loops just:

int board[8][8] = {{10,8,9,11,12,9,8,10},
                   {7,7,7,7,7,7,7,7},
                   {0,0,0,0,0,0,0,0},
                   {0,0,0,0,0,0,0,0},
                   {0,0,0,0,0,0,0,0},
                   {0,0,0,0,0,0,0,0},
                   {1,1,1,1,1,1,1,1},
                   {4,2,3,5,6,3,2,4}};

or something similar.

James

>
>#include <stdio.h>
>
>void main(void)
>{
>int board[8][8];
>int side[8][8];
>int i;
>int j;
>int file;
>int rank;
>int player;
>int from;
>int to;
>int sidenow;
>#define pawn 1
>#define knight 2
>#define bishop 3
>#define rook 4
>#define queen 5
>#define king 6
>#define empty 0
>#define white 1
>#define black 2
>#define a 0
>#define b 1
>#define c 2
>#define d 3
>#define e 4
>#define f 5
>#define g 6
>#define h 7
>
>
>
>//init board
>  for (i=0;i<8;i++)
>  {
>    for (j=2;j<6;j++)
>	{
>      board[i][j]=empty;
>	  side[i][j]=empty;
>	}
>    board[i][1]=pawn;
>	board[i][6]=pawn;
>	side[i][1]=white;
>	side[i][6]=black;
>	side[i][0]=white;
>	side[i][7]=black;
>  }
>  board[0][0]=rook;
>  board[1][0]=knight;
>  board[2][0]=bishop;
>  board[3][0]=queen;
>  board[4][0]=king;
>  board[5][0]=bishop;
>  board[6][0]=knight;
>  board[7][0]=rook;
>  for (i=0;i<8;i++)
>	  board[i][7]=board[i][0];
>  sidenow=1;
>  printf("if you want to start to play print 1 otherwise print 2\n");
>  scanf("%d", &player);
>  while (sidenow==player)
>  {
>	from=0;
>    while (from==0)
>	{
>      printf("print the file you start with a-h\n");
>	  printf("print the rank you start with 1-8\n");
>	  scanf("%s",&file);
>	  scanf("%d",&rank);
>      i=file-97;
>
>
>      j=rank-1;
>      if (side[i][j]!=player)
>		  printf("wrong square\n");
>	  else
>	      from=1;
>	}
>	sidenow=3-sidenow;
>
>  }
>}
>
>
>Uri



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.