void moveTower(int n, char start, char finish, char temp) { if (n == 1) moveSingle(start, finish); else { moveTower(n-1, start, temp, finish); moveSingle(start, finish); moveTower(n-1, temp, finish, start); } }
void movePyramid(size_t pyramid_size, SimpleStack<size_t> & from, SimpleStack<size_t> & to, SimpleStack<size_t> & temp) { if (pyramid_size == 0) { return; } movePyramid(pyramid_size - 1, from, temp, to); moveSingle(from, to); movePyramid(pyramid_size - 1, temp, to, from); }
bool Character::move(Cell& c, bool moveWanted) { //LOGINFO << _name << " is moving from " << *_hisCell << " to " << c << endl; list<Cell*> path = GAMEINST->getGrid()->pathFinder.getPathAStar(_hisCell, &c); try{ if (_rooted) throw " I cannot move when I am tied to the ground !"; else if (path.empty()) throw "no path found"; else if (path.size() > (unsigned int)_movementPoints && moveWanted) throw "not enough movement point"; for (Cell* c : path) { moveSingle(*c, moveWanted); } } catch (const char* msg) { LOGERR << "cannot move: " << msg << endl; return false; } return true; }