not much done today ^^"

WIP push_swap sort
This commit is contained in:
Tanguy MAZE 2019-03-05 18:21:58 +01:00
parent 87261ffddb
commit ac9b03acff
2 changed files with 41 additions and 2 deletions

View File

@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */ /* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/25 12:44:08 by tmaze #+# #+# */ /* Created: 2019/02/25 12:44:08 by tmaze #+# #+# */
/* Updated: 2019/03/02 18:20:51 by tmaze ### ########.fr */ /* Updated: 2019/03/03 13:59:43 by tmaze ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -73,5 +73,5 @@ int is_op(char *buff)
i = 0; i = 0;
while (i < 11 && ft_strcmp(buff, ops[i]) != 0) while (i < 11 && ft_strcmp(buff, ops[i]) != 0)
i++; i++;
return (i < 11 && ft_strcmp(buff, ops[i]) == 0); return (i < 11);
} }

39
srcs/push_swap.c Normal file
View File

@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/03 11:41:49 by tmaze #+# #+# */
/* Updated: 2019/03/05 18:19:58 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void sort(t_psdata *data, int sortby)
{
int i;
int j;
if (sortby => 2)
sort(data, sortby / 2);
i = data->size_a / sortby;
j = sortby;
}
int main(int ac, char **av)
{
t_psdata data;
ps_initdata(&data);
ret = 0;
if (!get_params(&data, ac, av))
return (0);
new = data.a;
if (new == NULL)
ft_putendl("Empty");
sort(&data, ((data.size_a % 2) ? data.sizea + 1 : data.size_a) / 2);
}