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


C++ Neighborhood::cubeAt方法代码示例

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


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

示例1: leftmostNeighbor

/**
  * Helper method to locate the leftmost cube 
  * in a series of neighboured cubes.
  */
unsigned Phonemic::leftmostNeighbor(unsigned id) {
    // Find leftmost cube
	Neighborhood hood = Neighborhood(id);
	CubeID leftmostID = id;
	while(hood.hasCubeAt(LEFT)) {
		leftmostID = hood.cubeAt(LEFT);
		hood = Neighborhood(leftmostID);
	}
    return leftmostID;
}
开发者ID:JimmySticks2001,项目名称:Phonemic,代码行数:14,代码来源:phonemic.cpp

示例2: checkForWord

/** 
  * Helper method to decide if a series of cubes
  * spells the current word.
  */
void Phonemic::checkForWord(unsigned id) {

    // Find leftmost cube
	CubeID nextID = leftmostNeighbor(id);
    Neighborhood hood = Neighborhood(nextID);
    	
	// Find the sequence of symbols spelled by
    // the sequence of cubes
    int wordAttempt[MAX_WORD_SIZE];
    wordAttempt[0] = cubes[nextID].symbol;
    int i = 1;
    while(hood.hasCubeAt(RIGHT)) {
    	nextID = hood.cubeAt(RIGHT);
	    hood = Neighborhood(nextID);
    	wordAttempt[i] = cubes[nextID].symbol;
        i++;
	}
    wordAttempt[i] = -1;
        
    // Check for a match
	bool match = true;
    for(int i = 0; i < /*MAX_WORD_SIZE*/ length; i++) {
        if(/*order[i]*/ wordFamilies[level].phonemes[word][i] != wordAttempt[i]) 
        {
            match = false;
            break;
        }
        //if(wordFamilies[level].phonemes[word][i] == -1) break;
    }
    
    // Recognize match
	if(match) {
    	//sounding.play(SfxChime);
		//sounding.play(SfxCat);
		
		sounding.play(/*SfxChime*/ *wordFamilies[level].words[word].sound);
        allSmiles();
        System::paint();
        state = WORD_FOUND;
	}
}
开发者ID:JimmySticks2001,项目名称:Phonemic,代码行数:45,代码来源:phonemic.cpp

示例3: soundOut

/**
  * Helper method to sounds out the sequence of cubes.
  */
void Phonemic::soundOut(unsigned id) {
    // Wait for audio channel to be clear
    if(sounding.isPlaying()) return;
    
    // Highlight the current cube
    cubes[id].vid.bg0.image(vec(0,0), *cubes[id].images[1]);
    System::paint();
    System::finish();
        
    // Play the current cube's sound
    sounding.play(*cubes[id].sound);
    while(sounding.isPlaying()) {
        System::yield();
    }
    
    // Return the cube to its normal appearance
    cubes[id].vid.bg0.image(vec(0,0), *cubes[id].images[0]);
    
    // Play any cube connected to the right
    Neighborhood hood = Neighborhood(id);
    if(hood.hasCubeAt(RIGHT)) soundOut(hood.cubeAt(RIGHT));
}
开发者ID:JimmySticks2001,项目名称:Phonemic,代码行数:25,代码来源:phonemic.cpp


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