1 ‐ Parsing and checking input - shoganaix/42Cub3d GitHub Wiki

  • check arg : nargs, extension

read .cub file

A .cub file contains:

  • path to north texture (string)
  • path to south texture (string)
  • path to east texture (string)
  • path to west texture (string)
  • colour of ceiling (colour)
  • colour of floor (colour)
  • map string (0/1/space)
  • map width
  • map height
  • character initial position (x, y)
  • character initial orientation [N/S/E/W] (char)

Tasks

  • load info + checks
  • info always comes before map - test
  • load map
  • map checks
    • valid chars
      • space, 0, 1, playerChar (only one)
      • only one char representing the player
      • " " with 1s ok, " " with 0 KO
    • closed map. Surrounded by 1s. - flood fill algo
      • spaces in between not allowed (flood fill?)
      • newlines in between not allowed (flood fill?)
      • spaces outside walls are supported (flood fill?)