This commit is contained in:
Timo Schmidt 2023-04-05 10:36:06 +02:00
parent 25876a36d5
commit 1414cdf0d7
8 changed files with 6 additions and 2 deletions

BIN
obj/io.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,12 +6,17 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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"
// 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)
{
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 alternat_corner_sum;