当前位置: 首页>>代码示例>>C++>>正文


C++ Display::cls方法代码示例

本文整理汇总了C++中Display::cls方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::cls方法的具体用法?C++ Display::cls怎么用?C++ Display::cls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Display的用法示例。


在下文中一共展示了Display::cls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getIllegal

	bool Pieces::getIllegal()
	{
		Display screen;
		screen.menu();
		if(illegal)
			cout<< "You cannot move the piece like that, please move it again correctly ";
		Sleep(1800);
		screen.cls();
		return illegal;
	}
开发者ID:PhysicCoder,项目名称:MadChess,代码行数:10,代码来源:ChessPieces.cpp

示例2: action

	void Play::action()
	{
		stdOut = GetStdHandle(STD_OUTPUT_HANDLE); // to able to manipulate colors
		SetConsoleTextAttribute(stdOut, BACKGROUND_BLUE | BACKGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
		iR = 0;
		tempIC = 0;
		
		do
		{
			whoseMove.displayWhoseTurn();
			
			cout << ", select the piece you would like to move: "; // input the piece that you want to move
			cin >> tempIC >> iR;
			screen.cls();

			actionValidator();
			count++;
		}while(count < 5);//while game is not StaleMate or CheckMate or Retire
	}
开发者ID:PhysicCoder,项目名称:MadChess,代码行数:19,代码来源:gamePlay.cpp

示例3: actionValidator

	void Play::actionValidator()
	{
		 fC = 0; // edited
		 iC = 0; // edited
		 fR = 0; // added tempIC variables
		 tempFC = 0;
		 error = false;
		 //illegal = false;
		//-----------
		Pieces unit;
		//-----------
		//error = unit.illegal;

		//edited
		if(tempIC == 'a')
			iC = 1;
		if(tempIC == 'b')
			iC = 2;
		if(tempIC == 'c')
			iC = 3;
		if(tempIC == 'd')
			iC = 4;
		if(tempIC == 'e')
			iC = 5;
		if(tempIC == 'f')
			iC = 6;
		if(tempIC == 'g')
			iC = 7;
		if(tempIC == 'h')
			iC = 8;

		//if client has selected an empty square, prompt an error and retry
		if(cCB[iC][iR] == EMPTY)
		{
			cout << "It's an empty square, please select a correct position\n\n";
			error = true; //will activate RETRY process located at the end of actionValidator function
		}

		if(!error)
		{
			
			screen.menu();
			cout << "Select the destination                      : "; // input the tempIC where you want to put the selected piece
			cin >> tempFC >> fR;
			screen.cls();

			if(tempFC == 'a')
				fC = 1;
			if(tempFC == 'b')
				fC = 2;
			if(tempFC == 'c')
				fC = 3;
			if(tempFC == 'd')
				fC = 4;
			if(tempFC == 'e')
				fC = 5;
			if(tempFC == 'f')
				fC = 6;
			if(tempFC == 'g')
				fC = 7;
			if(tempFC == 'h')
				fC = 8;

			
			pieceValue = cCB[iC][iR];
			
			whoseMove.checkTurn(pieceValue, iC, iR, fC, fR);
			illegal = whoseMove.getIllegal();

//			if(whoseMove.whiteTurn)
			//unit.king(iC, iR, fC, fR);//validates the unit movement before moving it
			
			//ILLEGAL CHOICES
			//==============================
			//if the client has chosen empty square
			if(error)
			{
				action();//retry for client
			}
			//if the client movement fails to comply with rules
			//illegal = unit.illegalMove();
			if(illegal)
			{
				action();//retry for client
			}
			//==============================

			// Search Engine, moves the pieces (simpler
			int tempNum;
			for(int r = 1; r <= 8; r++)
			{
				for(int c = 1; c <=8; c++)
				{
					if(c == iC && r == iR)
					{
						tempNum = cCB[iC][iR];
						cCB[c][r] = EMPTY;
						cCB[fC][fR] = tempNum;
						//continue;
					}	
//.........这里部分代码省略.........
开发者ID:PhysicCoder,项目名称:MadChess,代码行数:101,代码来源:gamePlay.cpp


注:本文中的Display::cls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。