From: Takenobu Takizawa MSE WASEDA AC JP> Date: 6 nov 1999 Subject: 10th computer shogi championship Announcement of the 10th Computer Shogi Championship It is my pleasure to announce that the 10th Computer Shogi Championship will be held in Japan in March 2000. Takenobu Takizawa Chairman of the Executive Committee Vice-Chairman of the Computer Shogi Association (CSA) -------------------------------------------------------------------- The 10th Computer Shogi Championship Competition Dates: March 8-10, 2000 Competition Venue: Sheraton Grande Tokyo Bay Hotel 1-9 Maihama, Urayasu, Chiba 279-0031, Japan Phone: 047-355-5555 FAX: 047-355-5566 (+81-47-355-5555) (+81-47-355-5566) Registration Deadline: November 30, 1999 First Prize: a notebook computer Eligibility Open to anyone of any nationality. Only originally produced programs may be entered. The program should allow a move to be adjusted,in case of input error. (Extra time will be reimbursed.) Any computer may be used. Competitors are strongly urged to bring their own computer. CSA may provide an IBM compatible, but it may be a relatively slow machine. Operator: The operator should be one of the principal programmers of the entered program. If none of the programmers can come to the tournament, one proxy must be prepared by the entrant. The operator may recompile the program/modify parameters before starting each game. All games will be evenly played (hirate). Perpetual repetition: Draw, 1/2 win point (except perpetual check). 1st day through 2nd day: Preliminary Contest The top 3 of the last tournament will be exempted from these days and proceed directly to the Final. The Preliminary Contest is divided into two groups. The upper division will consist of 16 programs (first through 19th seeds excluding the three direct finalists). The lower division contest will be held on the 1st day. There will be 7 Swiss-style games. The top 8 programs will join the upper division contest. If the number of programs is odd, the CSA will add an extra program by invitation. The invited program will not proceed to the second day. The upper division contest will be held on the 2nd day. There will be 9 Swiss-style games. The top 5 programs will proceed to the third day of competition. If the number of programs is, by chance, odd, the CSA will add an extra program by invitation but the invited program will not proceed to the third day. The CSA reserves the right to alter the number of proceeding programs if the number of entrants is less than 28 or more than 54. 3rd day: The Final Round robin of 8 programs with each program playing each other once. Time Limits: To complete a game, each program is allowed 20 minutes in the lower division contest, 25 minutes in the upper division contest and 30 minutes in the final. If one side runs out of time before it wins or declares a win, then it loses the game. The program must measure the time spent on each move and display the total time spent. The minimum of the time spent on each move is one second, i.e. if the time spent on a move is one second or less, then the program must count it as one second. If the time spent on a move is more than one second, then the program may count in whole seconds, not counting any fractions. Handling (input move) time will be excepted in the case of a communication breakdown. Declaration of a win in case of Nyugyoku: In case of NYUGYOKU (JISHOGI), the CSA applies the following declaration rule: The program may declare WIN (send %KACHI if communication available) if the following conditions are satisfied. If one of the conditions is not satisfied, the declaring side loses. (1) The King of the declaring side is in the third rank or beyond. (2) The declaring side has 28 (the first player (sente, black)) or 27 (the second player (gote, white)) piece points or more. Piece points are counted only for pieces of the declaring side that are in hand or in the third rank or beyond. Piece points are counted as follows: King:0; Rook, Bishop, Promoted Rook or Promoted Bishop:5; Other:1. (3) The declaring side has 10 or more pieces other than the King in the third rank or beyond. (4) There is no check on the King of the declaring side. (5) The declaring side has at least one second left. Outcome of Game: The outcome of a game will be determined by the following rules in the order given: 1) the time limit has been exceeded 2) the usual shogi rules (except JISHOGI) 3) declaration of a win (by the computer) Tournament Results: Tournament results will be determined by the following rules in the order given: 1) number of wins 2) sum of all opponents' scores 3) sum of defeated opponents' scores 4) sum of defeated opponents' scores without top and bottom 5) results of head-to-head competition 6) order in the last tournament (top 3) or preliminary contest draw: 1/2 point Game Records: Each player must provide a record at the end of each game. The format is free. The CSA reserves the right to freely publish or otherwise use all game records. Communication Each player must prepare communication ability. If the program itself is not able to do this, the operator may use a proxy program running on the same computer or another NOTEBOOK computer. Appeals The tournament version of the set of the object program (exe), data and so on to enable a replay of the games in the tournament must be kept for one year (until the last day of the tournament in the following year) by the programmer. If the program etc was varied within the tournament, at least one version of the set must be kept. The CSA may accept the appeal if it is legitimate; the programmer will be required to show the set. A limited committee will examine the set. If the set is not shown, the CSA may remove the award/ restrict entry in following tournaments. Appeals must be made within six months from the last day of the tournament. Communication Protocol ( CSA Format 1998 ) (1) Command (a) Move: Turn:: Sente(Black) for "+" , Gote(White) for "-" Source Square:: x y coordinate Destination Square:: x y coordinate Piece Name after move:: Before promotion After promotion Fu(Pawn): FU TO Kyo(Lance): KY NY Keima(Knight): KE NK Gin(Silver): GI NG Kin(Gold): KI Kaku(Bishop): KA UM Hisha(Rook): HI RY Ou(King): OU Note: Top Right square coordinate is (1,1) Bottom Left square coordinate is (9,9) Source square for dropping move is 00 Promotion is specified by the name of the piece after promotion Example: +7776FU Black moves Pawn from (7,7) to (7,6) -0034KA White drops Bishop to (3,4) +2423TO Black moves Pawn from (2,4) to (2,3) and promotes (b) Special command ( do not prefix + nor - ) Resign : %TORYO Take Back: %MATTA Interruption: %CHUDAN Repetition: %SENNICHITE Draw: %JISHOGI Declaring a win after the king has entered the opponent's camp: %KACHI Declaring a draw after the king has entered the opponent's camp: %HIKIWAKE For (a) and (b), attach a line feed LF(0x0a) character at the end of the move and command string A Take-Back command can be only be issued by the communication program being used by the operator of a shogi program without communication capability. If the operator makes a mistake entering a move in the communication program, the operator should wait before issuing the Take-Back command until the operator side gets his/her turn. If a shogi-program receives a Take-Back command, it must retract to the position of two moves earlier. Draw, Declare-Win, and Declare-Draw are defined by the tournament rules. (2) Communication Conditions We use an RS232C communication line between the two computers. Baud rate: 1200 BPS Data length: 8 bit Parity: No Stop Bit: 1 bit X-flow-control: ON (3) Connector and Cable Computer's Connector: D-Sub 9 pins male connector Cable's Connector: D-sub 9 pins female connector Cable: Reverse cable For computers without a D-Sub 9 pins male connector, the operator can use the converting connector to comply with the standard. A cable with converting connector can be used if necessary. (4) At the start: Confirm that the opponent is ready to receive a move. The program with black's turn will start. (5) At the end: (a) Resignation The game will end by the sending of a resign command. When a program decides to resign, it will send the resign command(%TORYO). When a program checkmates an opponent, the program should wait until it receives a resign command from the opponent. The game will continue until the receipt of a resign command. (b) Repetition A program can issue the repetition command(%SENNICHITE) on its turn when it has detected that the current position is a repeated position and the game will end. Although a program can detect a repeated position after making a move by itself, it should wait for the repetition command from the opponent (it should not interrupt the game by itself). Upon receipt of a repetition command, the game will end. In either case, the program is required to have the capability to restart the game from that position. (c) Draw When a program has determined that the position is drawn, it should send the draw(%JISHOGI) command and end the game. (A draw is determined by the tournament rules.) (d) Interruption During the receiving state, programs must be capable of being interrupted by a human operation. If such an operation is performed by a human, it should carry out the same process as if it had received an interruption command from its opponent. (6) Restarting( desirable capabilities ) Ideally, a program will have the capability of restarting from an interrupted position. If the number of moves played by the two playing programs is different, the operator of the program that has played more moves will retract to the opponent's position so that both programs will have the same position. The time also will be retracted accordingly. (a) For programs with communication capability The program not having a turn will be put into the receiving state. The program having a turn will be put into the thinking state. (b) For programs without communication capability The program not having a turn will be put into the waiting state for its opponent's move. The program having a turn will be put into the thinking state. (7) In case of trouble In case of receiving illegal moves or an unknown string, the program should display the receiving string on the screen and perform the interrupt process. (8) ETC When two programs are playing directly using a communication protocol, neither program is allowed to issue or accept the Take-Back and Interrupt commands. ====================================================================== With the permission of Mr. Yoshimura, here are the source codes for a communication program for an IBM compatible. ====================================================================== The following are the source codes using 32-bit API for communication programming in a Windows environment. It has been tested successfully with Morita-Shogi, Kanazawa-Shogi and Kakinoki-Shogi, but I cannot guarantee that the codes are free of bugs. You can use the codes in your program, but it is your responsibility to make your own communication routines. If you use the VC++ version 4.X, delete the following line in the file StdAFx.h: #define VC_EXTRALEAN ====================================================================== static HANDLE hCom; int RS_init( ) /* Initialize Communication port */ { DCB dcb ; COMMTIMEOUTS CommTimeOuts ; if ( ( hCom = CreateFile ( "COM1", /* Open file name as "COM1" */ GENERIC_READ | GENERIC_WRITE, /* Open file for read and write */ 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ) ) == INVALID_HANDLE_VALUE ) { return 1; // error } CommTimeOuts.ReadIntervalTimeout = MAXDWORD; CommTimeOuts.ReadTotalTimeoutMultiplier = 0; CommTimeOuts.ReadTotalTimeoutConstant = 1000; CommTimeOuts.WriteTotalTimeoutMultiplier = 0; CommTimeOuts.WriteTotalTimeoutConstant = 1000; if ( !SetCommTimeouts( hCom, &CommTimeOuts )){ CloseHandle(hCom); return 2; // SetCommTimeouts error } dcb.DCBlength = sizeof ( DCB ) ; dcb.BaudRate = 1200 ; dcb.fBinary = TRUE ; dcb.fParity = 0; dcb.fOutxCtsFlow = 0; // CTS output flow control dcb.fOutxDsrFlow = 0; // DSR output flow control dcb.fDtrControl = 1; // DTR flow control type dcb.fDsrSensitivity = 0; // DSR sensitivity dcb.fTXContinueOnXoff = 0; // XOFF continues Tx dcb.fOutX = 1; // XON/XOFF output flow control dcb.fInX = 1; // XON/XOFF input flow control dcb.fErrorChar = 0; // enable error replacement dcb.fNull = 0; // enable null stripping dcb.fRtsControl = 1; // RTS flow control dcb.fAbortOnError = 0; // abort reads/writes on error dcb.XonLim = 2048; // transmit XON threshold dcb.XoffLim = 512; // transmit XOFF threshold dcb.ByteSize = 8; // number of bits/byte, 4-8 dcb.Parity = NOPARITY; // 0-4=no,odd,even,mark,space dcb.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2 dcb.XonChar = 17; // Tx and Rx XON character dcb.XoffChar = 19; // Tx and Rx XOFF character dcb.ErrorChar = 0; // error replacement character dcb.EofChar = 0; // end of input character dcb.EvtChar = 0; // received event character if ( !SetCommState( hCom, &dcb ) ){ CloseHandle(hCom); return 3;//SetCommState error } return(0); } void RS_close () /* Close Communication port */ { CloseHandle( hCom ); } /* Read one character when it reads a character, it returns 1 when there is no character to read, it returns 0 */ int RS_read(unsigned char *c) { DWORD length; if( !ReadFile(hCom, c, 1, &length, NULL) ) return 0; return length; } /* Send a character */ void RS_send(unsigned char c) { DWORD length; WriteFile(hCom, &c, 1, &length, NULL); } ====================================================================== With the permission of Mr. Kakinoki, here are the source codes for a communication program for a Macintosh. ====================================================================== The following are the source codes for communication programming for a Macintosh. You can use the codes in your program, but it is your responsibility to make your own communication routines. I cannot guarantee that the codes are free of bugs. ====================================================================== #include byte com_speed = 1, com_bit = 1, com_parity, com_x, com_stop; short RsPort; // 0:Modem, 1:Printer static short in, out; static short com_speeds[5] = {baud300, baud1200, baud2400, baud4800, baud9600}; static short com_bits[2] = {data7, data8}; static short com_paritys[3] = {noParity, oddParity, evenParity}; static short com_stops[3] = {stop10, stop15, stop20}; /*============================== return 0: OK -1: error ==============================*/ int openRS(void) { SerShk shk; OSErr err; short conf = com_speeds[com_speed] + com_stops[com_stop] + com_paritys[com_parity] + com_bits[com_bit]; shk.fXOn = 0; shk.fCTS = 1; shk.xOn = 0x13; shk.xOff = 0x11; shk.errs = parityErr + hwOverrunErr + framingErr; shk.evts = ctsEvent; shk.fInX = 0; if (RsPort) // printer port / KEYSPAN USB-SERIAL ADAPTER { err = OpenDriver("\p.BIn", &in); if (err != noErr) return -1; err = OpenDriver("\p.BOut", &out); } else // modem port { err = OpenDriver("\p.AIn", &in); if (err != noErr) return -1; err = OpenDriver("\p.AOut", &out); } if (err != noErr) return -1; err = SerReset(in, conf); if (err != noErr) return -1; err = SerReset(out, conf); if (err != noErr) return -1; err = SerHShake(in, &shk); if (err != noErr) return -1; err = SerHShake(out, &shk); if (err != noErr) return -1; return 0; } void closeRS(void) { CloseDriver(in); CloseDriver(out); } /*====================== readRS read 1byte return N: OK -1: error -2: break ======================*/ static short readRS(long *len, char *buf) { SerStaRec st; short err, ref; SerStatus(in, &st); if (st.cumErrs) { *len = 0L; return -1; } for (;;) { if ((err = SerGetBuf(in, len)) != noErr) return -1; if (*len) { FSRead(in, len, buf); return *len; } if (break_check()) // operator's break function return -2; } return 0; } /*====================== return 0: OK != 0: error ======================*/ static short writeRS(long *len, char *buf) { SerStaRec st; short err; SerStatus(out, &st); if (st.cumErrs || st.wrPend || st.ctsHold) return -1; return FSWrite(out, len, buf); } /*============*/ /*====================== return 0: OK != 0: error ======================*/ static int puts_rs(char *s) { int r; long len; len = strlen(s); r = writeRS(&len, s); return r; } /*====================== return >0: char -1: error -2: break ======================*/ static int get_rs(void) { long len = 1; char buf[256]; int r; r = readRS(&len, buf); if (r < 0) return r; else return buf[0]; } ====================================================================== ---------------------------------------------------------------------------- The 10th Computer Shogi Championship: Application Form 1. Your Name (or Team Name) 2. Address 3. Telephone No. 4. E-mail Address 5. Computer (CPU, Clock) 6. Name of the Computer Program 7. Programming Language 8. Communication Availability ---------------------------------------------------------------------------- Application Fee: 10,000 yen Please transfer the fee to the following bank account by cable: Dai-ichi Kangyo Bank, Machida Branch, Tokyo, Japan Ordinary Account No. 2117839 Account Holder: The Computer Shogi Association Payment in cash will also be accepted at the tournament. Tournament Referees: There will be a number of referees managing the tournament. The Rules and Regulations of the Computer Shogi Championship are available in both Japanese and English. In all questions of interpretation, tha Japanese version shall be regarded as authoritative. Takenobu Takizawa