-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculate_moves_utils.c
More file actions
36 lines (33 loc) · 1.31 KB
/
calculate_moves_utils.c
File metadata and controls
36 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* calculate_moves_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amacarul <amacarul@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 15:24:34 by amacarul #+# #+# */
/* Updated: 2024/10/17 15:45:34 by amacarul ### ########.fr */
/* */
/* ************************************************************************** */
#include "libpush_swap.h"
//Clear the values ra_movs, rb_movs, rr_movs, etc. of a node
void clear_moves(t_node *node)
{
node->ra_movs = 0;
node->rb_movs = 0;
node->rr_movs = 0;
node->rra_movs = 0;
node->rrb_movs = 0;
node->rrr_movs = 0;
node->total_moves = 0;
}
//Returns the min value of two given values
int min_of_two(int val1, int val2)
{
if (val1 < val2)
return (val1);
else if (val2 < val1)
return (val2);
else
return (val1);
}