From 177c23f535865cff086f0b911fa454801dea617c Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 18 Dec 2025 13:15:58 +0100 Subject: [PATCH] Slight tweak to simple algorithm to make no-op on sorted stack --- algorithm_simple.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/algorithm_simple.c b/algorithm_simple.c index 887046f..46eed27 100644 --- a/algorithm_simple.c +++ b/algorithm_simple.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* algorithm_selection_sort.c :+: :+: :+: */ +/* algorithm_simple.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: clefrere +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/12/09 15:43:09 by clefrere #+# #+# */ -/* Updated: 2025/12/16 14:54:44 by agilliar ### ########.fr */ +/* Updated: 2025/12/18 13:12:35 by agilliar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,6 +18,8 @@ void algorithm_simple(const t_stacks *stacks, t_closure cb) sorted = list_new(stacks->a); list_sort(sorted); + if (stacks_is_solved(stacks)) + return ; while (sorted.len) { if (stacks->a.list->val == sorted.ptr[0]) -- 2.51.0