本文整理汇总了C++中Array2D::Select方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2D::Select方法的具体用法?C++ Array2D::Select怎么用?C++ Array2D::Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2D
的用法示例。
在下文中一共展示了Array2D::Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBoard
void Board::drawBoard()
{
int i, j;
std::cout << "Game Board" << std::endl;
std::cout << "**";
for (i = 0; i<m_gridSize; i++)
std::cout << "*";
std::cout << "**" << std::endl;
for (i = 0; i<m_gridSize; i++)
{
std::cout << "* ";
for (j = 0; j<m_gridSize; j++)
{
m_board->Select(i, j).drawCell();
}
std::cout << " *" << std::endl;
}
std::cout << "**";
for (i = 0; i<m_gridSize; i++)
std::cout << "*";
std::cout << "**" << std::endl;
}
示例2: print
void print(Array2D<T> myArray)
{
for (int i = 0; i < myArray.getRow(); i++)
{
for (int j = 0; j < myArray.getColumn(); j++)
{
cout << myArray.Select(i, j) << " ";
}
cout << endl;
}
}
示例3: getBombNum
int Board::getBombNum(int row, int col)
{
int count = 0;
if ((row>0) && (row<m_gridSize)) { //look up
if (m_board->Select(row - 1, col).getIsBomb()) { count++; }
}
if ((row>-1) && (row<m_gridSize - 1)) { //look down
if (m_board->Select(row + 1, col).getIsBomb()) { count++; }
}
if ((col>0) && (col<m_gridSize)) { //look left
if (m_board->Select(row, col - 1).getIsBomb()) { count++; }
}
if ((col>-1) && (col<m_gridSize - 1)) { //look right
if (m_board->Select(row, col + 1).getIsBomb()) { count++; }
}
if ((row>0) && (row<m_gridSize) && (col>-1) && (col<m_gridSize - 1)) { //look up/right
if (m_board->Select(row - 1, col + 1).getIsBomb()) { count++; }
}
if ((row>-1) && (row<m_gridSize - 1) && (col>-1) && (col<m_gridSize - 1)) { //look down/right
if (m_board->Select(row + 1, col + 1).getIsBomb()) { count++; }
}
if ((row>0) && (row<m_gridSize) && (col>0) && (col<m_gridSize)) { //look up/left
if (m_board->Select(row - 1, col - 1).getIsBomb()) { count++; }
}
if ((row>-1) && (row<m_gridSize - 1) && (col>0) && (col<m_gridSize)) { //look down/left
if (m_board->Select(row + 1, col - 1).getIsBomb()) { count++; }
}
return count;
}
示例4: changeState
void Board::changeState(char input, int x, int y)
{
m_board->Select(x, y).setState(input);
}