CRS(计算机五子棋服务器)开通了

elife 2008-03-30 10:05:44
CRS(Computer Renju Server)是专供五子棋程序对战交流,获取等级分的服务器. 只要程序支持Go Text Protocol (GTP)的以下四条命令即可接入:

boardsize
clear_board
play
genmove

为方便大家, 我们也提供了参考实现(含源码), 程序只要实现以下函数即可

extern const char * NAME_STRING; //engine name
extern const char * VERSION_STRING; //engine version

void init_engine(int argc, char *argv[]); //be called once when program start
void set_boardsize(int boardsize); //be called once when each game start
void clear_board(void); //be called once when each game start, be called after set_boardsize
void play_move(int i, int j, int color); //i=[0..boardsize-1], j=[0..boardsize-1], color={GTP_BLACK, GTP_WHITE}
void generate_move(int *i, int *j, int color); //

具体请参考CRS

Enjoy it!
...全文
109 4 打赏 收藏 举报
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
不会,帮顶
  • 打赏
  • 举报
回复
UltraBejing 2008-05-01
有问题请先GOOGLE,BAIDU
  • 打赏
  • 举报
回复
elife 2008-04-01
  • 打赏
  • 举报
回复
elife 2008-03-31
目前已有RenjuSolver等顶级程序在上面对战了!
  • 打赏
  • 举报
回复
相关推荐
解决cocos2d-x中文显示问题 /* Copyright (C) 1999-2003, 2005-2006, 2008-2011 Free Software Foundation, Inc. This file is part of the GNU LIBICONV Library. The GNU LIBICONV Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU LIBICONV Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU LIBICONV Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* When installed, this file is called "iconv.h". */ #ifndef _LIBICONV_H #define _LIBICONV_H #define _LIBICONV_VERSION 0x010E /* version number: (major<<8) + minor */ extern @DLL_VARIABLE@ int _libiconv_version; /* Likewise */ /* We would like to #include any system header file which could define iconv_t, 1. in order to eliminate the risk that the user gets compilation errors because some other system header file includes /usr/include/iconv.h which defines iconv_t or declares iconv after this file, 2. when compiling for LIBICONV_PLUG, we need the proper iconv_t type in order to produce binary compatible code. But gcc's #include_next is not portable. Thus, once libiconv's iconv.h has been installed in /usr/local/include, there is no way any more to include the original /usr/include/iconv.h. We simply have to get away without it. Ad 1. The risk that a system header file does #include "iconv.h" or #include_next "iconv.h" is small. They all do #include . Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It has to be a scalar type because (iconv_t)(-1) is a possible return value from iconv_open().) */ /* Define iconv_t ourselves. */ #undef iconv_t #define iconv_t libiconv_t typedef void* iconv_t; /* Get size_t declaration. Get wchar_t declaration if it exists. */ #include /* Get errno declaration and values. */ #include /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, have EILSEQ in a different header. On these systems, define EILSEQ ourselves. */ #ifndef EILSEQ #define EILSEQ @EILSEQ@ #endif #ifdef __cplusplus extern "C" { #endif /* Allocates descriptor for code conversion from encoding ‘fromcode’ to encoding ‘tocode’. */ #ifndef LIBICONV_PLUG #define iconv_open libiconv_open #endif extern iconv_t iconv_open (const char* tocode, const char* fromcode); /* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at ‘*outbuf’. Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount. Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */ #ifndef LIBICONV_PLUG #define iconv libiconv #endif extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); /* Frees resources allocated for conversion descriptor ‘cd’. */ #ifndef LIBICONV_PLUG #define iconv_close libiconv_close #endif extern int iconv_close (iconv_t cd); #ifdef __cplusplus } #endif #ifndef LIBICONV_PLUG /* Nonstandard extensions. */ #if @USE_MBSTATE_T@ #if @BROKEN_WCHAR_H@ /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be included before . */ #include #include #include #endif #include #endif #ifdef __cplusplus extern "C" { #endif /* A type that holds all memory needed by a conversion descriptor. A pointer to such an object can be used as an iconv_t. */ typedef struct { void* dummy1[28]; #if @USE_MBSTATE_T@ mbstate_t dummy2; #endif } iconv_allocation_t; /* Allocates descriptor for code conversion from encoding ‘fromcode’ to encoding ‘tocode’ into preallocated memory. Returns an error indicator (0 or -1 with errno set). */ #define iconv_open_into libiconv_open_into extern int iconv_open_into (const char* tocode, const char* fromcode, iconv_allocation_t* resultp); /* Control of attributes. */ #define iconvctl libiconvctl extern int iconvctl (iconv_t cd, int request, void* argument); /* Hook performed after every successful conversion of a Unicode character. */ typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data); /* Hook performed after every successful conversion of a wide character. */ typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data); /* Set of hooks. */ struct iconv_hooks { iconv_unicode_char_hook uc_hook; iconv_wide_char_hook wc_hook; void* data; }; /* Fallback function. Invoked when a small number of bytes could not be converted to a Unicode character. This function should process all bytes from inbuf and may produce replacement Unicode characters by calling the write_replacement callback repeatedly. */ typedef void (*iconv_unicode_mb_to_uc_fallback) (const char* inbuf, size_t inbufsize, void (*write_replacement) (const unsigned int *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); /* Fallback function. Invoked when a Unicode character could not be converted to the target encoding. This function should process the character and may produce replacement bytes (in the target encoding) by calling the write_replacement callback repeatedly. */ typedef void (*iconv_unicode_uc_to_mb_fallback) (unsigned int code, void (*write_replacement) (const char *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); #if @HAVE_WCHAR_T@ /* Fallback function. Invoked when a number of bytes could not be converted to a wide character. This function should process all bytes from inbuf and may produce replacement wide characters by calling the write_replacement callback repeatedly. */ typedef void (*iconv_wchar_mb_to_wc_fallback) (const char* inbuf, size_t inbufsize, void (*write_replacement) (const wchar_t *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); /* Fallback function. Invoked when a wide character could not be converted to the target encoding. This function should process the character and may produce replacement bytes (in the target encoding) by calling the write_replacement callback repeatedly. */ typedef void (*iconv_wchar_wc_to_mb_fallback) (wchar_t code, void (*write_replacement) (const char *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); #else /* If the wchar_t type does not exist, these two fallback functions are never invoked. Their argument list therefore does not matter. */ typedef void (*iconv_wchar_mb_to_wc_fallback) (); typedef void (*iconv_wchar_wc_to_mb_fallback) (); #endif /* Set of fallbacks. */ struct iconv_fallbacks { iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback; iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback; iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback; iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback; void* data; }; /* Requests for iconvctl. */ #define ICONV_TRIVIALP 0 /* int *argument */ #define ICONV_GET_TRANSLITERATE 1 /* int *argument */ #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ #define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */ #define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */ #define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */ #define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */ /* Listing of locale independent encodings. */ #define iconvlist libiconvlist extern void iconvlist (int (*do_one) (unsigned int namescount, const char * const * names, void* data), void* data); /* Canonicalize an encoding name. The result is either a canonical encoding name, or name itself. */ extern const char * iconv_canonicalize (const char * name); /* Support for relocatable packages. */ /* Sets the original and the current installation prefix of the package. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ extern void libiconv_set_relocation_prefix (const char *orig_prefix, const char *curr_prefix); #ifdef __cplusplus } #endif #endif #endif /* _LIBICONV_H */
2.4 贪吃蛇实验/*---------------------------------------------------------------- 320x240彩屏液晶驱动程序 ----------------------------------------------------------------*/ #include"9325tp.h" #include"reg52.h" /*---------------------------------------------------------------- 全局变量 ----------------------------------------------------------------*/ #define WINDOW_XADDR_START 0x0050 // Horizontal Start Address Set #define WINDOW_XADDR_END 0x0051 // Horizontal End Address Set #define WINDOW_YADDR_START 0x0052 // Vertical Start Address Set #define WINDOW_YADDR_END 0x0053 // Vertical End Address Set #define GRAM_XADDR 0x0020 // GRAM Horizontal Address Set #define GRAM_YADDR 0x0021 // GRAM Vertical Address Set #define GRAMWR 0x0022 // memory write #define DataPort P0 //数据口使用DataPort /*---------------------------------------------------------------- 定义硬件端口 ----------------------------------------------------------------*/ sbit CS=P2^2; //片选 sbit RES=P2^1; //复位 sbit RS=P2^4; //数据/命令选择 sbit RW=P2^5; /*---------------------------------------------------------------- 清屏函数 输入参数:bColor 清屏所使用的背景色 ----------------------------------------------------------------*/ void CLR_Screen(unsigned int bColor) { unsigned int i,j; LCD_SetPos(0,240,0,320);//320x240 for (i=0;i<320;i++) { for (j=0;j<240;j++) Write_Data_U16(bColor); } } /*---------------------------------------------------------------- 显示英文字符 输入参数:x 横坐标 y 纵坐标 c 需要显示的字符 fColor 字符颜色 bColor 字符背景颜色 ----------------------------------------------------------------*/ #include "8X16.h" void LCD_PutChar8x16(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor) { unsigned int i,j; LCD_SetPos(x,x+8-1,y,y+16-1); for(i=0; i<16;i++) { unsigned char m=Font8x16[c*16+i]; for(j=0;j<8;j++) { if((m&0x80)==0x80) { Write_Data_U16(fColor); } else { Write_Data_U16(bColor); } m<<=1; } } } /*---------------------------------------------------------------- 显示英文字符 输入参数:x 横坐标 y 纵坐标 c 需要显示的字符 fColor 字符颜色 bColor 字符背景颜色 ----------------------------------------------------------------*/ void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor) { LCD_PutChar8x16( x, y, c, fColor, bColor ); } /*---------------------------------------------------------------- 显示汉字 输入参数:x 横坐标 y 纵坐标 c 需要显示的汉字码 fColor 字符颜色 bColor 字符背景颜色 ----------------------------------------------------------------*/ #include "GB1616.h" //16*16汉字字模 void PutGB1616(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int bColor){ unsigned int i,j,k; LCD_SetPos(x, x+16-1,y, y+16-1); for (k=0;k<64;k++) { //64标示自建汉字库中的个数,循环查询内码 if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1])){ for(i=0;i<32;i++) { unsigned short m=codeGB_16[k].Msk[i]; for(j=0;j<8;j++) { if((m&0x80)==0x80) { Write_Data_U16(fColor); } else { Write_Data_U16(bColor); } m<<=1; } } } } } /*---------------------------------------------------------------- 显示字符串 可以中英文同时显示 输入参数:x 横坐标 y 纵坐标 *s 需要显示的字符串 fColor 字符颜色 bColor 字符背景颜色 ----------------------------------------------------------------*/ void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor) { unsigned char l=0; while(*s) { if( *s < 0x80) { LCD_PutChar(x+l*8,y,*s,fColor,bColor); s++;l++; } else { PutGB1616(x+l*8,y,(unsigned char*)s,fColor,bColor); s+=2;l+=2; } } } /*---------------------------------------------------------------- 显示RGB颜色 输入参数:x0,y0 起始坐标 x1,y1 结束坐标 Color 背景颜色 ----------------------------------------------------------------*/ /*void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color) { unsigned int i,j; LCD_SetPos(x0,x1,y0,y1); for (i=y0;i<=y1;i++) { for (j=x0;j<=x1;j++) Write_Data_U16(Color); } } */ /*---------------------------------------------------------------- 显示图片 图片必须是320x240,否则不能正确识别 ----------------------------------------------------------------*/ /*void show_photo(void) { unsigned char j; unsigned int i; unsigned long s=0; LCD_SetPos(0,240,0,320);//320x240 for (i=0;i<75;i++) { for (j=0;j<240;j++) Write_Data(0xff,0xff); } for (i=0;i<170;i++) { for (j=0;j<55;j++) Write_Data(0xff,0xff); for (j=0;j<130;j++) Write_Data(pic[s++],pic[s++]); for (j=0;j<55;j++) Write_Data(0xff,0xff); } for (i=0;i<75;i++) { for (j=0;j<240;j++) Write_Data(0xff,0xff); } } */ /*---------------------------------------------------------------- 写命令、写数据 输入参数:x 需要输入的命令 16位 y 需要输入的数据 16位 ----------------------------------------------------------------*/ void Write_Cmd_Data (unsigned char x,unsigned int y) { unsigned char m,n; m=y>>8; n=y; Write_Cmd(0x00,x); Write_Data(m,n); } /*---------------------------------------------------------------- 写16位数据 ----------------------------------------------------------------*/ void Write_Data_U16(unsigned int y) { unsigned char m,n; m=y>>8; n=y; Write_Data(m,n); } /*---------------------------------------------------------------- 写命令 ----------------------------------------------------------------*/ void Write_Cmd(unsigned char DH,unsigned char DL) { CS=0; RS=0; DataPort=DH; RW=0; RW=1; DataPort=DL; RW=0; RW=1; CS=1; } /*---------------------------------------------------------------- 写数据 双8位 ----------------------------------------------------------------*/ void Write_Data(unsigned char DH,unsigned char DL) { CS=0; RS=1; DataPort=DH; RW=0; RW=1; DataPort=DL; RW=0; RW=1; CS=1; } /*---------------------------------------------------------------- 延时函数 ----------------------------------------------------------------*/ void delayms(unsigned int count) { int i,j; for(i=0;i 0) incx = 1; else if(dx == 0) incx = 0; else incx = -1; if(dy > 0) incy = 1; else if(dy == 0) incy = 0; else incy = -1; dx = ((X0>X1) ? (X0-X1) : (X1-X0)); dy = ((Y0>Y1) ? (Y0-Y1) : (Y1-Y0)); if(dx>dy) distance=dx; else distance=dy; PointX = X0; PointY = Y0; for(i=0;i<=distance+1;i++) { Put_pixel(PointX,PointY,color); xerr+=dx; yerr+=dy; if(xerr>distance) { xerr-=distance; PointX+=incx; } if(yerr>distance) { yerr-=distance; PointY+=incy; } } } /*--------------------------------------------------------------------------- 绘制矩形框 输入参数:矩形的起始位置left,top 矩形的结束位置right,bottom 矩形框的颜色color -----------------------------------------------------------------------------*/ void Rectangle( uchar left, uchar top, uchar right, uchar bottom, unsigned int color) { Line(left,top,right,top,color); Line(left,top,left,bottom,color); Line(right,top,right,bottom,color); Line(left,bottom,right,bottom,color); } /*--------------------------------------------------------------------------- 绘制平面矩形 输入参数:矩形的起始位置left,top 矩形的结束位置right,bottom 矩形框的颜色color -----------------------------------------------------------------------------*/ void Bar( uchar left, uchar top, uchar right, uchar bottom, unsigned int color) { uchar i = 0,k = 0; for(k = top;k < bottom;k++) { for(i = left+1;i <= right;i++) { LCD_SetPos(i,i,k,k); Write_Data_U16(color); } } } /*--------------------------------------------------------------------------- 向LCD发送一个0--255的数值 -----------------------------------------------------------------------------*/ void LCDShow_uCharNumber( uchar x, uchar y, uchar uCharNumber, unsigned int forecolor, unsigned int bkcolor) { LCD_PutChar(x,y,uCharNumber/100+'0',forecolor,bkcolor); LCD_PutChar(x+8,y,uCharNumber/10+'0',forecolor,bkcolor); LCD_PutChar(x+16,y,uCharNumber+'0',forecolor,bkcolor); }
发帖
游戏开发

8161

社区成员

游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
帖子事件
创建了帖子
2008-03-30 10:05
社区公告
暂无公告