update
This commit is contained in:
parent
b16030f661
commit
63d62aec4d
16 changed files with 193 additions and 165 deletions
|
|
@ -6,27 +6,27 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/12 21:13:51 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/12 23:37:23 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/01/17 15:32:25 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef COST_H
|
||||
#define COST_H
|
||||
# define COST_H
|
||||
|
||||
#include "app/element.h"
|
||||
#include "app/state.h"
|
||||
#include "app/types/type_cost.h"
|
||||
#include "me/types.h"
|
||||
# include "app/element.h"
|
||||
# include "app/state.h"
|
||||
# include "app/types/type_cost.h"
|
||||
# include "me/types.h"
|
||||
|
||||
t_cost alloc_cost(t_state *s);
|
||||
void free_cost(t_cost self);
|
||||
void calculate_cost(t_state *s);
|
||||
void cost_for_index(t_state *s, t_usize index);
|
||||
t_cost alloc_cost(t_state *s);
|
||||
void free_cost(t_cost self);
|
||||
t_cost *calculate_cost(t_state *s);
|
||||
void cost_for_index(t_state *s, t_usize index);
|
||||
|
||||
typedef struct s_cost_iter_state
|
||||
{
|
||||
t_cost *current_minimum;
|
||||
t_usize max_index;
|
||||
} t_cost_iter_state;
|
||||
t_cost *current_minimum;
|
||||
t_usize max_index;
|
||||
} t_cost_iter_state;
|
||||
|
||||
#endif /* COST_H */
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef DUP_STATE_H
|
||||
#define DUP_STATE_H
|
||||
# define DUP_STATE_H
|
||||
|
||||
#include "app/element.h"
|
||||
#include "me/types.h"
|
||||
# include "app/element.h"
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_dup_state
|
||||
{
|
||||
t_element *lhs;
|
||||
t_usize index_to_skip;
|
||||
bool found_dup;
|
||||
} t_dup_state;
|
||||
t_element *lhs;
|
||||
t_usize index_to_skip;
|
||||
bool found_dup;
|
||||
} t_dup_state;
|
||||
|
||||
#endif /* DUP_STATE_H */
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ELEMENT_H
|
||||
#define ELEMENT_H
|
||||
# define ELEMENT_H
|
||||
|
||||
#include "me/types.h"
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_element
|
||||
{
|
||||
t_i64 value;
|
||||
} t_element;
|
||||
t_i64 value;
|
||||
} t_element;
|
||||
|
||||
void free_element(t_element elem);
|
||||
void free_element(t_element elem);
|
||||
|
||||
#endif /* ELEMENT_H */
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef LIS_H
|
||||
#define LIS_H
|
||||
# define LIS_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_element.h"
|
||||
#include "me/vec/vec_i64.h"
|
||||
# include "me/types.h"
|
||||
# include "me/vec/vec_element.h"
|
||||
# include "me/vec/vec_i64.h"
|
||||
|
||||
t_vec_i64 lis(t_vec_element *elements);
|
||||
t_vec_i64 lis(t_vec_element *elements);
|
||||
|
||||
#endif /* LIS_H */
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MOVES_H
|
||||
#define MOVES_H
|
||||
# define MOVES_H
|
||||
|
||||
#include "app/element.h"
|
||||
#include "app/state.h"
|
||||
#include "app/types/type_move.h"
|
||||
# include "app/element.h"
|
||||
# include "app/state.h"
|
||||
# include "app/types/type_move.h"
|
||||
# include "me/types.h"
|
||||
|
||||
#include "me/types.h"
|
||||
|
||||
void do_move(t_move m, t_state *s);
|
||||
void do_move(t_move m, t_state *s);
|
||||
|
||||
#endif /* MOVES_H */
|
||||
|
|
|
|||
|
|
@ -11,20 +11,20 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef STATE_H
|
||||
#define STATE_H
|
||||
# define STATE_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_element.h"
|
||||
#include "me/vec/vec_cost.h"
|
||||
# include "me/types.h"
|
||||
# include "me/vec/vec_cost.h"
|
||||
# include "me/vec/vec_element.h"
|
||||
|
||||
typedef struct s_state
|
||||
{
|
||||
t_vec_element stack_a;
|
||||
t_vec_element stack_b;
|
||||
t_vec_cost costs;
|
||||
} t_state;
|
||||
t_vec_element stack_a;
|
||||
t_vec_element stack_b;
|
||||
t_vec_cost costs;
|
||||
} t_state;
|
||||
|
||||
t_state parses_arguments(t_usize count, t_str nums[]);
|
||||
void free_state(t_state state);
|
||||
t_state parses_arguments(t_usize count, t_str nums[]);
|
||||
void free_state(t_state state);
|
||||
|
||||
#endif /* STATE_H */
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPE_COST_H
|
||||
#define TYPE_COST_H
|
||||
# define TYPE_COST_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_moves.h"
|
||||
# include "me/types.h"
|
||||
# include "me/vec/vec_moves.h"
|
||||
|
||||
typedef struct s_cost
|
||||
{
|
||||
t_usize index;
|
||||
t_vec_moves moves;
|
||||
t_vec_moves moves;
|
||||
bool active;
|
||||
} t_cost;
|
||||
} t_cost;
|
||||
|
||||
#endif /* TYPE_COST_H */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPE_MOVE_H
|
||||
#define TYPE_MOVE_H
|
||||
# define TYPE_MOVE_H
|
||||
|
||||
typedef enum e_move
|
||||
{
|
||||
|
|
@ -26,6 +26,6 @@ typedef enum e_move
|
|||
REVERSE_ROTATE_A = 1 << 6,
|
||||
REVERSE_ROTATE_B = 1 << 7,
|
||||
REVERSE_ROTATE_BOTH = REVERSE_ROTATE_A | REVERSE_ROTATE_B,
|
||||
} t_move;
|
||||
} t_move;
|
||||
|
||||
#endif /* TYPE_MOVE_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue