Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7be079

Browse files
Update README.md
1 parent 050ea28 commit c7be079

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

README.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# Lem In 🐜
22

33

4-
🇺🇸[Subject](https://cdn.intra.42.fr/pdf/pdf/6161/lem-in.en.pdf)
4+
🇺🇸 [Subject](https://cdn.intra.42.fr/pdf/pdf/6161/lem-in.en.pdf)
55

6-
🇫🇷[Subject](https://cdn.intra.42.fr/pdf/pdf/30232/fr.subject.pdf)
6+
🇫🇷 [Subject](https://cdn.intra.42.fr/pdf/pdf/30232/fr.subject.pdf)
77

8-
💦 Lem In is an algorithmic project about a [maximum flow problem](https://en.wikipedia.org/wiki/Maximum_flow_problem#:~:text=In%20optimization%20theory%2C%20maximum%20flow,such%20as%20the%20circulation%20problem.) in graph theory.
8+
💦 Lem In is an **algorithmic project** about a [maximum flow problem](https://en.wikipedia.org/wiki/Maximum_flow_problem#:~:text=In%20optimization%20theory%2C%20maximum%20flow,such%20as%20the%20circulation%20problem.) in graph theory.
99

10-
The goal is to find the **optimal flow of ants through an anthill** while minimizing the number of rounds to cross the anthill.
10+
The goal is to find the **optimal flow of ants through an anthill** while minimizing the number of rounds to cross it.
11+
12+
**Check that video** (from another student) to visualize what it is all about 💁🏼‍♀️
13+
14+
<a href="http://www.youtube.com/watch?feature=player_embedded&v=d5b5Xp5Ikuw
15+
" target="_blank"><img src="http://img.youtube.com/vi/d5b5Xp5Ikuw/0.jpg"
16+
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
1117

1218
## Ant farm description:
1319

@@ -29,14 +35,14 @@ in the following format:
2935
- **number** of ants
3036
- Ant farm **description**
3137

32-
There is **always a "start" room and an "end" room**. These rooms are preceded by a #start or #end comment.
38+
There is **always a "start" room and an "end" room**. These rooms are preceded by a `#start` or `#end` comment.
3339

3440
At the beginning, all ants are inside the **"start room"**.
3541
**The goal is to bring them to the "end room"**.
3642

3743
## Solution: improved Breadth-First Search (BFS)
3844

39-
The solution can be one or multiple paths.
45+
The solution can be one or multiple paths. If you have only one ant, you'll need only one path but if there is more than one ant, you might consider finding more paths 🔎
4046

4147
To find the best (and good number of) paths, I used an algorithm inspired by **[Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)**
4248

@@ -53,9 +59,14 @@ However, this solution is flawed because it may prevent the program to find mult
5359

5460
For example, this solution is not optimal because a BFS find **only one path** when the most efficient solution would be to find two paths.
5561

56-
### ✅ Bradth-first search + backtracking
62+
### ✅ Modified Bradth-first search
63+
64+
When looking for more than one path, we decided to **modify the BFS algorith** and **allow using a occupied room to find more path**.
65+
**The rule is:**
66+
- As long as we can find a new path without an occupied room, let's avoid occupied room.
67+
- But when we have no choice, let's make a try.
68+
- When we find a new solution (new path configuration), let's compare both solutions to find the most optimal one.
5769

58-
We decided to modify the BFS algorithm and **allow backtracking on a room already included in a path**. As a result, we can find the maximum number of available path we need to solve the issue.
5970

6071
<img src="https://raw.githubusercontent.com/marielisepicard/42lem_in/main/assets/improved_BFS.gif?token=AWE4BMTUG7ERRBVINVERHU3BYCJEG" width=50% height=50%>
6172

@@ -82,3 +93,7 @@ clone the project
8293
`./lem-in < map`
8394

8495
You can also create your own map 💁🏼‍♀️
96+
97+
## Credits
98+
99+
This project was made by @tlamart and @mpicard

0 commit comments

Comments
 (0)