merging solve conflict
This commit is contained in:
BIN
.test_mask.c.swp
Normal file
BIN
.test_mask.c.swp
Normal file
Binary file not shown.
14
Makefile
14
Makefile
@@ -6,32 +6,30 @@
|
||||
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# #
|
||||
# Updated: 2019/04/16 15:35:04 by hulamy ### ########.fr #
|
||||
# Updated: 2019/04/16 16:39:00 by vmanzoni ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
NAME = fillit
|
||||
|
||||
OBJ_DIR = objs./
|
||||
HEADER = includes./
|
||||
HEADER = fillit.h
|
||||
|
||||
SRCS = *.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LIB = fillit.h
|
||||
LIB = libft/
|
||||
|
||||
CC = gcc
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Werror -Wextra
|
||||
|
||||
RM = rm -rf
|
||||
RM = rm -rf
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME):
|
||||
make -C libft/
|
||||
$(CC) $(CFLAGS) -I$(HEADER) -c $(SRCS)
|
||||
$(CC) -o $(NAME) $(OBJS) -L libft/ -lft
|
||||
#$(CC) $(CFLAGS) -I$(HEADER) -c $(addprefix $(SRC_DIR), $(SRCS))
|
||||
#$(CC) $(OBJS) -o $(NAME)
|
||||
$(CC) -o $(NAME) $(OBJS) -L $(LIB) -lft
|
||||
mkdir $(OBJ_DIR)
|
||||
mv $(OBJS) $(OBJ_DIR)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */
|
||||
/* Updated: 2019/04/16 16:08:24 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/04/18 10:56:38 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
4
main.c
4
main.c
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/15 20:54:24 by vmanzoni ### ########.fr */
|
||||
/* Updated: 2019/04/16 16:41:28 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -24,12 +24,10 @@ int main(int argc, char **argv)
|
||||
print_error("Error: Invalid file.\n");
|
||||
parse_input(input);
|
||||
/*
|
||||
Transform input to tetriminos
|
||||
Backtracking for smallest square
|
||||
Transform tetriminos with letters
|
||||
Print result
|
||||
*/
|
||||
//print_test(input);
|
||||
}
|
||||
else
|
||||
print_error("Usage: Please submit a file.\n");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/15 14:48:14 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/16 16:08:03 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/04/18 10:56:19 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -35,7 +35,6 @@ char **create_square(char *tetri)
|
||||
square[i][k] = *(tetri++);
|
||||
while (*tetri == '\n')
|
||||
tetri++;
|
||||
// printf("%s\n", square[i]);
|
||||
i++;
|
||||
}
|
||||
return (square);
|
||||
@@ -56,7 +55,6 @@ void parse_input(char *input)
|
||||
while (j < 19)
|
||||
tetri[j++] = input[i++];
|
||||
tetri[19] = '\0';
|
||||
//printf("PRINT:\n%s\n", tetri);
|
||||
if (check_tetri_errors(tetri))
|
||||
print_error("Error: Tetrimino not valid.");
|
||||
test = create_square(tetri);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/01 13:35:48 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/15 00:11:22 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/04/16 16:41:46 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,8 +18,3 @@ void ft_print_fillit()
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void print_test(char *test)
|
||||
{
|
||||
write(1, test, strlen(test));
|
||||
}
|
||||
|
||||
92
test_mask.c
Normal file
92
test_mask.c
Normal file
@@ -0,0 +1,92 @@
|
||||
#include "libft.h"
|
||||
|
||||
void print_bits(int octet)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
i = 1 << 12;
|
||||
// i = 4096;
|
||||
while (i >>= 1)
|
||||
(octet & i) ? ft_putnbr(1) : ft_putnbr(0);
|
||||
ft_putchar('\n');
|
||||
}
|
||||
|
||||
void compare(int initial, int compare)
|
||||
{
|
||||
compare ^= (1 << 3);
|
||||
print_bits(compare);
|
||||
ft_putchar('\n');
|
||||
|
||||
/*
|
||||
// il faut utiliser le & car il transforme
|
||||
// 0+0=0 1+0=0 0+1=0 mais 1+1=1
|
||||
// donc si rien ne se superpose on obtient 0
|
||||
// et si un seul bit se superpose on obtient 1
|
||||
// (penser a l'utiliser a l'envers donc)
|
||||
*/
|
||||
|
||||
while (initial & compare)
|
||||
{
|
||||
print_bits(initial);
|
||||
print_bits(compare);
|
||||
print_bits(initial & compare);
|
||||
!(initial & compare) ? ft_putendl("&: fit") : ft_putendl("&: not fit");
|
||||
compare >>= 1;
|
||||
}
|
||||
print_bits(initial);
|
||||
print_bits(compare);
|
||||
print_bits(initial & compare);
|
||||
!(initial & compare) ? ft_putendl("&: fit") : ft_putendl("&: not fit");
|
||||
|
||||
/*
|
||||
// j = 1 << 12;
|
||||
// while (j >>= 1)
|
||||
// (initial | compare) & j ? ft_putnbr(1) : ft_putnbr(0);
|
||||
// ft_putchar('\n');
|
||||
// (initial | compare) ? ft_putendl("|: fit") : ft_putendl("|: not fit");
|
||||
// j = 1 << 12;
|
||||
// while (j >>= 1)
|
||||
// (initial ^ compare) & j ? ft_putnbr(1) : ft_putnbr(0);
|
||||
// ft_putchar('\n');
|
||||
// (initial ^ compare) ? ft_putendl("^: fit") : ft_putendl("^: not fit");
|
||||
*/
|
||||
}
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
// i = 56173;
|
||||
// j = 9362;
|
||||
i = 9622;
|
||||
j = 27;
|
||||
if (ac > 0)
|
||||
{
|
||||
if (ac > 1)
|
||||
ft_putendl(ft_convertbase(av[1], "0123456789", "01"));
|
||||
print_bits(i);
|
||||
print_bits(j);
|
||||
compare(i, j);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
**int main(int ac, char **av)
|
||||
**{
|
||||
** int init;
|
||||
** int mask;
|
||||
**
|
||||
** mask = (1 << 4);
|
||||
** if (ac == 4)
|
||||
** {
|
||||
** ft_putendl(ft_convertbase(av[1], av[2], av[3]));
|
||||
** ft_putnbrendl(init);
|
||||
** init |= mask;
|
||||
** ft_putnbrendl(init);
|
||||
** }
|
||||
** return (0);
|
||||
**}
|
||||
*/
|
||||
Reference in New Issue
Block a user