calculateNextPos