Add bench mode and algo in t_stacks

This commit is contained in:
2026-01-08 13:54:29 +00:00
parent 765ec373e5
commit 2ba9029955
6 changed files with 84 additions and 21 deletions

View File

@@ -6,7 +6,7 @@
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/08 14:48:44 by mteriier #+# #+# */
/* Updated: 2025/12/12 11:38:52 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/08 13:53:40 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,10 @@ void sa(t_stacks *stacks)
stock = a->value;
a->value = a->next->value;
a->next->value = stock;
write(1, "sa\n", 3);
if (stacks->bench)
stacks->sa++;
else
write(1, "sa\n", 3);
}
void sb(t_stacks *stacks)
@@ -38,7 +41,10 @@ void sb(t_stacks *stacks)
stock = b->value;
b->value = b->next->value;
b->next->value = stock;
write(1, "sb\n", 3);
if (stacks->bench)
stacks->sb++;
else
write(1, "sb\n", 3);
}
void ss(t_stacks *stacks)
@@ -63,5 +69,8 @@ void ss(t_stacks *stacks)
a->value = a->next->value;
a->next->value = stock;
}
write(1, "ss\n", 3);
if (stacks->bench)
stacks->ss++;
else
write(1, "ss\n", 3);
}