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


C++ block::size方法代码示例

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


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

示例1: can_place

bool Game::can_place(block b, Point p)
{
  bool onAbsCorner = false;
  bool onRelCorner = false;
  int N = dimension - 1;

  Point corners[4] = { Point(0,0), Point(N, 0), Point(0, N), Point(N, N) };
  Point corner = corners[my_number];
  for(int i = 0; i < b.size(); i++){
    Point q = b[i].add(p);
    int x = q.x;
    int y = q.y;
    if (x > N || x < 0 || y < 0 || y > N || grid[x][y] >= 0
        || grid[x][y] == -2
        || (x > 0 && grid[x-1][y] == my_number)
        || (y > 0 && grid[x][y-1] == my_number)
        || (x < N && grid[x+1][y] == my_number)
        || (y < N && grid[x][y+1] == my_number)) {
      return false;
    }

    onAbsCorner = onAbsCorner || q.eq(corner);
    onRelCorner = onRelCorner
      || (x > 0 && y > 0 && grid[x-1][y-1] == my_number)
      || (x < N && y > 0 && grid[x+1][y-1] == my_number)
      || (x > 0 && y < N && grid[x-1][y+1] == my_number)
      || (x < N && y < N && grid[x+1][y+1] == my_number);
  }

  return grid[corner.x][corner.y] < 0 ? onAbsCorner : onRelCorner;
}
开发者ID:ManasGeorge,项目名称:AWAP,代码行数:31,代码来源:game.cpp

示例2: rotate_block

block Game::rotate_block(block b, int num_rotations)
{
  block newBlock;
  for(int i = 0; i < b.size(); i++){
    newBlock.push_back(b[i].rotate(num_rotations));
  }
  return newBlock;
}
开发者ID:ManasGeorge,项目名称:AWAP,代码行数:8,代码来源:game.cpp

示例3: resetUsed

void bGroup::resetUsed(block & t)
{
	//-------- resets the log of what blocks have been used in the last print stage
	used[""]=false;
	used[t.title]=false;
	for (unsigned int i=0; i<t.numInside(); i++) {
		resetUsed(t.blocksIn[i]);
	}
	for (unsigned int i=0; i<t.size(); i++) {
		resetUsed(t.blocksOn[i]);
	}
}
开发者ID:heidgera,项目名称:RoboBlocks,代码行数:12,代码来源:blocks_WriteOutFuncs.cpp

示例4: resetList

void resetList(block & t, map<string,bool> & used)
{
	//-------- resets the log of what blocks have been used in the last print stage
	used[""]=false;
	used[t.title]=false;
	for (unsigned int i=0; i<t.numInside(); i++) {
		resetList(t.blocksIn[i],used);
	}
	for (unsigned int i=0; i<t.size(); i++) {
		resetList(t.blocksOn[i],used);
	}
}
开发者ID:heidgera,项目名称:RoboBlocks,代码行数:12,代码来源:blocks_WriteOutFuncs.cpp

示例5: heightUpdate

int bGroup::heightUpdate(block & grab, block & comp)
{
	int ret=0;
	for (unsigned int i=0; i<comp.numInside(); i++) {
		heightUpdate(grab, comp.blocksIn[i]);
	}
	for (unsigned int i=0; i<comp.size(); i++) {
		heightUpdate(grab, comp.blocksOn[i]);
	}
	if(comp.blockIsInside(grab)&&!comp.bSeq&&!grab.numBlock){
		if(!comp.inBlockIn(grab.x,grab.y)) comp.h=grab.heightOnlyOn(true)+comp.heightInside()+grab.h+65-((!comp.numInside())?40:0);
		else comp.h=comp.heightInside()+65-((!comp.numInside())?40:0);
		comp.updatePositions(grab);
	}
	return ret;
}
开发者ID:heidgera,项目名称:RobotBlocks,代码行数:16,代码来源:blocks.cpp

示例6: score_move

//Currently returns 0, you might want to modify this yourself!
int Game::score_move(block b, Point p)
{
  int score = 0;
  int blockSize = b.size();
  int bonus_points = 0;
  int N = dimension;

  for(int i = 0; i < blockSize; i++){
    Point s = b[i].add(p);
    for(int j = 0; j < bonus_squares.size(); j++){
      if(s.eq(bonus_squares[j])){
        bonus_points += 2;
      }
      area_enclosed = max(area_enclosed, -1 * (s.distance(Point(N/2, N/2))));
    }
  }

  return score;
}
开发者ID:ManasGeorge,项目名称:AWAP,代码行数:20,代码来源:game.cpp


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