int main()
{
    int i,j;
    for (i=1;i<=8;i++)
        scanf("%s",mp[i]+1);
    while (!determine())
    {
        for (i=2;i<=8;i++)
            for (j=1;j<=8;j++)
                if (mp[i][j]=='W'&&mp[i-1][j]!='B')
                {
                    mp[i-1][j]='W';
                    mp[i][j]='.';
                }
        if (determine())
            break;
        for (i=7;i>=1;i--)
            for (j=1;j<=8;j++)
                if (mp[i][j]=='B'&&mp[i+1][j]!='W')
                {
                    mp[i+1][j]='B';
                    mp[i][j]='.';
                }
    }
    printf("%c",determine());
    return 0;
}
int parse(FILE *f)
{
	char c;
	do
	{
		fscanf(f, "%c", &c);
	} while (!(determine(c) != 0) && (c != '\0') && !(feof(f)));
	return (determine(c));
};
Exemple #3
0
void fun(){
    int click;
    int pos;
    scanf("%d", &click);
    while(click --){
		determine();
	}
}
Exemple #4
0
/** Create image from LUT.
 * Create image from LUT, useful for debugging and analysing.
 * This method produces a representation of the given level
 * (Y range with 0 <= level < depth) for visual inspection of the colormap.
 * The dimensions of the resulting image are 512x512 pixels. It uses standard strong
 * colors for the different standard color classes. C_UNKNOWN is grey, C_BACKGROUND
 * is black (like C_BLACK).
 * If the standard method does not suit your needs you can override this method.
 * @param yuv422_planar_buffer contains the image upon return, must be initialized
 * with the appropriate memory size before calling, dimensions are 512x512 pixels.
 * @param level the level to draw, it's a range in the Y direction and is in the
 * range 0 <= level < depth.
 */
void
Colormap::to_image(unsigned char *yuv422_planar_buffer, unsigned int level)
{
  unsigned int iwidth  = image_width()  / 2;
  unsigned int iheight = image_height() / 2;

  unsigned int lwidth  = width();
  unsigned int lheight = height();

  unsigned int pixel_per_step = iheight / lheight;
  unsigned int lines_per_step = iwidth  / lwidth;

  unsigned char *yp = yuv422_planar_buffer;
  unsigned char *up = YUV422_PLANAR_U_PLANE(yuv422_planar_buffer, iwidth * 2, iheight * 2);
  unsigned char *vp = YUV422_PLANAR_V_PLANE(yuv422_planar_buffer, iwidth * 2, iheight * 2);

  unsigned int y = level * deepness() / depth();

  YUV_t c;
  for (unsigned int v = lwidth; v > 0 ; --v) {
    unsigned int v_index = (v - 1) * deepness() / lwidth;
    for (unsigned int u = 0; u < lheight; ++u) {
      unsigned int u_index = u * deepness() / lheight;
      c = ColorObjectMap::get_color(determine(y, u_index, v_index));

      for (unsigned int p = 0; p < pixel_per_step; ++p) {
	*yp++ = c.Y;
	*yp++ = c.Y;
	*up++ = c.U;
	*vp++ = c.V;
      }
    }
    // Double line
    unsigned int lines = (2 * (lines_per_step - 1)) + 1;
    memcpy(yp, (yp - iwidth * 2), (iwidth * 2) * lines);
    yp += (iwidth * 2) * lines;
    memcpy(up, (up - iwidth), iwidth * lines);
    memcpy(vp, (vp - iwidth), iwidth * lines);
    up += iwidth * lines;
    vp += iwidth * lines;
  }
}
Exemple #5
0
int Gaming(){
	int i, j, k, flag;
	stopcheck = 0;
	bla = whi = 2;
	printScore();
	while(CheckWin()){
		if(leftPress() != 1){
			getMousePosition(&mx,&my);
			if(mousex != mx||mousey != my){
				putimage(mousex,mousey,imagep,XOR_PUT);
				mousex = mx; mousey = my;
				putimage(mousex,mousey,imagep,XOR_PUT);
			}
		}
		else if(mouseLeftFlag == 1)			/*得到点击的位置*/
		{
			mouseLeftFlag = 0;
			getMousePosition(&mx,&my);
			for(i = 1; i < 9; i++){
				for(j = 1; j < 9; j++){
					if((mx > STARTX + SIDELENGTH * j && mx < STARTX + SIDELENGTH * (j+1)) && (my > STARTY + SIDELENGTH * i && my < STARTY + SIDELENGTH * (i+1))){
						break;
					}
				}
				if((mx > STARTX + SIDELENGTH * j && mx < STARTX + SIDELENGTH * (j+1)) && (my > STARTY + SIDELENGTH * i && my < STARTY + SIDELENGTH * (i+1))){
						break;
				}
			}
			if(color[i][j] == EMPTY){
				color[i][j] = colornow;
				inow = i; jnow = j; 
				if(change(i,j) == 1){
					if(BLA == colornow){
						ChessBlaSound();
						colornow = WHI;
					}
					else{
						ChessWhiSound();
						colornow = BLA;
					}
				}
				else{
					WarningSound();
					color[i][j] = EMPTY;
				}
			}
			cleardevice();
			drawTable();
			flag = bla = whi = count = 0;
			for(i = 1; i < 9; i++){
				for(j = 1; j < 9; j++){
					if(color[i][j] == BLA){
						bla++;
						count++;
					}else if(color[i][j] == WHI){
						whi++;
						count++;
					}else if(color[i][j] == EMPTY){
						color[i][j] = colornow;
						if(determine(i,j) == 1)
							flag = 1;
						color[i][j] = EMPTY;
					}
					drawChessman(i,j,color[i][j]);
				}
			}
			if(color[inow][jnow] != EMPTY)
				drawChessnow();
			if(flag == 0){
				if(BLA == colornow)
					colornow = WHI;
				else
					colornow = BLA;
				for(i = 1; i < 9; i++){
					for(j = 1; j < 9; j++){
						if(color[i][j] == EMPTY){
							color[i][j] = colornow;
							if(determine(i,j) == 1)
								flag = 1;
							color[i][j] = EMPTY;
						}
					}
				}
				if(flag == 0)
					stopcheck = 1;
			}
			printScore();
		}
	}
	return 1;
}
Exemple #6
0
void GamePlay::finalCards()
{
	//CHANGE ME
	PlayerHandValue = 0;
	listOfComputerPlayers[0].CpuHandValue = 0;
	showComputer = true;
	shows = true;

	system("cls");
	if (tablehand.size() < 4)
	{

		tablehand = hands.dealCards(deck, tablehand, 2);
	}
	if (tablehand.size() < 5)
	{

		tablehand = hands.dealCards(deck, tablehand, 1);
	}
	Cards();
	getValues();
	
	if (playerFold == true)
	{
		PlayerHandValue = 0;
	}
	for (size_t i = 0; i < listOfComputerPlayers.size(); i++)
	{

			listOfComputerPlayers[i].computerHandText = checks.handText(listOfComputerPlayers[i].CpuHandValue);
		
	}

	determine();

	uiText();

	if (listOfComputerPlayers.size() == 1)
	{
		drawcard.createhand(hand, 25, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 24, 3);
	}
	if (listOfComputerPlayers.size() == 2)
	{
		drawcard.createhand(hand, 25, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3);
		drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3);
	}
	if (listOfComputerPlayers.size() == 3)
	{
		drawcard.createhand(hand, 1, 40);
		drawcard.createhand(tablehand, 5, 20);
		drawcard.createhand(listOfComputerPlayers[0].cpuhand, 1, 3);
		drawcard.createhand(listOfComputerPlayers[1].cpuhand, 60, 3);
		drawcard.createhand(listOfComputerPlayers[2].cpuhand, 60, 40);
	}


	cin.get();


	gameoverCheck();

	Clear();
	system("cls");
	Flop();
}