Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GameBoard::place_knight(unsigned& row, unsigned& column)
- {
- if(!tour)
- {
- board[row * columns_ + column] = moveNumber;
- ++moves;
- ++moveNumber;
- callback_(*this, &board[0], MSG_PLACING, moves, rows_, columns_, row, column);
- if(policy_ == tpSTATIC)
- {
- std::vector<position> staticNumbers;
- position temp = { -1, -1};
- std::fill(staticNumbers.begin(), staticNumbers.end(), temp);
- calculateMoves(row, column, staticNumbers);
- /*if(staticNumbers.size() == 0)
- callback_(*this, &board[0], MSG_FINISHED_FAIL, moves, rows_, columns_, row, column);*/
- for(unsigned i = 0; i < staticNumbers.size(); ++i)
- {
- place_knight(staticNumbers[i].y, staticNumbers[i].x);
- --moveNumber;
- board[staticNumbers[i].y * columns_ + staticNumbers[i].x] = 0;
- callback_(*this, &board[0], MSG_REMOVING, moves, rows_, columns_, row, column);
- }
- }
- //if(policy_ == tpHEURISTICS)
- if(moves == totalSquares)
- {
- tour = true;
- callback_(*this, &board[0], MSG_FINISHED_OK, moves, rows_, columns_, row, column);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement