Пример #1
0
unsigned long long trees(unsigned n) {
	if (n <= 1) {
		return 1;
	}

	unsigned long long res = 0;
	unsigned i;
	for (i = 0; i < n; i++) {
		res += 2*trees(i)*trees(n-i-1);
	}

	return res;
}
Пример #2
0
static TVector<TMxTree> BuildTrees(const THashMap<TFeature, int, TFeatureHash>& featureToIdx,
                                   const TFullModel& model) {
    TVector<TMxTree> trees(model.ObliviousTrees.GetTreeCount());
    auto& binFeatures = model.ObliviousTrees.GetBinFeatures();
    for (int treeIdx = 0; treeIdx < trees.ysize(); ++treeIdx) {
        auto& tree = trees[treeIdx];
        const int leafCount = model.ObliviousTrees.LeafValues[treeIdx].ysize() / model.ObliviousTrees.ApproxDimension;

        tree.Leafs.resize(leafCount);
        for (int leafIdx = 0; leafIdx < leafCount; ++leafIdx) {
            tree.Leafs[leafIdx].Vals.resize(model.ObliviousTrees.ApproxDimension);
        }

        for (int leafIdx = 0; leafIdx < leafCount; ++leafIdx) {
            for (int dim = 0; dim < model.ObliviousTrees.ApproxDimension; ++dim) {
                tree.Leafs[leafIdx].Vals[dim] = model.ObliviousTrees.LeafValues[treeIdx][leafIdx * model.ObliviousTrees.ApproxDimension + dim];
            }
        }
        auto treeSplitsStart = model.ObliviousTrees.TreeStartOffsets[treeIdx];
        auto treeSplitsStop = treeSplitsStart + model.ObliviousTrees.TreeSizes[treeIdx];
        for (auto splitIdx = treeSplitsStart; splitIdx < treeSplitsStop; ++splitIdx) {
            auto feature = GetFeature(binFeatures[model.ObliviousTrees.TreeSplits[splitIdx]]);
            tree.SrcFeatures.push_back(featureToIdx.at(feature));
        }
    }
    return trees;
}
Пример #3
0
void toNormalizedNEXUS(ifstream & inf, ostream *os)
	{
	NxsTaxaBlock taxa;
	NxsTreesBlock trees(&taxa);
	NxsAssumptionsBlock assumptions(&taxa);
	NxsCharactersBlock character(&taxa, &assumptions);
	NxsDataBlock data(&taxa, &assumptions);
	NxsDistancesBlock distances(&taxa);
	NxsUnalignedBlock unaligned(&taxa, &assumptions);

	NormalizingReader nexus(os);
	nexus.Add(&taxa);
	nexus.Add(&trees);
	nexus.Add(&assumptions);
	nexus.Add(&character);
	nexus.Add(&data);
	nexus.Add(&distances);
	nexus.Add(&unaligned);

	if (os)
		{
		*os << "#NEXUS\n";
		}
	NormalizingToken token(inf, os);
	
	nexus.Execute(token);
	}
Пример #4
0
void Graph::kruskal(){
	DisjointSets trees(nvertices);
	prepare_search();
	bfs_worker(1, &(do_nothing),&(do_nothing),&(insert_edge_to_heap));
	edgepair *p;
	int x, y;
	vector<edgepair*> spanning_tree;
	while(!min_heap.empty()){
		p = min_heap.remove_top();
		x = p->x;
		y = p->y;
		int root1 = trees.find(x);
		int root2 = trees.find(y);
		if(root1 == root2)
			continue;
		else{
			spanning_tree.push_back(p);
			trees.sets_union(root1,root2);
		}
	}

	for(vector<edgepair*>::iterator it = spanning_tree.begin();
		it != spanning_tree.end(); it++){
		cout << (*it)->x << ", " << (*it)->y << " -- " << (*it)->weight << endl;
	}
}
Пример #5
0
Node* SmallestFirstTreeMerger::build_section_tree(
    std::vector<struct cg_rules*>& rules, size_t begin, size_t length) {
  fprintf(stderr, "build_section_tree(%zu, %zu)\n", begin, length);
  std::deque<Node*> trees(length);
  /* Let's fill the array. */
  size_t i;
  for (i = 0; i < length; i++) {
    int rule = begin + i;
    trees[i] = new Node();
    trees[i]->fsa.fst = rules[rule]->conditions;
    trees[i]->fst.fst = rules[rule]->rule;
    trees[i]->section = rules[rule]->section_no;
    trees[i]->no_rules = 1;
    fprintf(stderr, "section %s : %d\n", rules[rule]->conditions->name, rules[rule]->section_no);
  }

  /** And now: smallest-first union. */
  while (trees.size() > 1 && trees[0]->fsa.fst->statecount < max_states
                          && trees[1]->fsa.fst->statecount < max_states) {
    fprintf(stderr, "merging %s (%d) and %s (%d)...\n",
        trees[0]->fsa.fst->name,
        trees[0]->fsa.fst->statecount,
        trees[1]->fsa.fst->name,
        trees[1]->fsa.fst->statecount);
    Node* new_tree = new Node();
    new_tree->fsa.fst = union_trees(trees[0]->fsa.fst, trees[1]->fsa.fst);
    sprintf(new_tree->fsa.fst->name, "union");
    new_tree->left  = trees[0];
    new_tree->right = trees[1];
    new_tree->section = trees[0]->section;
    new_tree->no_rules = trees[0]->no_rules + trees[1]->no_rules;
    trees[1] = new_tree;
    fprintf(stderr, "resulting tree: %s (%d)\n",
        new_tree->fsa.fst->name, new_tree->fsa.fst->statecount);
    trees.pop_front();
    std::sort(trees.begin(), trees.end(), tree_compare_size);
  }

  /* Finishing touches... */
  Node* ret = trees[0];
  for (i = 0; i < trees.size(); i++) {
    if (i < trees.size() - 1) {
      trees[i]->next = trees[i + 1];
    }
    if (strncmp(trees[i]->fsa.fst->name, "C_", 2)) {
      snprintf(trees[i]->fsa.fst->name, 40, "S_%d_%zu", trees[i]->section, i);
    }
  }

  Node* p = trees[0];
  while (p != NULL) {
    fprintf(stderr, "Tree %s : %d (%zu)\n", p->fsa.fst->name, p->fsa.fst->statecount, p->no_rules);
    p = p->next;
  }

  return ret;
}
Пример #6
0
Node* SortedFixLevelTreeMerger::build_section_tree(
    std::vector<struct cg_rules*>& rules, size_t begin, size_t length) {
  fprintf(stderr, "build_section_tree(%zu, %zu)\n", begin, length);
  std::vector<Node*> trees(length);
  std::vector<Node*> tmp;

  /* Let's fill the array. */
  for (size_t i = 0; i < length; i++) {
    int rule = begin + i;
    trees[i] = new Node();
    trees[i]->fsa.fst = rules[rule]->conditions;
    trees[i]->fst.fst = rules[rule]->rule;
    trees[i]->section = rules[rule]->section_no;
    trees[i]->no_rules = 1;
    fprintf(stderr, "section %s : %d\n", rules[rule]->conditions->name, rules[rule]->section_no);
  }

  for (int curr_level = 1; trees.size() > 2 && curr_level < levels;
         curr_level++) {
    /* Union trees by pairs. */
    for (size_t i = 0; i < trees.size() / 2; i++) {
      size_t j = 2 * i;
      tmp.push_back(new Node());
      struct fsm* aaa = union_trees(trees[j]->fsa.fst, trees[j + 1]->fsa.fst);
      tmp[i]->fsa.fst = aaa;
      sprintf(tmp[i]->fsa.fst->name, "union");
      tmp[i]->left  = trees[j];
      tmp[i]->right = trees[j + 1];
      tmp[i]->section = trees[0]->section;
      tmp[i]->no_rules = trees[j]->no_rules + trees[j + 1]->no_rules;
    }
    if (trees.size() % 2 == 1) {
      tmp.push_back(trees.back());
    }
    tmp.swap(trees);
    tmp.clear();
  }

  /* Finishing touches... */
  Node* ret = trees[0];
  for (size_t i = 0; i < trees.size(); i++) {
    if (i < trees.size() - 1) {
      trees[i]->next = trees[i + 1];
    }
    if (strncmp(trees[i]->fsa.fst->name, "C_", 2)) {
      snprintf(trees[i]->fsa.fst->name, 40, "S_%d_%zu", trees[i]->section, i);
    }
  }

  Node* p = trees[0];
  while (p != NULL) {
    fprintf(stderr, "Tree %s : %d (%zu)\n", p->fsa.fst->name, p->fsa.fst->statecount, p->no_rules);
    p = p->next;
  }

  return ret;
}
Пример #7
0
Node* FixLevelTreeMerger::build_section_tree(
    std::vector<struct cg_rules*>& rules, size_t begin, size_t length) {
  fprintf(stderr, "build_section_tree(%zu, %zu)\n", begin, length);
  std::deque<Node*> trees(length);
  /* Let's fill the array. */
  for (size_t i = 0; i < length; i++) {
    int rule = begin + i;
    trees[i] = new Node();
    trees[i]->fsa.fst = rules[rule]->conditions;
    trees[i]->fst.fst = rules[rule]->rule;
    trees[i]->section = rules[rule]->section_no;
    trees[i]->no_rules = 1;
    fprintf(stderr, "section %s : %d\n", rules[rule]->conditions->name, rules[rule]->section_no);
  }

  for (int curr_level = 1; trees.size() > 2 && curr_level < levels;
         curr_level++) {
//    fprintf(stderr, "curr level: %d, levels: %d\n", curr_level, levels);
    /* Union trees in the first half of the array with those in the second. */
    for (size_t i = 0; i < trees.size() - 1; i++) {
//      fprintf(stderr, "Merging %s(%zu) - %d & %s(%zu) - %d ...\n",
//          trees[i]->fsa.fst->name, i, trees[i]->fsa.fst->statecount,
//          trees[trees.size() - 1]->fsa.fst->name, trees.size() - 1,
//          trees[trees.size() - 1]->fsa.fst->statecount);
      Node* new_tree = new Node();
      new_tree->fsa.fst = union_trees(trees[i]->fsa.fst, trees.back()->fsa.fst);
      sprintf(new_tree->fsa.fst->name, "union");
      new_tree->left  = trees[i];
      new_tree->right = trees[trees.size() - 1];
      new_tree->section = trees[i]->section;
      new_tree->no_rules = trees[i]->no_rules + trees.back()->no_rules;
      trees[i] = new_tree;
      trees.pop_back();
    }
    std::sort(trees.begin(), trees.end(), tree_compare_size);
  }

  /* Finishing touches... */
  Node* ret = trees[0];
  for (size_t i = 0; i < trees.size(); i++) {
    if (i < trees.size() - 1) {
      trees[i]->next = trees[i + 1];
    }
    if (strncmp(trees[i]->fsa.fst->name, "C_", 2)) {
      snprintf(trees[i]->fsa.fst->name, 40, "S_%d_%zu", trees[i]->section, i);
    }
  }

  Node* p = trees[0];
  while (p != NULL) {
    fprintf(stderr, "Tree %s : %d (%zu)\n", p->fsa.fst->name, p->fsa.fst->statecount, p->no_rules);
    p = p->next;
  }

  return ret;
}
Пример #8
0
infoCard whichcardoff(){
	addressCard O = First(Hand(player_who_play));
	addressCard R = O;
	int tree = trees(Hand(player_who_play),Card(O));
	int poin = point(Card(O));
	while(O != NULL){
		int t = trees(Hand(player_who_play),Card(O));
		int p = point(Card(O));
		if(t<tree){
			R = O;
			tree = t;
			poin = p;
		}else
		if(t==tree && p>poin){
			R = O;
			poin = p;	
		}
		O = Next(O);
	}
	return Card(R);
}
Пример #9
0
int main(void) {
	printf("Enter a positive integer to calculate the number of binary trees of size N\n"
	       "and the number of binary search trees of size N\n");
	printf("> ");

	unsigned n;
	while (scanf("%u", &n) == 1) {
		printf("Binary trees: %llu\nBinary search trees: %llu\n", trees(n), bsts(n));
		printf("> ");
	}

	return 0;
}
Пример #10
0
addressCard whichcardtake(){
	int i = 1;
	int biggest = 0;
	addressCard T = First(card_on_off);
	addressCard B = NULL;
	while(T != NULL && i<=7){
		ClearListCard(&temp_card);
		addressCard C = First(Hand(player_who_play));
		while(C != NULL){
			AddCard(&temp_card,Card(C));
			C = Next(C);
		}
		if(trees(temp_card,Card(T))>2){
			addressCard O = First(card_on_off);
			while(O != NULL){
				AddCard(&temp_card,Card(O));
				if((SameCard(Card(O),Card(T))==1)){
					break;
				}
				O = Next(O);
			}	
		}
		if(B == NULL){
			B = T;
			biggest = trees(temp_card,Card(T));
		}else{
			if(biggest<trees(temp_card,Card(T))){
				B = T;
				biggest = trees(temp_card,Card(T));
			}
		}
		T = Next(T);
		i++;
	}
	if(biggest<3){
		B = NULL;
	}
	return B;
}
Пример #11
0
S_Trees Session::get_subtrees(const char *xpath, sr_get_subtree_options_t opts)
{
    S_Trees trees(new Trees());

    int ret = sr_get_subtrees(_sess, xpath, opts, &trees->_trees, &trees->_cnt);
    if (SR_ERR_OK == ret) {
        trees->_deleter = std::make_shared<Deleter>(trees->_trees, trees->_cnt);
        return trees;
    }
    if (SR_ERR_NOT_FOUND == ret) {
        return nullptr;
    }
    throw_exception(ret);
}
Пример #12
0
static OMR::TreeInfo *findOrCreateTreeInfo(TR::TreeTop *treeTop, List<OMR::TreeInfo> *targetTrees, TR::Compilation * comp)
   {
   ListIterator<OMR::TreeInfo> trees(targetTrees);
   OMR::TreeInfo *t;
   for (t = trees.getFirst(); t; t = trees.getNext())
      {
      if (t->getTreeTop() == treeTop)
         return t;
      }

   t = new (comp->trStackMemory()) OMR::TreeInfo(treeTop, 0);
   targetTrees->add(t);
   return t;
   }
Пример #13
0
void botmeld(){
	sortcard(&Hand(player_who_play),1);
	addressCard T = First(Hand(player_who_play));
	addressCard X = NULL;
	while(T != NULL){
		int t = trees(Hand(player_who_play),Card(T));
		int i = 1;	
		if(t>2){
			while(i <= t){
				X = T;
				T = Next(T);
				doMeld(Card(X));
				i++;
			}
		}else{
			T = Next(T);
		}
	}
}
void Graph::GoKruskalAlgorithm_MinSpanningTree(const char* outputFileName)
{
	std::ofstream file(outputFileName, std::ios::out);
	if (!file)
	{
		return;
	}
	if (this->vertices - 1 > this->weightedEdges.size())
	{
		file << "There isn't spanning three Graph is not connected !";
		return;
	}
	this->sortVertices();
	UnionFind trees(this->vertices);
	std::vector<std::pair<std::pair<int, int>, int >>  spanningEdges;
	std::vector<std::pair<std::pair<int, int>, int >>::iterator currentEdge = this->weightedEdges.begin();
	std::vector<std::pair<std::pair<int, int>, int >>::iterator end = this->weightedEdges.end();
	for (; currentEdge != end; ++currentEdge)
	{
		if (spanningEdges.size() >= this->vertices - 1)
		{
			break; //we found the tree
		}
		if (!trees.connected(currentEdge->first.first, currentEdge->first.second))
		{
			trees.Union(currentEdge->first.first, currentEdge->first.second);
			spanningEdges.push_back(*(currentEdge));
		}
	}
	if (spanningEdges.size() >= this->vertices - 1)
	{
		file << "Spanning tree is found !" << std::endl;
		int sum = 0;
		for (size_t i = 0; i < spanningEdges.size(); i++)
		{
			file << spanningEdges[i].first.first << " - " << spanningEdges[i].first.second << ", weight: " << spanningEdges[i].second << std::endl;
			sum += spanningEdges[i].second;
		}
		file << "Final Weight of Spanning Tree :" << sum << std::endl;
	}
	
	file.close();
}
Пример #15
0
int main() {
	try {
		init();
		SDL_Surface *screen = SDL_SetVideoMode(WIDTH, HEIGHT, 0, SDL_DOUBLEBUF);
		if (screen == NULL) {
			throw std::string("Unable to set video mode: ")+SDL_GetError();
		}
		
		Sprite background("images/falsemirror.bmp", 0.0, 0.0, false);
		Sprite trees("images/ringotrees.bmp", 1.0, 0.0, true);
		Sprite flowers("images/ringoflowers.bmp", 1.0, 0.0, true);
		Sprite cells("images/lastring.bmp", 1.0, 0.0, true);
		Sprite glob1("images/oil.bmp", 430.0, 315.0, true);
		Sprite glob2("images/oil.bmp", 430.0, 315.0, true);
		Sprite glob3("images/oil.bmp", 430.0, 315.0, true);	
		
		Manager manager(START_X, START_Y, INCR_X, X_VELOCITY, Y_VELOCITY, DISC_VELOCITY, DT);
		manager.animate(screen, background, trees, flowers, cells, glob1, glob2, glob3);
		
		SDL_FreeSurface(screen);
	 }
	 catch(const std::string& msg) { std::cout << msg << std::endl;  }
	 catch(...) { std::cout << "oops" << std::endl;  }
}
Пример #16
0
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
if(flag==0)
{

	glRasterPos3f(58,58,0);
for(i=0;s[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s[i]);
glRasterPos3f(45,450,0);
for(i=0;s1[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s1[i]);
glRasterPos3f(90,358,0);
for(i=0;s2[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s2[i]);
glRasterPos3f(70,338,0);
for(i=0;s3[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s3[i]);
glRasterPos3f(218,218,0);
for(i=0;s4[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s4[i]);
glRasterPos3f(350,218,0);
for(i=0;s5[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s5[i]);
glRasterPos3f(250,150,0);
for(i=0;s6[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s6[i]);
glColor3f(1.0,1.0,0.0);
glRasterPos3f(250,130,0);
for(i=0;s7[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s7[i]);
glRasterPos3f(250,100,0);
for(i=0;s8[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s8[i]);
glRasterPos3f(58,28,0);
for(i=0;s9[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s9[i]);




}
else
{

	road();
mountain();


	
//green
glBegin(GL_POLYGON);
glColor3f(0.0,1.0,0.0);
	glVertex2i(-10,300);
	glVertex2i(645,310);
   	glVertex2i(940,100);
	glVertex2i(-10,100);
glEnd();


trees();


//plane construction

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1,1,1);
glBegin(GL_POLYGON);//rectangular body
glVertex2f(0.0,30.0);
glVertex2f(0.0,55.0);
glVertex2f(135.0,55.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);//upper triangle construction plane
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);//outline of upper triangle plane
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();


glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//lower triangle
glVertex2f(135.0,40.0);
glVertex2f(160.0,40.0);
glVertex2f(160.0,37.0);
glVertex2f(145.0,30.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();


glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//back wing 
glVertex2f(0.0,55.0);
glVertex2f(0.0,80.0);
glVertex2f(10.0,80.0);
glVertex2f(40.0,55.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//left side wing
glVertex2f(65.0,55.0);
glVertex2f(50.0,70.0);
glVertex2f(75.0,70.0);
glVertex2f(90.0,55.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//rightside wing
glVertex2f(70.0,40.0);
glVertex2f(100.0,40.0);
glVertex2f(80.0,15.0);
glVertex2f(50.0,15.0);

glEnd();

glPopMatrix();



	if(c>390)    //timer to jump to next display
{
	display2();
	d+=5;//plane takeoff on x in 2nd display
}

if(a>500.0)//window position during take off
{
	a=0.0;
	b=0.0;
}

if(c>800)//timer to jump to 3rd display
{
	display3();
	e+=5;//plane takeoff on x in 3rd display
	
	if(e>250)//timer to call blast function
	{
		blast();
		e=250;
	}
}

}

glFlush();
glutSwapBuffers();
}
Пример #17
0
void display2()
{

glClear(GL_COLOR_BUFFER_BIT);

mountain();


//green
glBegin(GL_POLYGON);
glColor3f(0.0,1.0,0.0);
	glVertex2i(-10,300);
	glVertex2i(645,310);
   	glVertex2i(940,0);
	glVertex2i(-10,0);
glEnd();

trees();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(0.0,30.0);
glVertex2f(0.0,55.0);
glVertex2f(135.0,55.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(135.0,40.0);
glVertex2f(160.0,40.0);
glVertex2f(160.0,37.0);
glVertex2f(145.0,30.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(0.0,55.0);
glVertex2f(0.0,80.0);
glVertex2f(10.0,80.0);
glVertex2f(40.0,55.0);
//glVertex2f(165.0,40.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(65.0,55.0);
glVertex2f(50.0,70.0);
glVertex2f(75.0,70.0);
glVertex2f(90.0,55.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(d,300.0,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(70.0,40.0);
glVertex2f(100.0,40.0);
glVertex2f(80.0,15.0);
glVertex2f(50.0,15.0);

glEnd();
glPopMatrix();


}