Comments
This commit is contained in:
parent
25876a36d5
commit
1414cdf0d7
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
Binary file not shown.
BIN
obj/parsing.o
BIN
obj/parsing.o
Binary file not shown.
Binary file not shown.
BIN
obj/printing.o
BIN
obj/printing.o
Binary file not shown.
BIN
obj/solution.o
BIN
obj/solution.o
Binary file not shown.
|
@ -6,12 +6,17 @@
|
||||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/04 21:46:57 by tischmid #+# #+# */
|
/* Created: 2023/04/04 21:46:57 by tischmid #+# #+# */
|
||||||
/* Updated: 2023/04/05 10:03:19 by tischmid ### ########.fr */
|
/* Updated: 2023/04/05 10:31:15 by tischmid ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "solution.h"
|
#include "solution.h"
|
||||||
|
|
||||||
|
// Replace each cell by the number of obstacles a rectangle starting
|
||||||
|
// from the top left cell, filling the board until the cell in question,
|
||||||
|
// covers. Border is inclusive. This will enable us to check if a given
|
||||||
|
// square contains obstacles or not in O(1) time, instead of O(n^2),
|
||||||
|
// namely by summing up the corner cells alternatingly (+, -, +, -, clockwise).
|
||||||
void preprocess_map(t_map *map)
|
void preprocess_map(t_map *map)
|
||||||
{
|
{
|
||||||
int is_obstacle;
|
int is_obstacle;
|
||||||
|
@ -29,7 +34,6 @@ void preprocess_map(t_map *map)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (idx - 1 - map->meta.width < 0
|
|
||||||
int count_obstacles(t_map *map, int idx, int sq_size)
|
int count_obstacles(t_map *map, int idx, int sq_size)
|
||||||
{
|
{
|
||||||
int alternat_corner_sum;
|
int alternat_corner_sum;
|
||||||
|
|
Loading…
Reference in New Issue