inticoy/so_long

map validation

Closed this issue · 1 comments

  • The map must be rectangular
  • The map must be closed/surrounded by walls
  • You have to check if there's a valid path in the map
  • You must be able to parse any kind of map, as long as it respects the above rules.
  • If any misconfiguration of any kind is encountered in the file, the program must exit in a clean way, and return "Error\n" followed by an explicit message of your choice.
  1. Open map file by "open"
    -> if return value of O_DIRECTORY > 0 : directory
    -> if return value of O_RDONLY < 0 : unavailable
  2. Get number of lines of map file by "get_num_line(path)"
  3. malloc char **
  4. while get_next_line
  5. check rectangular
  6. check closed by walls
  7. check E, P, C
  8. check valid path