dancing links fixed

This commit is contained in:
Yaroslav Kolomiets 2016-12-20 20:19:28 +02:00
parent 0672fb0538
commit 78320824fc
2 changed files with 62 additions and 58 deletions

View file

@ -12,67 +12,71 @@
#include "fillit.h" #include "fillit.h"
// t_col *add_column(t_col *root) t_node *add_column(t_node *root)
// { {
// t_col *new_col; t_node *new_col;
// new_col = (t_col*)malloc(sizeof(t_col)); new_col = (t_node*)malloc(sizeof(t_node));
// new_col->down = (void*)new_col; new_col->down = new_col;
// new_col->up = (void*)new_col; new_col->up = new_col;
// new_col->left = root->left; new_col->left = root->left;
// new_col->right = root; new_col->right = root;
// return (new_col); new_col->row = -1;
// } new_col->column = NULL;
return (new_col);
}
// t_node *add_node(t_col *col, int row) t_node *add_node(t_node *col, int row)
// { {
// t_node *new_node; t_node *new_node;
// new_node = (t_node*)malloc(sizeof(t_node)); new_node = (t_node*)malloc(sizeof(t_node));
// new_node->row = row; new_node->row = row;
// new_node->up = (t_node*)col->up; new_node->up = col->up;
// new_node->down = (t_node*)col; new_node->down = col;
// col->up->down = new_node; col->up->down = new_node;
// col->up = new_node; col->up = new_node;
// return (new_node); return (new_node);
// } }
// void cover(t_col *to_cover) void cover(t_col *to_cover)
// { {
// void *step_vert; void *step_vert;
// t_node *step_horiz; t_node *step_horiz;
// to_cover->left->right = to_cover->right; to_cover->left->right = to_cover->right;
// to_cover->right->left = to_cover->left; to_cover->right->left = to_cover->left;
// step_vert = to_cover->down; step_vert = to_cover->down;
// while (step_vert != (void*)to_cover) while (step_vert != to_cover)
// { {
// step_horiz = (t_node*)step_vert->right; step_horiz = step_vert->right;
// while (step_horiz != (t_node*)step_vert) { while (step_horiz != step_vert) {
// step_horiz->down->up = step_horiz->up; step_horiz->down->up = step_horiz->up;
// step_horiz->up->down = step_horiz->down; step_horiz->up->down = step_horiz->down;
// step_horiz = step_horiz->right; step_horiz = step_horiz->right;
// } }
// step_vert = (t_node*)step_vert->down; step_vert = step_vert->down;
// } }
// } }
// void uncover(t_col *to_uncover) void uncover(t_col *to_uncover)
// { {
// void *step_vert; void *step_vert;
// t_node *step_horiz; t_node *step_horiz;
// step_vert = to_uncover->up; step_vert = to_uncover->up;
// while (step_vert != (void*)to_uncover) while (step_vert != to_uncover)
// { {
// step_horiz = (t_node*)step_vert->left; step_horiz = step_vert->left;
// while (step_horiz != (t_node*)step_vert) while (step_horiz != step_vert)
// { {
// step_horiz->down->up = step_horiz; step_horiz->down->up = step_horiz;
// step_horiz->up->down = step_horiz; step_horiz->up->down = step_horiz;
// step_horiz = step_horiz->left; step_horiz = step_horiz->left;
// } }
// step_vert = (t_node*)step_vert->up; step_vert = step_vert->up;
// } }
// } to_uncover->left->right = to_uncover;
to_uncover->right->left = to_uncover;
}

View file

@ -6,7 +6,7 @@
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */ /* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/14 17:12:30 by gtertysh #+# #+# */ /* Created: 2016/12/14 17:12:30 by gtertysh #+# #+# */
/* Updated: 2016/12/14 17:12:32 by gtertysh ### ########.fr */ /* Updated: 2016/12/20 20:06:22 by ykolomie ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -43,4 +43,4 @@ char **glue_figure(char **table)
free(table[i++]); free(table[i++]);
free(table); free(table);
return (ttr_table); return (ttr_table);
} }