mirror of
https://github.com/LucasCodeur/alcu.git
synced 2026-04-28 17:44:34 +02:00
FEAT: add vector, fix standard input
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-7
@@ -6,20 +6,24 @@
|
||||
/* By: lud-adam <lud-adam@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/03/28 13:27:29 by lud-adam #+# #+# */
|
||||
/* Updated: 2026/03/28 21:41:55 by dgaillet ### ########lyon.fr */
|
||||
/* Updated: 2026/03/29 14:58:00 by lud-adam ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ALCU_H
|
||||
# define ALCU_H
|
||||
|
||||
# include <stddef.h>
|
||||
#include "vector.h"
|
||||
|
||||
char *read_file(int fd);
|
||||
int check_input(int fd);
|
||||
void print_board(int *game_state, size_t nb_line);
|
||||
int *fill_array(int fd, int size);
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
char *read_file(int fd);
|
||||
bool check_input(t_vector* lines);
|
||||
void print_board(int *game_state, size_t nb_line);
|
||||
bool fill_vector(t_vector* lines, int fd);
|
||||
int ai(int *gamestate, int nb_line);
|
||||
void game(int *lines, int size);
|
||||
void game(int *lines, int size);
|
||||
int* fill_array(t_vector* lines, int* size);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,46 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* vector.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lud-adam <lud-adam@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/03/29 14:24:01 by lud-adam #+# #+# */
|
||||
/* Updated: 2026/03/29 14:40:21 by lud-adam ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef VECTOR_H
|
||||
# define VECTOR_H
|
||||
|
||||
#define VECTOR_INIT_CAPACITY 6
|
||||
#define UNDEFINE -1
|
||||
#define SUCCESS 0
|
||||
|
||||
#define VECTOR_INIT(vec) t_vector vec;\
|
||||
vector_init(&vec)
|
||||
|
||||
typedef struct s_vector_list
|
||||
{
|
||||
void **items;
|
||||
int capacity;
|
||||
int total;
|
||||
} t_vector_list;
|
||||
|
||||
typedef struct s_vector t_vector;
|
||||
|
||||
struct s_vector
|
||||
{
|
||||
t_vector_list vector_list; /**< List to store vector elements */
|
||||
int (*pfVectorTotal)(t_vector *); /**< Retrieves the total number of elements in the vector */
|
||||
int (*pfVectorResize)(t_vector *, int); /**< Resizes the vector to a new capacity */
|
||||
int (*pfVectorAdd)(t_vector *, void *); /**< Adds an element to the vector */
|
||||
int (*pfVectorSet)(t_vector *, int, void *); /**< Sets an element at a specific index in the vector */
|
||||
void *(*pfVectorGet)(t_vector *, int); /**< Retrieves an element from the vector */
|
||||
int (*pfVectorDelete)(t_vector *, int); /**< Deletes an element from the vector */
|
||||
int (*pfVectorFree)(t_vector *); /**< Frees the memory allocated for the vector */
|
||||
};
|
||||
|
||||
void vector_init(t_vector* v);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user