commit a807ef91bc5f89521c8eaffe47cc1b7287162a80 parent b44a7fc1aef848a2e9e16f2c95b5eef9779dd507 Author: n0tr1v <n0tr1v@protonmail.com> Date: Sun, 30 Apr 2023 02:00:09 -0700 add doc Diffstat:
| M | src/lechatphp/captcha.rs | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lechatphp/captcha.rs b/src/lechatphp/captcha.rs @@ -173,6 +173,10 @@ fn solve_difficulty3(img: &DynamicImage) -> Result<String, CaptchaErr> { Ok(answer) } +// Bresenham algorithm will return an iterator of all the pixels that makes a line in between two points. +// From the starting letter, we trace a line to all other letters and count how many red pixels were on the line. +// The next letter will be the one that had the most red pixels. +// Repeat until we find the whole path. fn solve_path(starting: &Letter, letters_set: &HashSet<Letter>, img: &DynamicImage) -> String { let mut answer = String::new(); let mut remaining: HashSet<_> = letters_set.iter().collect();