예제 #1
0
void onChessPlay(char cb[][MAX_COLUMN],int row,int column,
				 ChessType color,
				 ChessStep *steplog,
				 Edge *edge,
				 const int count_trun,const int count_game,
				 void *extra)
{
	if(playmode==1)//霞編庁塀
	{
		if(color_player==color)
		{
			USER_GO(color);
		}
		else 
		{
			if(count_trun==1 && color==black)
			{
				PlaceChess(cb,7,7,black,steplog);
			}
			else
			{
				StepNode tstep;
				srand(time(0));
				int p=rand()%100;
				if((p<50 && ai_mode==3) || ai_mode==1)
				{
					tstep=Ai_kuon_play(cb,row,column,edge,color);
					DISPLAY_TITLE("クオン",color);
				}
				if((p>=50 && ai_mode==3 || ai_mode==2))
				{
					tstep=Ai_hitagi_play(cb,row,column,*edge,color,(struct hitagi_ann_data *)extra);
					DISPLAY_TITLE("ひたぎ",color);
				}
				PlaceChess(cb,tstep.x,tstep.y,color,steplog);
			}
			DISPLAY_CHESSBOARD()
		}
	}
	else if(playmode==2)//儺膳庁塀
예제 #2
0
void Trial(int i) {
    // 进入本函数时,在SCALE×SCALE棋盘前的i-1行已放置了互不攻击的i-1个棋子
    // 现从第i行起继续为后续棋子选择合适的位置
    // 当i>n时,秋的一个合法布局,输出之
    int j;
    if(i>=SCALE) {
        printf("No. %d\n",count);
        PrintBoard();
        count++;
    }
    else for(j=0; j<SCALE; j++) {
            PlaceChess(i,j);
            if(TRUE==IsValidLayout())
                Trial(i+1);
            RemoveChess(i,j);
        }
}