trying to work
This commit is contained in:
parent
3d3d7a35ab
commit
2776ee1ebc
25 changed files with 1621 additions and 0 deletions
26
include/app/dup_state.h
Normal file
26
include/app/dup_state.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* dup_state.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 15:58:29 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/11 15:59:29 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef DUP_STATE_H
|
||||
#define DUP_STATE_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;
|
||||
|
||||
#endif /* DUP_STATE_H */
|
||||
25
include/app/element.h
Normal file
25
include/app/element.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* element.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 14:28:41 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/11 14:34:27 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ELEMENT_H
|
||||
#define ELEMENT_H
|
||||
|
||||
#include "me/types.h"
|
||||
|
||||
typedef struct s_element
|
||||
{
|
||||
t_i64 value;
|
||||
} t_element;
|
||||
|
||||
void free_element(t_element elem);
|
||||
|
||||
#endif /* ELEMENT_H */
|
||||
22
include/app/lis.h
Normal file
22
include/app/lis.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* lis.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 19:03:30 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/11 20:50:43 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef LIS_H
|
||||
#define LIS_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);
|
||||
|
||||
#endif /* LIS_H */
|
||||
37
include/app/moves.h
Normal file
37
include/app/moves.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* moves.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 16:13:08 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/11 16:18:49 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MOVES_H
|
||||
#define MOVES_H
|
||||
|
||||
#include "app/element.h"
|
||||
#include "app/state.h"
|
||||
#include "me/types.h"
|
||||
|
||||
typedef enum e_move
|
||||
{
|
||||
SWAP_A = 1 << 0,
|
||||
SWAP_B = 1 << 1,
|
||||
SWAP_BOTH = SWAP_A | SWAP_B,
|
||||
PUSH_A = 1 << 2,
|
||||
PUSH_B = 1 << 3,
|
||||
ROTATE_A = 1 << 4,
|
||||
ROTATE_B = 1 << 5,
|
||||
ROTATE_BOTH = ROTATE_A | ROTATE_B,
|
||||
REVERSE_ROTATE_A = 1 << 6,
|
||||
REVERSE_ROTATE_B = 1 << 7,
|
||||
REVERSE_ROTATE_BOTH = REVERSE_ROTATE_A | REVERSE_ROTATE_B,
|
||||
} t_move;
|
||||
|
||||
void do_move(t_move m, t_state *s);
|
||||
|
||||
#endif /* MOVES_H */
|
||||
28
include/app/state.h
Normal file
28
include/app/state.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* state.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/11 14:27:25 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/01/11 14:36:28 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef STATE_H
|
||||
#define STATE_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_element.h"
|
||||
|
||||
typedef struct s_state
|
||||
{
|
||||
t_vec_element stack_a;
|
||||
t_vec_element stack_b;
|
||||
} t_state;
|
||||
|
||||
t_state parses_arguments(t_usize count, t_str nums[]);
|
||||
void free_state(t_state state);
|
||||
|
||||
#endif /* STATE_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue