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


C++ Pile类代码示例

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


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

示例1: MoveHint

MoveHint *YukonSolver::translateMove( const MOVE &m )
{
    Pile *frompile = 0;
    frompile = deal->store[m.from];

    Card *card = frompile->at( frompile->cardsLeft() - m.card_index - 1);

    if ( m.totype == O_Type )
    {
        Pile *target = 0;
        Pile *empty = 0;
        for (int i = 0; i < 4; i++) {
            Card *c = deal->target[i]->top();
            if (c) {
                if ( c->suit() == card->suit() )
                {
                    target = deal->target[i];
                    break;
                }
            } else if ( !empty )
                empty = deal->target[i];
        }
        if ( !target )
            target = empty;
        return new MoveHint( card, target, m.pri );
    } else {
        return new MoveHint( card, deal->store[m.to], m.pri );
    }
}
开发者ID:nielsslot,项目名称:kdegamess60,代码行数:29,代码来源:yukon.cpp

示例2: WhichPile

// See whether the card under the cursor can be moved somewhere else
// Returns 'true' if it can be moved, 'false' otherwise
bool Game::CanYouGo(int x, int y)
{
    Pile* pile = WhichPile(x, y);
    if (pile && pile != m_pack)
    {
        Card* card = pile->GetTopCard();

        if (card)
        {
            int i;
            for(i = 0; i < 8; i++)
            {
                if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
                {
                    return true;
                }
            }
            for(i = 0; i < 10; i++)
            {
                if (m_bases[i]->GetTopCard() &&
                    m_bases[i]->AcceptCard(card) &&
                    m_bases[i] != pile)
                {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:crankycoder,项目名称:wxPython-2.9.2.4,代码行数:32,代码来源:game.cpp

示例3: Pile

Pile<T>& Pile<T>::clone(){
    Pile *copy = new Pile();
    for(unsigned int i = 0 ; i < this->size() ; ++i){
        T *temp = *this->value(i)->clone();
        copy->push(*temp);
    }
    return &copy;
}
开发者ID:NicolasBiehler,项目名称:lo21_projet,代码行数:8,代码来源:pile.cpp

示例4: pushHistorique

void Computer::push(Litteral& L)
{
     pushHistorique(*pileActuelle, true);
     Pile *newP = new Pile(*pileActuelle);
     newP->push(L);
     pileActuelle = newP;

}
开发者ID:plougue,项目名称:Projet-LO21,代码行数:8,代码来源:analyseur.cpp

示例5: process_pile

void process_pile(DrawableCard *CT[DECK_SIZE], Pile &P) {
  static int cards_seen = 0;
  for (int i = P.get_size(); i > 0; i--) {
    cards_seen++;
    Card &C = P.get_card(i-1);
    CT[card_idx_peek(C)] = peek_drawable(C);
  }
  return;
}
开发者ID:NavJ,项目名称:solitaire,代码行数:9,代码来源:solitaire_gui.cpp

示例6: if

bool FileSystemActor::isSourceValid()
{
	FileSystemActor *fsData = NULL;
	Actor *data = NULL;

	for (uint i = 0; i < source.size(); i++)
	{
		// Check to see if the icon is a filesystem icon
		if (source[i]->isBumpObjectType(BumpActor))
		{
			data = (Actor *) source[i];

			if (data->isActorType(FileSystem))
			{
				fsData = (FileSystemActor *) source[i];

				// Exclude Virtual folders
				if (fsData->isFileSystemType(Virtual)) return false;
				if (fsData->isFileSystemType(LogicalVolume)) return false;
				if (fsData == this) return false;
			}
			else if (data->isActorType(Webpage) && RecycleBin == winOS->GetIconTypeFromFileName(getFullPath()))
				return true; // can drop WebActor into Recycling Bin to delete
			else
				return false;

		}else if (source[i]->isBumpObjectType(BumpPile))
		{
			Pile *pile = (Pile *) source[i];

			// Check for any items that cannot be moved (ie. Virtual folders)
			for (uint i = 0; i < pile->getNumItems(); i++)
			{
				if (!(*pile)[i]->isPilable(HardPile))
				{
					return false;
				}
			}

			// Ignore gridded items because they are on the dynamic plane, above
			// all other items on the floor.
			if (pile->getPileState() == Grid) return false;

			// Allow Piles
			return true;
		
		}else{
			// Logical items are not allowed
			return false;
		}
	}

	return true;
}
开发者ID:DX94,项目名称:BumpTop,代码行数:54,代码来源:BT_FileSystemActor.cpp

示例7:

T& Pile<T>::MEAN(const unsigned int x) const{
    T& tmp = this->SUM(x);
    Operation::Div * div = new Operation::Div();
    Pile<T> pileTmp;
    pileTmp.addPile(tmp);
    pileTmp.addPile(new Nombre::Entier(x));
    T* res = div->calcul(pileTmp);
    delete div;
    delete pileTmp;
    T& ref = *res;
    return ref;
}
开发者ID:NicolasBiehler,项目名称:lo21_projet,代码行数:12,代码来源:pile.cpp

示例8: WhichPile

// See whether the card under the cursor can be moved somewhere else
// Returns 'true' if it can be moved, 'false' otherwise
bool Game::CanYouGo(int x, int y)
{
    Pile* pile = WhichPile(x, y);
    if (pile && pile != m_pack)
    {
        Card* card = pile->GetTopCard();

        if (card)
        {
            int i;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
            for(i = 0; i < 8; i++)
            {
                if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
                {
                    return true;
                }
            }
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
            for(i = 0; i < 10; i++)
            {
                if (m_bases[i]->GetTopCard() &&
                    m_bases[i]->AcceptCard(card) &&
                    m_bases[i] != pile)
                {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:50,代码来源:game.cpp

示例9: copierDans

void Pile::copierDans(Pile& P) const
{
    for(int i = 0; i<taille; i++) // On parcours dans l'ordre d'ajout du plus vieux au plus récent
    {
        P.push(*litteraux[i]);
    }
}
开发者ID:plougue,项目名称:Projet-LO21,代码行数:7,代码来源:pile.cpp

示例10: clone

//############# OPERATION ##################
void Pile::clone(Pile & p) const{

    for(int i = 0; i<this->size(); i++){
        Constante * c = this->at(i);
        if(typeid(*c) ==typeid(CEntier)){
             p.push((Constante * )new CEntier(*((CEntier*) c)));
        }else if(typeid(*c) ==typeid(CRationnel)){
            p.push((Constante * )new CRationnel(*((CRationnel*) c)));
        }else if(typeid(*c) ==typeid(CReel)){
            p.push((Constante * )new CReel(*((CReel*) c)));
        }else if(typeid(*c) ==typeid(CComplexe)){
            p.push((Constante * )new CComplexe(*((CComplexe*) c)));
        }else if(typeid(*c) ==typeid(CExpression)){
            p.push((Constante * ) new CExpression(*((CExpression*) c)));
        }
    }
}
开发者ID:paillardf,项目名称:LO21-calculatrice,代码行数:18,代码来源:pile.cpp

示例11: Q_ASSERT

MoveHint *IdiotSolver::translateMove( const MOVE &m )
{
    if ( m.from >=4 )
        return 0;
    Pile *frompile = deal->m_play[m.from];

    Card *card = frompile->at( frompile->cardsLeft() - m.card_index - 1);
    Q_ASSERT( card );

    Pile *target = 0;
    if ( m.to == 5 )
        target = deal->m_away;
    else
        target = deal->m_play[m.to];

    return new MoveHint( card, target, m.pri );
}
开发者ID:nielsslot,项目名称:kdegamess60,代码行数:17,代码来源:idiot.cpp

示例12: move_from

void Pile::move_from(Pile &from, int num) {
  assert(num <= from.get_size());
  iterator iter_from = from.cards.begin();
  for (int i = 0; i < num; i++) {
    iter_from++;
  }
  cards.splice(cards.begin(), from.cards, from.cards.begin(), iter_from);
}
开发者ID:NavJ,项目名称:solitaire,代码行数:8,代码来源:solitaire.cpp

示例13: valide

bool Expression::valide() const //Verifie que la syntaxe de l'expression est conforme a la notation polonaise inversee
{
    Pile stack;
    Expression* copy =  dynamic_cast<Expression*>(clone());
    Cellule* cell = copy->tete;
    Donnee* data1;
    Donnee* data2;
    while(cell)
    {
        //On teste si le contenu de la cellule est de type Numerique
        const Numerique* test = dynamic_cast<const Numerique*>(cell->getContent());
        if (test)
            stack.empiler(cell->getContent());
        else    //Il d'agit d'un operateur
        {
            const OperateurBinaire* opbinaire = dynamic_cast<const OperateurBinaire*>(cell->getContent());
            if(opbinaire)   //Il s'agit d'un operateur binaire
            {
                if (stack.longueur()<2)
                    return false;
                data1 = stack.depiler();
                data2 = stack.depiler();
                const Numerique* test1 = dynamic_cast<const Numerique*>(data1);
                const Numerique* test2 = dynamic_cast<const Numerique*>(data2);
                if (!(test1 && test2))
                        return false;
                stack.empiler(data1);
            }
            else    //C'est un operateur unaire
            {
                if (stack.longueur()<1)
                    return false;
                data1 = stack.depiler();
                const Numerique* test = dynamic_cast<const Numerique*>(data1);
                if (!test)
                    return false;
                stack.empiler(data1);
            }
        }
        cell = cell->getSucc();
    }
    data1 = stack.depiler();
    const Numerique* test = dynamic_cast<const Numerique*>(data1);
    if(test)
        return true;
    return false;
}
开发者ID:Maerig,项目名称:LO21,代码行数:47,代码来源:expression.cpp

示例14: isPokerPlayable

bool Straight::isPokerPlayable(Hand& selection, Pile& playPile){
  Hand topHand = playPile.getTopHand();
  if(topHand.size() == '\0'){
    return true;
  }else if(topHand.size() != 5){
    return false;
  }
  //Highest ranking card at the top of the sequence wins
  if((selection.getCard(0)->getRank() > topHand.getCard(0)->getRank())){
    return true;
  }
}
开发者ID:liandrew,项目名称:cardgame-framework,代码行数:12,代码来源:Straight.cpp

示例15: hasCommonRoots

bool FileSystemManager::hasCommonRoots(const FileSystemActor * actor, const vector<BumpObject *>& dropObjects) const
{
	// XXX: see http://msdn.microsoft.com/en-us/library/aa364952.aspx
	vector<BumpObject *> dropObjs = dropObjects;
	FileSystemActor * firstValid = NULL;
	for (int i = 0; i < dropObjs.size() && !firstValid; ++i)
	{
		if (dropObjs[i]->isBumpObjectType(BumpActor))
		{
			Actor * a = (Actor *) dropObjs[i];
			if (a->isActorType(FileSystem))
				firstValid = (FileSystemActor *) a;
		}
		if (dropObjs[i]->isBumpObjectType(BumpPile))
		{
			Pile * p = (Pile *) dropObjs[i];
			vector<BumpObject *> items = p->getPileItems();
			for (int j = 0; j < items.size(); ++j)
			{
				dropObjs.push_back(items[j]);
			}
		}
	}

	if (firstValid)
	{
#ifdef WIN32
		int d1 = PathGetDriveNumber((LPCTSTR) actor->getTargetPath().utf16());
		int d2 = PathGetDriveNumber((LPCTSTR) firstValid->getTargetPath().utf16());
		return	(d1 == d2);
#else
	#error NOT IMPLEMENTED
#endif
	}
	return false;
}
开发者ID:DX94,项目名称:BumpTop,代码行数:36,代码来源:BT_FileSystemManager.cpp


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