int Check()
{
	 if (CheckYear(year))
    	return CheckLegal();
    else
    {
    	leapYear[1] -= 1;
    	return CheckLegal();
    }
}
Beispiel #2
0
	Requirement::Requirement(const std::vector<int> &paravalues)
		:m_paravalues(paravalues)
	{
		HandleIllegal(CheckLegal());
	}
Beispiel #3
0
bool Sudoku::IsLegal()
{
    return CheckLegal(Grid);
}
	NeighborPlusCoverage::NeighborPlusCoverage(const std::vector<int> &paravalues,int strength,
											   const std::map<std::set<int>,int> subsets)
		:NeighborCoverage(paravalues,strength),m_subsets(subsets)
	{
		HandleIllegal(CheckLegal());
	}
void main()
{
	clrscr();
			 int pos;
			 char choice;
			 int legal;
			 
			 cout<<"Do You Want Me to Start?\nChoice(y/n):";					//Who plays the first move?
			 cin>>choice;

			 DisplayBoard(a);

			 switch(choice)
			 {

				case 'y':
					{

						while(move<5)			//First one to move would make a maximum of 5 moves
						{

								pos=MiniMax(a);
								a[pos]=2;
								DisplayBoard(a);
								
								if(CheckWin(a))
									{
										DisplayBoard(a);
										cout<<"\n\nYou lost!";
										delay(5000);
										break;
									}
								else if(CheckDraw(a))
									{
										DisplayBoard(a);
										cout<<"\n\nIts Draw!";
										delay(5000);
										break;
									}

								enterAgain1:
								cout<<"\n\nEnter position(0-8):";
								cin>>pos;
								legal=CheckLegal(a,pos);
								
								if(legal==0)
									{
										cout<<"\nInvalid Move!";
										goto enterAgain1;
									}
								a[pos]=1;

								DisplayBoard(a);
								
								if(CheckLose(a))
									{
										DisplayBoard(a);
										cout<<"\n\nYou won!";
										delay(5000);
										break;
									}
								else if(CheckDraw(a))
									{
										DisplayBoard(a);
										cout<<"\n\nIts Draw!";
										delay(5000);
										break;
									}
											
								move++;
						}

							break;
					}


				case 'n':
					{

						while(move<5)
						{

							DisplayBoard(a);

							enterAgain2:
							cout<<"\n\nEnter position(0-8):";
							cin>>pos;

							legal=CheckLegal(a,pos);
							if(legal==0)
							{
								cout<<"\nInvalid Move!";
								goto enterAgain2;
							}

							a[pos]=1;

							DisplayBoard(a);

							if(CheckLose(a))
							{
								DisplayBoard(a);
								cout<<"\n\nYou won!";
								delay(5000);
								break;
							}
							else if(CheckDraw(a))
							{
								DisplayBoard(a);
								cout<<"\n\nIts Draw!";
								delay(5000);
								break;
							}


							pos=MiniMax(a);
							a[pos]=2;
							cout<<"\n\t"<<pos;
							DisplayBoard(a);

							if(CheckWin(a))
							{
								DisplayBoard(a);
								cout<<"\n\nYou lost!";
								delay(5000);
								break;
							}
							else if(CheckDraw(a))
							{
								DisplayBoard(a);
								cout<<"\n\nIts Draw!";
								delay(5000);
								break;
							}

																													
							move++;
						}


						break;
					}
					
				default:
					{
						break;
					}

			 }


}
Beispiel #6
0
	NeighborCoverage::NeighborCoverage(const std::vector<int> &paravalues,int strength)
		:Requirement(paravalues),m_strength(strength)
	{
		HandleIllegal(CheckLegal());
	}