mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
Add bench mode and algo in t_stacks
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/08 14:32:10 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/12/12 11:39:17 by dgaillet ### ########lyon.fr */
|
||||
/* Updated: 2026/01/08 13:52:59 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -17,14 +17,20 @@ void ra(t_stacks *stacks)
|
||||
{
|
||||
if (stacks && stacks->a && stacks->a->next)
|
||||
stacks->a = stacks->a->next;
|
||||
write(1, "ra\n", 3);
|
||||
if (stacks->bench)
|
||||
stacks->ra++;
|
||||
else
|
||||
write(1, "ra\n", 3);
|
||||
}
|
||||
|
||||
void rb(t_stacks *stacks)
|
||||
{
|
||||
if (stacks && stacks->b && stacks->b->next)
|
||||
stacks->b = stacks->b->next;
|
||||
write(1, "rb\n", 3);
|
||||
if (stacks->bench)
|
||||
stacks->rb++;
|
||||
else
|
||||
write(1, "rb\n", 3);
|
||||
}
|
||||
|
||||
void rr(t_stacks *stacks)
|
||||
@@ -33,5 +39,8 @@ void rr(t_stacks *stacks)
|
||||
stacks->a = stacks->a->next;
|
||||
if (stacks && stacks->b && stacks->b->next)
|
||||
stacks->b = stacks->b->next;
|
||||
write(1, "rr\n", 3);
|
||||
if (stacks->bench)
|
||||
stacks->rr++;
|
||||
else
|
||||
write(1, "rr\n", 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user