# Looking for constructive feedback on my first github Elixir project

**URL:** <https://forum.elixirforum.com/t/looking-for-constructive-feedback-on-my-first-github-elixir-project/40871>\
**Category:** Questions\
**Tags:** library-question\
**Created:** [July 6, 2021, 12:06pm UTC](https://forum.elixirforum.com/t/looking-for-constructive-feedback-on-my-first-github-elixir-project/40871 "2021-07-06T12:06:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [July 7, 2021, 12:48am UTC](https://forum.elixirforum.com/t/looking-for-constructive-feedback-on-my-first-github-elixir-project/40871/2 "2021-07-07T00:48:08Z")

</div>

Hello and welcome,

Disclaimer… I did not read the book **Mazes for programmers**.

I do not like the use of Agent to store visited cells, just to manage a map. It is started/stopped in the same function.

It’s possible to do without processes. I translated your code to Rust, for fun (and learning).

```elixir
pub struct RecursiveBacktrack {
    visited: HashMap<Coordinate, bool>
}

impl RecursiveBacktrack {
    pub fn new() -> Self {
        Self {
            visited: HashMap::new(),
        }
    }

    pub fn carve(&mut self, grid: &mut Grid) {
        let mut rng = thread_rng();

        let x: usize = rng.gen_range(0, grid.width);
        let y: usize = rng.gen_range(0, grid.height);

        let starting_coordinate = Coordinate(x, y);

        self.do_carve(grid, starting_coordinate, starting_coordinate)
    }

    fn do_carve(&mut self, grid: &mut Grid, current: Coordinate, last: Coordinate) {
        match self.visited.get(&current) {
            Some(_) => (),
            None => {
                self.visited.insert(current, true);
                grid.open_passage(current, last);

                let mut neighbors = grid.neighbors(&current);
                neighbors.shuffle(&mut thread_rng());

                for neighbor in neighbors {
                    self.do_carve(grid, neighbor, current);
                }
            },
        }
    }
}

```

and the result

```elixir
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | | | | | | | | | | | | | | | | | | | |
+---+---+ + + +---+ + + + + +---+ + + + +---+ + + +
| | | | | | | | | | |    
+---+ +---+---+ +---+ +---+ +---+ + +---+---+ + + +---+ + +
| | | | | | | | | | | |    
+---+---+ +---+ + + +---+ +---+ +---+ +---+ +---+ + +---+ +
| | | | | | | | | | | |
+---+---+---+ + + +---+ +---+ + +---+ + + +---+ + + + +
| | | | | | | | | | | | | | | |    
+---+---+---+ + + +---+ +---+ + + +---+ + +---+ +---+---+---+
| | | | | | | |                        
+---+ +---+---+ +---+ + +---+---+ +---+---+ +---+ +---+---+ +---+
| | | | | | | | | |    
+---+---+---+ +---+---+ + + +---+---+ + + +---+ +---+---+---+ +
| | | | | | | | | |                
+---+ + +---+---+ +---+---+---+ +---+ + +---+ + + +---+---+---+
| | | | | | | |        
+---+---+---+---+---+ + +---+---+---+ +---+---+ +---+ + + + +---+
| | | | | | | | | | |    
+---+---+ + +---+---+ +---+---+ + +---+ +---+ +---+---+---+ + +
| | | | | | | | | |
+---+ +---+ + + + +---+ + +---+ +---+ +---+---+---+ + + +
| | | | | | | | | | | | | |
+---+---+ + + +---+ +---+ +---+ +---+---+ + + +---+---+ + +
| | | | | | | | | | | |    
+---+ + + +---+ +---+ +---+---+ +---+ + + + + + + +---+
| | | | | | | | | | | | | | | |    
+---+ + +---+ +---+---+ + +---+---+ + + + + + +---+---+ +
| | | | | | | | | |
+---+---+ + +---+---+---+ +---+ + +---+---+ +---+ + + +---+ +
| | | | | | | | | | |        
+---+---+ +---+ + +---+ + + +---+ + +---+---+ +---+ +---+---+
| | | | | | | | | |    
+---+ +---+ +---+ +---+---+---+ +---+---+ + +---+ +---+---+ + +
| | | | | | | | | |    
+---+---+ +---+ +---+ + +---+---+---+---+---+ + +---+---+---+ +---+
| | | | | |                        
+---+ +---+ + +---+ +---+ +---+ +---+ +---+---+---+---+---+---+---+
| | | | | | | | | | | | | |    
+---+ + + + + + + + + + + + + +---+ + +---+ + +

```

I don’t know if Agent are used to solve the maze, but You can generate without 🙂

---

_[View the full topic](https://forum.elixirforum.com/t/looking-for-constructive-feedback-on-my-first-github-elixir-project/40871)._
