// Next advances the Maze path randomly and returns the new point
Next advances the Maze path randomly and returns the new point
// Next advances the Maze path randomly and returns the new point
func (maze *Maze) Next(point *Point) *Point {
	neighbors := maze.Neighbors(point)
	if len(neighbors) == 0 {
		return nil
	}
	direction := neighbors[rand.Int()%len(neighbors)]
	maze.Directions[point.X][point.Y] |= direction
	next := point.Advance(direction)
	maze.Directions[next.X][next.Y] |= Opposite[direction]
	return next
}
func ( maze * Maze ) Next ( point * Point ) * Point { neighbors := maze . Neighbors ( point ) if len ( neighbors ) == 0 { return nil } direction := neighbors [ rand . Int ( ) % len ( neighbors ) ] maze . Directions [ point . X ] [ point . Y ] |= direction next := point . Advance ( direction ) maze . Directions [ next . X ] [ next . Y ] |= Opposite [ direction ] return next }
Next advances the Maze path randomly and returns the new point
Next advances the Maze path randomly and returns the new point