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


C++ Position::Col方法代码示例

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


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

示例1: ShowCellState

void Maze::ShowCellState(const Position &p, const CellState dist) const
{
   const char CurPosChar = '+';     // Current position display character
   const unsigned curPosX = 35;              // X location to display current position
   const unsigned curPosY = 2;               // Y location to display current position
   const char PathMarkChar = 'P';   // Mark the path if found.

   // Display the numeric current position (x, y).
   gotoxy( curPosX, curPosY);
   cout << "Position: (" << p.Col() << ", " << p.Row() << ")";

   // Display the new distance.
   gotoxy(CellWidth*p.Col() + ColOffset, CellHeight*p.Row() + RowOffset);

   // Wait and then change and display the new cell mark character.
   Delay(MsPerSec/speed);

   cout.width(CellWidth-1);
   if (dist == PathCell)
      // If cell is on the shortest path, display the PathMarkChar.
      cout << PathMarkChar;
   else
      // Otherwise, display the cell's distance from the start.
      cout << dist;
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:25,代码来源:Maze.cpp

示例2: State

CellState Maze::State(const Position &cellPos) const
{
   // If the position is off the grid, it is illegal.
   if (cellPos.Row() < 0 || cellPos.Row() >= GridSize)
      return Obstacle;
   if (cellPos.Col() < 0 || cellPos.Col() >= GridSize)
      return Obstacle;

   // Start and goal are considered open.
   if (  cell[cellPos.Row()][cellPos.Col()] == StartCell ||
         cell[cellPos.Row()][cellPos.Col()] == GoalCell)
      return Open;

   // Use the stored cell distance.
   return cell[cellPos.Row()][cellPos.Col()];
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:16,代码来源:Maze.cpp

示例3: Mark

void Maze::Mark(const Position &p, const CellState newState)
{
   logFile << "Mark (" << p.Row() << ", " << p.Col() << ") = " << newState << endl;

   // Mark the cell with its new distance.
   cell[p.Row()][p.Col()] = newState;
#if NoGraphics
   // Wait and then change and display the new cell mark character.
   Delay(MsPerSec/speed);

   cout << endl;
   
   Show();
#else
   ShowCellState(p, newState);
#endif   
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:17,代码来源:Maze.cpp

示例4: IsOpen

bool Maze::IsOpen(const Position &cellPos) const
{
   // If the position is off the grid, it is illegal.
   if (cellPos.Row() < 0 || cellPos.Row() >= GridSize)
      return false;
   if (cellPos.Col() < 0 || cellPos.Col() >= GridSize)
      return false;

   // The start and goal cells are open until visited.
   if (cell[cellPos.Row()][cellPos.Col()] == StartCell)	// 10-16-2003 - gpc
      return true;
   if (cell[cellPos.Row()][cellPos.Col()] == GoalCell)	// 10-16-2003 - gpc
      return true;

   // Use the stored cell state.
   return cell[cellPos.Row()][cellPos.Col()] == Open;
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:17,代码来源:Maze.cpp

示例5: ShowCell

void Maze::ShowCell(const Position &p, const CellState state) const
{
   const unsigned MsPerSec = 1000;        // Number of ms. in one second
   const char CurPosChar = '+';  // Current position display character
   const unsigned curPosX = 15;           // X location to display current position
   const unsigned curPosY = 2;            // Y location to display current position

   // Display the numeric current position (x, y).
   gotoxy( curPosX, curPosY);
   cout << "Position: (" << p.Col() << ", " << p.Row() << ")";

   // Display the new state.
   gotoxy(p.Col()+1, p.Row()+1);

   // Wait and then change and display the new state character.
//   Delay(MsPerSec/speed);

   cout << state;
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:19,代码来源:Maze.cpp

示例6: MarkPathCell

void Maze::MarkPathCell(const Position &p)
{
   cell[p.Row()][p.Col()] = PathCell;

#if NoGraphics
   Show();
#else
   ShowCell(p, PathCell);
#endif
   // Wait and then change and display the new state character.
   Delay(MsPerSec/speed);
}
开发者ID:jazzywhit,项目名称:Data-Structures,代码行数:12,代码来源:Maze.cpp


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