derniere erreur de valgrind resolu mais a tester sur les mauvais tetri
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,3 +13,7 @@ a\.out
|
||||
fillit
|
||||
|
||||
test_fillit\.c
|
||||
|
||||
libft
|
||||
|
||||
\.DS_Store
|
||||
|
||||
2
Makefile
2
Makefile
@@ -6,7 +6,7 @@
|
||||
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# #
|
||||
# Updated: 2019/05/17 17:11:53 by hulamy ### ########.fr #
|
||||
# Updated: 2019/05/29 14:03:03 by vmanzoni ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
||||
@@ -18,5 +18,7 @@ Le but de ce projet est d’agencer les Tetriminos entre eux pour former le plus
|
||||
|
||||
## BONUS
|
||||
- [x] Best error handler (more details on why there is an error.)
|
||||
- [ ] Optimisation
|
||||
- [ ] Add colors to tetri when printing result map
|
||||
- [x] Optimisation (skip when tetri with same shape was already tested on map)
|
||||
- [x] Add colors to tetri when printing result map
|
||||
- [x] Flag for debbuging (print every step in backtracking)
|
||||
- [x] Adding flags (and password for blocking more args on moulinette)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* handle_errors.c :+: :+: :+: */
|
||||
/* f_handle_errors.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/05/29 15:51:12 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/05/29 15:52:44 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
char *read_file(char *file)
|
||||
{
|
||||
char buf[BUFF_SIZE];
|
||||
int fd;
|
||||
int rv;
|
||||
int i;
|
||||
char *result;
|
||||
char buf[BUFF_SIZE];
|
||||
int fd;
|
||||
size_t rv;
|
||||
int i;
|
||||
char *result;
|
||||
|
||||
if (((fd = open(file, O_RDONLY)) < 0) \
|
||||
|| ((rv = read(fd, &buf, BUFF_SIZE)) < 0) \
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* search_map.c :+: :+: :+: */
|
||||
/* f_search_map.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/27 20:47:22 by hulamy #+# #+# */
|
||||
/* Updated: 2019/05/28 18:19:15 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/05/29 13:37:51 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -135,14 +135,14 @@ int fill_map(unsigned int *map, t_fillist *list, int size)
|
||||
}
|
||||
|
||||
/*
|
||||
** function that send to "fill_map" a map of a certain size
|
||||
** Function that send to "fill_map" a map of a certain size
|
||||
** and increment its size untill it's solved
|
||||
*/
|
||||
|
||||
int search_map(t_fillist *list)
|
||||
{
|
||||
t_fillist *tmp;
|
||||
unsigned int *map;
|
||||
unsigned int *map = NULL;
|
||||
int size;
|
||||
int num;
|
||||
int i;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.fillit</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
25
fillit.h
25
fillit.h
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/05/28 16:51:44 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/05/29 13:31:37 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,10 +14,9 @@
|
||||
# define FILLIT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> // for system call write
|
||||
#include <fcntl.h> // for system call open
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h> // for printf (DELETE BEFORE EVAL)
|
||||
|
||||
#include "libft/includes/libft.h"
|
||||
|
||||
@@ -35,6 +34,10 @@
|
||||
#define CYN "\x1B[36m"
|
||||
#define RESET "\x1B[0m"
|
||||
|
||||
/*
|
||||
** Color for full block tetriminos when printing colored map
|
||||
** (don't forget to comment all #define COLOR above)
|
||||
*/
|
||||
//#define RED "\e[41m"
|
||||
//#define GRN "\e[42m"
|
||||
//#define YEL "\e[43m"
|
||||
@@ -53,12 +56,12 @@
|
||||
** rank : position de 1 a 32 dans l'int du tableau d'int (position % 32)
|
||||
** num : memorise dans quel int du tableau on se trouve (position / 32)
|
||||
** test :
|
||||
** letter :
|
||||
** dope :
|
||||
** memory :
|
||||
** same :
|
||||
** next :
|
||||
** start :
|
||||
** letter : letter of the tetrimino for printing final map
|
||||
** dope : flags for details, optimisation, printing and error
|
||||
** memory : positions already tested by a tetrimino in bitwise
|
||||
** same : pointer to previous identical tetrimino
|
||||
** next : pointer to next tetrimino
|
||||
** start : pointer to first tetrimino of input file
|
||||
*/
|
||||
typedef struct s_fillist
|
||||
{
|
||||
@@ -140,6 +143,6 @@ char *init_print_map(t_fillist *list, int size);
|
||||
void print_letter_map(t_fillist *list, int size, int flag);
|
||||
void print_final_map(t_fillist *list, int size);
|
||||
|
||||
void ft_put_tetri_color(char c);
|
||||
void ft_put_tetri_color(char c);
|
||||
|
||||
#endif
|
||||
|
||||
8
main.c
8
main.c
@@ -6,14 +6,14 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/05/28 17:26:07 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/05/29 13:27:14 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "fillit.h"
|
||||
|
||||
/*
|
||||
** function that put the flags for bonus into a tab of int
|
||||
** Function that put the flags for bonus into a tab of int
|
||||
**
|
||||
** d : debug print (print the map during the backtracking)
|
||||
** o : optimisation ultra fast but with some errors still
|
||||
@@ -45,7 +45,7 @@ int *create_dope(char *av, int mdp)
|
||||
}
|
||||
|
||||
/*
|
||||
** function that check if the password is good to unlock the flags
|
||||
** Function that check if the password is good to unlock the flags
|
||||
*/
|
||||
|
||||
int is_mdp(int ac, char **av)
|
||||
@@ -67,7 +67,7 @@ int is_mdp(int ac, char **av)
|
||||
}
|
||||
|
||||
/*
|
||||
** main function
|
||||
** Main function
|
||||
*/
|
||||
|
||||
int main(int ac, char **av)
|
||||
|
||||
@@ -47,43 +47,3 @@
|
||||
.#..
|
||||
##..
|
||||
....
|
||||
|
||||
.#..
|
||||
.#..
|
||||
##..
|
||||
....
|
||||
|
||||
...#
|
||||
...#
|
||||
..##
|
||||
....
|
||||
|
||||
#...
|
||||
###.
|
||||
....
|
||||
....
|
||||
|
||||
.#..
|
||||
.#..
|
||||
##..
|
||||
....
|
||||
|
||||
.#..
|
||||
.#..
|
||||
##..
|
||||
....
|
||||
|
||||
...#
|
||||
...#
|
||||
..##
|
||||
....
|
||||
|
||||
#...
|
||||
###.
|
||||
....
|
||||
....
|
||||
|
||||
.#..
|
||||
.#..
|
||||
##..
|
||||
....
|
||||
|
||||
Reference in New Issue
Block a user