Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10896: astar_maze.cpp: Debug assertion under Windows MSVC-12
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-12-16 14:35:48
#10896: astar_maze.cpp: Debug assertion under Windows MSVC-12
-------------------------------+----------------------
Reporter: georg@⦠| Owner: jewillco
Type: Bugs | Status: new
Milestone: To Be Determined | Component: graph
Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Comment (by anonymous):
A simpler solution would be to have random_maze function return a pointer
to maze, as below.
maze* random_maze(std::size_t x, std::size_t y) {
maze* m = new maze(x, y);
vertices_size_type n = num_vertices(m->m_grid);
vertex_descriptor s = m->source();
vertex_descriptor g = m->goal();
// One quarter of the cells in the maze should be barriers.
int barriers = n / 4;
while (barriers > 0) {
// Choose horizontal or vertical direction.
std::size_t direction = random_int(0, 1);
// Walls range up to one quarter the dimension length in
this direction.
vertices_size_type wall = random_int(1,
m->length(direction) / 4);
// Create the wall while decrementing the total barrier
count.
vertex_descriptor u = vertex(random_int(0, n - 1),
m->m_grid);
while (wall) {
// Start and goal spaces should never be barriers.
if (u != s && u != g) {
wall--;
if (!m->has_barrier(u)) {
m->m_barriers.insert(u);
barriers--;
}
}
vertex_descriptor v = m->m_grid.next(u,
direction);
// Stop creating this wall if we reached the
maze's edge.
if (u == v)
break;
u = v;
}
}
return m;
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10896#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC