Beispiel #1
0
void _3DTree2::rule1(int i)
{
	if (i == 0)
		drawellipse(5,0,5,2);
	else
	{
		glScaled(.6, .6, .6);
		rule2(i - 1);
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
	}
}
Beispiel #2
0
void Fern::rule1(int i)
{
	
	if (i == 0)
		;
	else
	{
		rule2(i-1);
		turnleft();
		glPushMatrix();
		glPushMatrix();
		rule1(i-1);
		glPopMatrix();
		turnright();
		rule1(i-1);
		glPopMatrix();
		turnright();
		rule2(i - 1);
		glPushMatrix();
		turnright();
		rule2(i - 1);
		rule1(i - 1);
		glPopMatrix();
		turnleft(); 
		rule1(i - 1);

	}
}
Beispiel #3
0
void Sierpinski::rule2(int i)
{
	if (i == 0)
		drawline();
	else{
		rule1(i - 1);
		turnleft();
		rule2(i - 1);
		turnleft();
		rule1(i - 1);

	}
}
Beispiel #4
0
void Tree1::rule1(int i)
{
	if (i == 0)
		drawline();
	else
	{
		rule1(i - 1);
		rule1(i - 1);
		turnright();
		glPushMatrix();
		turnright();
		rule1(i - 1);
		turnleft();
		rule1(i - 1);
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		turnleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		turnright();
		rule1(i - 1);
		turnright();
		rule1(i - 1);
		glPopMatrix();
	}
}
void AdaptiveSparseGrid<Scalar,UserVector>::build_diffRule(
	       CubatureTensorSorted<Scalar> & outRule, 
	       std::vector<int> index,
	       AdaptiveSparseGridInterface<Scalar,UserVector> & problem_data) {
	       
  int numPoints     = 0;
  int dimension     = problem_data.getDimension();
  bool isNormalized = problem_data.isNormalized();
  std::vector<EIntrepidBurkardt> rule1D; problem_data.getRule(rule1D);
  std::vector<EIntrepidGrowth> growth1D; problem_data.getGrowth(growth1D);

  for (int i=0; i<dimension; i++) {
    // Compute 1D rules
    numPoints = growthRule1D(index[i],growth1D[i],rule1D[i]);
    CubatureLineSorted<Scalar> diffRule1(rule1D[i],numPoints,isNormalized);
 
    if (numPoints!=1) { // Compute differential rule
      numPoints = growthRule1D(index[i]-1,growth1D[i],rule1D[i]);
      CubatureLineSorted<Scalar> rule1(rule1D[i],numPoints,isNormalized);
      diffRule1.update(-1.0,rule1,1.0);
    }
    // Build Tensor Rule
    outRule = kron_prod<Scalar>(outRule,diffRule1); 
  }
}
Quadrature<Real>::Quadrature(const int dimension,
                             const std::vector<int> &numPoints1D,
                             const std::vector<EQuadrature> &rule1D, 
                             const std::vector<EGrowth> &growth1D,
                             const bool isNormalized) 
  : dimension_(dimension) {
  TEUCHOS_TEST_FOR_EXCEPTION((dimension!=(int)numPoints1D.size()||
		      dimension!=(int)rule1D.size()||
		      dimension!=(int)growth1D.size()),std::out_of_range,
           ">>> ERROR (Quadrature): Dimension mismatch for inputs.");
  accuracy_.clear();
  accuracy_.resize(dimension);
  std::vector<int> degree(1);
  Quadrature<Real> newRule(0,1);
  for (int i=0; i<dimension; i++) {
    // Compute 1D rules
    int numPoints = growthRule1D(numPoints1D[i],growth1D[i],rule1D[i]);
    Quadrature<Real> rule1(rule1D[i],numPoints,isNormalized);
    rule1.getAccuracy(degree);
    accuracy_.push_back(degree[0]);
    // Build Tensor Rule
    newRule = kron_prod<Real>(newRule,rule1);
  }
  typename std::map<std::vector<Real>,int>::iterator it;
  int loc = 0;
  std::vector<Real> node;
  for (it=newRule.begin(); it!=newRule.end(); it++) {
    node = it->first;
    addPointAndWeight(node,newRule.getWeight(node),loc);
    loc++;
  }
  if (isNormalized) {
    normalize();
  }
}
Beispiel #7
0
  virtual void SetUp() {
 		fuzzy = new Fuzzy(1);
    	//Fuzzy Sets -  Input 0 - Velocidade
	  	FuzzySet* velocidadeBaixa = new FuzzySet(0.0, 0.0, 30, 60);
	  	FuzzySet* velocidadeMedia = new FuzzySet(30, 60, 60, 90);
	  	FuzzySet* velocidadeAlta = new FuzzySet(60, 90, 100, 100);

	  	//Index 0 - Input - Velocidade
	  	fuzzy->addFuzzySet(0, 0, velocidadeBaixa);   //Set 0
	  	fuzzy->addFuzzySet(0, 1, velocidadeMedia);   //Set 1
	  	fuzzy->addFuzzySet(0, 2, velocidadeAlta);   //Set 2

	  	//Fuzzy Sets - Output - Consumo
	  	FuzzySet* consumoAlto = new FuzzySet(0.0, 0.0, 3, 6);
	  	FuzzySet* consumoMedio = new FuzzySet(3, 6, 6, 9);
	  	FuzzySet* consumoBaixo = new FuzzySet(6, 9, 10, 10);


	  	//Index 2 - Output
	  	fuzzy->addFuzzySet(2, 0,consumoAlto);
	  	fuzzy->addFuzzySet(2, 1, consumoMedio);
	  	fuzzy->addFuzzySet(2, 2, consumoBaixo);

	  	//Rules Base
		FuzzyRule rule1(velocidadeMedia, consumoBaixo);
	  	FuzzyRule rule2(velocidadeBaixa, consumoMedio);
	  	FuzzyRule rule3(velocidadeAlta, consumoAlto);


	  	fuzzy->addRule(rule1);
	 	fuzzy->addRule(rule2);
	  	fuzzy->addRule(rule3);
  }
void
MonthWeekDayRuleTest::test_operators_general()
{
	const String ruleName("MyRule");
	const MonthOfYear::eMonthOfYear refMonth = MonthOfYear::December;
	const MonthWeek::eMonthWeek refWeekOfMonth = MonthWeek::Fifth;
	const WeekDay::eWeekDay refWeekDay = WeekDay::Sunday;

	//test: MontDayRule::MonthDayRule& operator=(const MonthDayRule& rhs);
	MonthWeekDayRule rule1 (ruleName, refMonth, refWeekOfMonth, refWeekDay);
	 
	MonthWeekDayRule rule2;
	rule2 = rule1;

	CPPUNIT_ASSERT(refMonth == rule2.getMonth().monthOfYear()); 
	CPPUNIT_ASSERT(refWeekOfMonth == rule2.getMonthWeek());
	CPPUNIT_ASSERT(refWeekDay== rule2.getWeekDay());
	CPPUNIT_ASSERT(ruleName == rule2.getRuleName());

	//test: MontDayRule::Bool operator==(const MonthDayRule& other);
	CPPUNIT_ASSERT(rule1 == rule2);

	//test: MontDayRule::Bool operator!=(const MonthDayRule& other);
	MonthWeekDayRule rule3;
	CPPUNIT_ASSERT (rule1 != rule3);
	 
}
void Flock::update(const Scene & scene){
	for(std::vector<Boid * >::iterator it = boids.begin(); it != boids.end(); ++it) {
		 	int index = it - boids.begin();
		 	Vector v = rule1(index) + rule2(index) + rule3(index);
		 	v = v * damping;
			Boid * boid = *it;
		 	v = v + boid->getVelocity();

		 	if(v.getLength() > maxSpeed){
		 		v = v * (maxSpeed/v.getLength());
		 	}

			Point p = boid->getCenter();
			double wind = 0.12;
			Vector windVector;
			if(p.x> 900 ){
				windVector = Vector(-wind,0);
			} else if(p.x< 150 ){
				windVector = Vector(wind,0);
			} else if(p.y> 350 ){
				windVector = Vector(0,-wind);
			} else if(p.y< 150 ){
				windVector = Vector(0,wind);
			}

			boid->setVelocity(v + windVector);
		 	boid->setCenter(boid->getCenter() + boid->getVelocity());
	}
}
void
MonthDayRuleTest::test_operators_general()
{
	const String ruleName("MyRule");
	const Month refMonth(12);
	const DayOfMonth refDayOfMonth(31);

	//test: MontDayRule::MonthDayRule& operator=(const MonthDayRule& rhs);
	MonthDayRule rule1 (ruleName, refMonth, refDayOfMonth);
	
	MonthDayRule rule2;
	rule2 = rule1;
	CPPUNIT_ASSERT(12 == rule2.getMonth().getValue());
	CPPUNIT_ASSERT(31 == rule2.getDayOfMonth().getValue());
	CPPUNIT_ASSERT(ruleName == rule2.getRuleName());


	//test: MontDayRule::Bool operator==(const MonthDayRule& other);
	CPPUNIT_ASSERT(rule1 == rule2);

	//test: MontDayRule::Bool operator!=(const MonthDayRule& other);
	MonthDayRule rule3;
	CPPUNIT_ASSERT (rule1 != rule3);
	 
}
Beispiel #11
0
void AIElementGroupSwarm::step(Real evt)
{
    //LogManager::getSingleton().logMessage("Swarm step.");
    int i;
    Vector3 v1,v2,v3,mVel;
    for (i=0; i!=nodes.size(); i++)
    {
        AIElement* n = nodes[i];
        v1=rule1(n);
        v2=rule2(n);
        v3=rule3(n);
        mVel=n->getVelocity();
        mVel+=v1+v2+v3;
        //LogManager::getSingleton().logMessage(StringConverter::toString(nodes.size()));
        //	LogManager::getSingleton().logMessage(StringConverter::toString(v2));
        //	LogManager::getSingleton().logMessage(StringConverter::toString(v3));
        //boundPosition(nodes[i]);
        //tend_to_pos(nodes[i]);
        //n->setPosition(n->getPosition()+mVel/(100000)*evt);
        n->setVelocity(mVel*0.0001);
        tendToPos(getPos());
        n->sendCommand1(StringConverter::toString(GOTO_NPC));
        n->sendCommand2(StringConverter::toString(n->getPosition()));
    }
}
Beispiel #12
0
void BoidFlock::update() {
	for (unsigned i = 0; i < boidCount; i++) {
		Boid *b = boids[i];
		vec3 v1 = rule1(b);
		vec3 v2 = rule2(b);
		vec3 v3 = rule3(b);
		vec3 pos = boundPosition(b);

		b->incVelocity((v1 + v2 + v3 + pos) / 100.0f);
		limitSpeed(b);
		b->update();
	}
}
void run(int *board,int h,int w)
{
    int i,j;
    statusList=initializeList(&statusList);

    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            rule1(board,i,j,h,w);
            rule2(board,i,j,h,w);
        }
    }
    applyChanges(board,w);
}
Beispiel #14
0
bool funcEND(ParserParam &param, Token *tok){
	switch(param.stack.back()){
		case 1:
			shift(param,tok,2);
			break;
		case 2:
			param.isAccept = true;
			break;
		case 3:
			if(!rule2(param)) return false;
			break;
		case 4:
			if(!rule1(param)) return false;
			break;
		case 7:
			if(!rule3(param)) return false;
			break;
		case 8:
			if(!rule4(param)) return false;
			break;
		case 12:
			if(!rule5(param)) return false;
			break;
		case 14:
			if(!rule6(param)) return false;
			break;
		case 25:
			if(!rule15(param)) return false;
			break;
		case 30:
			if(!rule17(param)) return false;
			break;
		case 31:
			if(!rule18(param)) return false;
			break;
		case 33:
			if(!rule19(param)) return false;
			break;
		case 34:
			if(!rule20(param)) return false;
			break;
		default:
			return false;
		break;
	}
	return true;
}
Beispiel #15
0
void _3DTree::rule1(int i)
{
	if (i == 0)
		drawline();
	else
	{
		rule1(i - 1);
		glPushMatrix();
		turnright();
		pitchdown();
		rollleft();
		rule1(i - 1);
		glPopMatrix();
		glPushMatrix();
		rollleft();
		turnleft();
		turnleft();
		pitchdown();
		rule1(i - 1);
		glPopMatrix();
		turnaround();
		turnaround();
		rule1(i - 1);
		glPushMatrix();
		turnright();
		turnright();
		pitchdown();
		rollright();
		rule1(i - 1);
		glPopMatrix();
		glPushMatrix();
		turnleft();
		pitchdown();
		rule1(i - 1);
		glPopMatrix();
	}
}
Beispiel #16
0
TEST_F(FuzzyTest, testarFuzzificationComDuasEntradas){

	Fuzzy* fuzzy2 = new Fuzzy(2);
	
    //Fuzzy Sets -  Input 0 - Velocidade
	FuzzySet* velocidadeBaixa = new FuzzySet(0.0, 0.0, 30, 60);
	FuzzySet* velocidadeMedia = new FuzzySet(30, 60, 60, 90);
	FuzzySet* velocidadeAlta = new FuzzySet(60, 90, 100, 100);

	//Index 0 - Input - Velocidade
	fuzzy2->addFuzzySet(0, 0, velocidadeBaixa);   //Set 0
	fuzzy2->addFuzzySet(0, 1, velocidadeMedia);   //Set 1
	fuzzy2->addFuzzySet(0, 2, velocidadeAlta);   //Set 2
	
	//Fuzzy Sets -  Input 1 - Distância
	FuzzySet* distanciaPequena = new FuzzySet(0.0, 0.0, 15, 30);
	FuzzySet* distanciaMedia = new FuzzySet(15, 30, 30, 45);
	FuzzySet* distanciaGrande = new FuzzySet(30, 45, 100, 100);

	//Index 1 - Input - Distância
	fuzzy2->addFuzzySet(1, 0, distanciaPequena);   //Set 0
	fuzzy2->addFuzzySet(1, 1, distanciaMedia);   //Set 1
	fuzzy2->addFuzzySet(1, 2, distanciaGrande);   //Set 2

	//Fuzzy Sets - Output - Consumo
	FuzzySet* frearPouco = new FuzzySet(0.0, 0.0, 3, 6);
	FuzzySet* frearMedio = new FuzzySet(3, 6, 6, 9);
	FuzzySet* frearMuito = new FuzzySet(6, 9, 10, 10);


	//Index 2 - Output
	fuzzy2->addFuzzySet(2, 0,frearPouco);
	fuzzy2->addFuzzySet(2, 1, frearMedio);
	fuzzy2->addFuzzySet(2, 2, frearMuito);
 	//Rules Base
	FuzzyRule rule1(velocidadeBaixa, distanciaPequena, frearMuito);
  	FuzzyRule rule2(velocidadeBaixa, distanciaMedia, frearMedio);
  	FuzzyRule rule3(velocidadeAlta, distanciaGrande, frearPouco);


  	fuzzy2->addRule(rule1);
 	fuzzy2->addRule(rule2);
  	fuzzy2->addRule(rule3);
  	
  	
  	/****************************/
  		
  	//Definindo o valor crisp da Velocidade
    fuzzy2->setInputs(0, 60);
    
    //Definindo o valor crisp da Distancia
    fuzzy2->setInputs(1, 30);

    //Fuzzificando
    fuzzy2->fuzzify(0);
    fuzzy2->fuzzify(1);

    EXPECT_FLOAT_EQ(0, fuzzy2->getFuzzification(1, 0));
    EXPECT_FLOAT_EQ(1, fuzzy2->getFuzzification(1, 1));
    EXPECT_FLOAT_EQ(0, fuzzy2->getFuzzification(1, 2));
	/********/
	    
 

	/****************************/
	
    fuzzy2->setInputs(1, 37);	
    fuzzy2->fuzzify(1);
    
    EXPECT_FLOAT_EQ(0, fuzzy2->getFuzzification(1, 0));
    EXPECT_FLOAT_EQ(0.5333333, fuzzy2->getFuzzification(1, 1));
    EXPECT_FLOAT_EQ(0.46666664, fuzzy2->getFuzzification(1, 2)); 
    /***************************/
    
    
    fuzzy2->setInputs(0, 50);
    fuzzy2->setInputs(1, 29);
	
	fuzzy2->fuzzify(0);
    fuzzy2->fuzzify(1);	    
    fuzzy2->evaluate();
    
    float freio = fuzzy2->desfuzzify();
    
    EXPECT_FLOAT_EQ(6.1111112, freio); 	
	
}
int main()
{
	int i,j,k;
	int l,m,n,o,bc,flag=0,count1=0,x=0,count2=0,row=0,count3=0,col=0,col2=0,prevcount=0,count5=0,size1=2,size2=3;
	int cancount=0,lk,lm,count11=0;
	
	int arr1[3],arr2[3],arr3[3];
	int ab,div1,div2,count10=0,initial=0,initial2=0,candicount=0,prevcount1=0;
	
	
	for(i=1;i<=size;i++)
	{
		for(j=1;j<=size;j++)
		{
			headarray[i][j]=NULL;	
		}
	}
	scanf("%d",&size);
	memset(check, 0, (sizeof check[0][0])*size*size);
	memset(notin, 0, (sizeof notin[0][0])*size*size);
	memset(see, 0, (sizeof see[0][0])*size*size);
	// taking sudoku input
	
	for(i=1;i<=(size*size);i++)
	{
		for(j=1;j<=(size*size);j++)
		{
			scanf("%d",&arr[i][j]);
			if(arr[i][j]==0)
			count++;
		}

	}
	
	
	traverse();		            // updating missing no matrix
	cross();	   	    	// crosshatching
	candidatelist();		// preparing candidate list
	rule1();			// rule1
	while(1)
	{
		prevcount1=count;
				    
		rule1();		    	// rule1
		rule2_box();			//rule2 for box
		rule2_row();			// rule2 column
		rule2_col();			// rule 2 for row
		rule1();	    		// rule 1				
		rule3();			// rule 3
		rule2_box();			//rule2 for box
		rule2_row();			
		rule2_col();		    
		rule4();			// rule 4
		if(prevcount1==count)
		break;
				    
	
	}		    
	
	for(i=1;i<=size*size;i++)
	{

		for(j=1;j<=size*size;j++)
		{
			printf("%d ",arr[i][j]);

		}
		printf("\n");
	}
	
return 0;

}
Beispiel #18
0
bool funcNUM(ParserParam &param, Token *tok){
	switch(param.stack.back()){
		case 3:
			if(!rule2(param)) return false;
			break;
		case 4:
			if(!rule1(param)) return false;
			break;
		case 7:
			if(!rule3(param)) return false;
			break;
		case 8:
			if(!rule4(param)) return false;
			break;
		case 12:
			if(!rule5(param)) return false;
			break;
		case 14:
			if(!rule6(param)) return false;
			break;
		case 19:
			if(!rule67(param)) return false;
			break;
		case 22:
			shift(param,tok,23);
			break;
		case 25:
			if(!rule15(param)) return false;
			break;
		case 27:
			shift(param,tok,99);
			break;
		case 28:
			shift(param,tok,99);
			break;
		case 30:
			if(!rule17(param)) return false;
			break;
		case 31:
			if(!rule18(param)) return false;
			break;
		case 33:
			if(!rule19(param)) return false;
			break;
		case 34:
			if(!rule20(param)) return false;
			break;
		case 37:
			shift(param,tok,99);
			break;
		case 39:
			if(!rule25(param)) return false;
			break;
		case 41:
			if(!rule26(param)) return false;
			break;
		case 42:
			shift(param,tok,99);
			break;
		case 44:
			if(!rule27(param)) return false;
			break;
		case 46:
			if(!rule28(param)) return false;
			break;
		case 48:
			shift(param,tok,99);
			break;
		case 50:
			shift(param,tok,99);
			break;
		case 52:
			shift(param,tok,99);
			break;
		case 53:
			if(!rule29(param)) return false;
			break;
		case 55:
			shift(param,tok,99);
			break;
		case 57:
			shift(param,tok,99);
			break;
		case 58:
			if(!rule30(param)) return false;
			break;
		case 59:
			if(!rule31(param)) return false;
			break;
		case 60:
			shift(param,tok,99);
			break;
		case 62:
			if(!rule32(param)) return false;
			break;
		case 63:
			shift(param,tok,99);
			break;
		case 65:
			if(!rule33(param)) return false;
			break;
		case 67:
			shift(param,tok,99);
			break;
		case 70:
			shift(param,tok,99);
			break;
		case 73:
			shift(param,tok,99);
			break;
		case 76:
			shift(param,tok,99);
			break;
		case 79:
			shift(param,tok,99);
			break;
		case 81:
			shift(param,tok,99);
			break;
		case 84:
			shift(param,tok,99);
			break;
		case 87:
			shift(param,tok,99);
			break;
		case 89:
			shift(param,tok,99);
			break;
		case 93:
			shift(param,tok,99);
			break;
		case 96:
			shift(param,tok,99);
			break;
		case 100:
			if(!rule54(param)) return false;
			break;
		case 101:
			if(!rule55(param)) return false;
			break;
		case 102:
			if(!rule56(param)) return false;
			break;
		case 103:
			if(!rule57(param)) return false;
			break;
		case 104:
			if(!rule58(param)) return false;
			break;
		case 105:
			if(!rule59(param)) return false;
			break;
		case 106:
			if(!rule60(param)) return false;
			break;
		case 107:
			if(!rule61(param)) return false;
			break;
		case 108:
			if(!rule62(param)) return false;
			break;
		case 109:
			if(!rule63(param)) return false;
			break;
		case 110:
			if(!rule64(param)) return false;
			break;
		case 111:
			if(!rule65(param)) return false;
			break;
		case 112:
			if(!rule66(param)) return false;
			break;
		default:
			return false;
		break;
	}
	return true;
}
Beispiel #19
0
bool funcSEMI(ParserParam &param, Token *tok){
	switch(param.stack.back()){
		case 3:
			if(!rule2(param)) return false;
			break;
		case 4:
			if(!rule1(param)) return false;
			break;
		case 6:
			shift(param,tok,7);
			break;
		case 7:
			if(!rule3(param)) return false;
			break;
		case 8:
			if(!rule4(param)) return false;
			break;
		case 12:
			if(!rule5(param)) return false;
			break;
		case 14:
			if(!rule6(param)) return false;
			break;
		case 24:
			shift(param,tok,25);
			break;
		case 25:
			if(!rule15(param)) return false;
			break;
		case 27:
			shift(param,tok,39);
			break;
		case 28:
			shift(param,tok,39);
			break;
		case 30:
			if(!rule17(param)) return false;
			break;
		case 31:
			if(!rule18(param)) return false;
			break;
		case 33:
			if(!rule19(param)) return false;
			break;
		case 34:
			if(!rule20(param)) return false;
			break;
		case 37:
			shift(param,tok,39);
			break;
		case 39:
			if(!rule25(param)) return false;
			break;
		case 40:
			shift(param,tok,41);
			break;
		case 41:
			if(!rule26(param)) return false;
			break;
		case 43:
			shift(param,tok,44);
			break;
		case 44:
			if(!rule27(param)) return false;
			break;
		case 45:
			shift(param,tok,46);
			break;
		case 46:
			if(!rule28(param)) return false;
			break;
		case 50:
			shift(param,tok,39);
			break;
		case 52:
			shift(param,tok,39);
			break;
		case 53:
			if(!rule29(param)) return false;
			break;
		case 57:
			shift(param,tok,39);
			break;
		case 58:
			if(!rule30(param)) return false;
			break;
		case 59:
			if(!rule31(param)) return false;
			break;
		case 61:
			shift(param,tok,62);
			break;
		case 62:
			if(!rule32(param)) return false;
			break;
		case 64:
			shift(param,tok,65);
			break;
		case 65:
			if(!rule33(param)) return false;
			break;
		case 66:
			if(!rule35(param)) return false;
			break;
		case 68:
			if(!rule34(param)) return false;
			break;
		case 69:
			if(!rule37(param)) return false;
			break;
		case 71:
			if(!rule36(param)) return false;
			break;
		case 72:
			if(!rule39(param)) return false;
			break;
		case 74:
			if(!rule38(param)) return false;
			break;
		case 75:
			if(!rule41(param)) return false;
			break;
		case 77:
			if(!rule40(param)) return false;
			break;
		case 78:
			if(!rule44(param)) return false;
			break;
		case 80:
			if(!rule42(param)) return false;
			break;
		case 82:
			if(!rule43(param)) return false;
			break;
		case 83:
			if(!rule46(param)) return false;
			break;
		case 85:
			if(!rule45(param)) return false;
			break;
		case 86:
			if(!rule47(param)) return false;
			break;
		case 88:
			if(!rule48(param)) return false;
			break;
		case 91:
			if(!rule49(param)) return false;
			break;
		case 92:
			if(!rule50(param)) return false;
			break;
		case 95:
			if(!rule51(param)) return false;
			break;
		case 98:
			if(!rule52(param)) return false;
			break;
		case 99:
			if(!rule53(param)) return false;
			break;
		case 113:
			if(!rule68(param)) return false;
			break;
		default:
			return false;
		break;
	}
	return true;
}
Beispiel #20
0
bool funcREAD(ParserParam &param, Token *tok){
	switch(param.stack.back()){
		case 3:
			if(!rule2(param)) return false;
			break;
		case 4:
			if(!rule1(param)) return false;
			break;
		case 7:
			if(!rule3(param)) return false;
			break;
		case 8:
			if(!rule4(param)) return false;
			break;
		case 12:
			if(!rule5(param)) return false;
			break;
		case 14:
			if(!rule6(param)) return false;
			break;
		case 25:
			if(!rule15(param)) return false;
			break;
		case 27:
			shift(param,tok,63);
			break;
		case 28:
			shift(param,tok,63);
			break;
		case 30:
			if(!rule17(param)) return false;
			break;
		case 31:
			if(!rule18(param)) return false;
			break;
		case 33:
			if(!rule19(param)) return false;
			break;
		case 34:
			if(!rule20(param)) return false;
			break;
		case 37:
			shift(param,tok,63);
			break;
		case 39:
			if(!rule25(param)) return false;
			break;
		case 41:
			if(!rule26(param)) return false;
			break;
		case 44:
			if(!rule27(param)) return false;
			break;
		case 46:
			if(!rule28(param)) return false;
			break;
		case 50:
			shift(param,tok,63);
			break;
		case 52:
			shift(param,tok,63);
			break;
		case 53:
			if(!rule29(param)) return false;
			break;
		case 57:
			shift(param,tok,63);
			break;
		case 58:
			if(!rule30(param)) return false;
			break;
		case 59:
			if(!rule31(param)) return false;
			break;
		case 62:
			if(!rule32(param)) return false;
			break;
		case 65:
			if(!rule33(param)) return false;
			break;
		default:
			return false;
		break;
	}
	return true;
}
Beispiel #21
0
void L_system::start(int i)
{
	rule1(i);
}
Beispiel #22
0
void _3DTree4::rule1(int i)
{
	if (i == 0)
		drawellipse(2, 0, 2, 1);
	else
	{
		glScaled(.9, .9, .9);
		rule2(i - 1);
		rule2(i - 1);
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();

		rollleft();
		rollleft();

		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rule2(i - 1);

		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();

		rollleft();
		rollleft();

		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();
		rollleft();
		rollleft();
		glPushMatrix();
		turnleft();
		rule1(i - 1);
		glPopMatrix();


	}
}