Function parse_maze

Source
pub fn parse_maze(
    input: &str,
    padding: usize,
) -> Result<(Grid<u8>, usize, usize), InputError>
Expand description

Parse a “standard” maze with open tiles ., walls # and one start S and one end E.

Returns ((number of rows, number of columns, data), start index, end index) on success.

§Examples

assert_eq!(
    grid::parse_maze("...#S\n.#E#.\n.###.\n.....", 1).unwrap(),
    (
        (6, 7, vec![
            b'#', b'#', b'#', b'#', b'#', b'#', b'#',
            b'#', b'.', b'.', b'.', b'#', b'.', b'#',
            b'#', b'.', b'#', b'.', b'#', b'.', b'#',
            b'#', b'.', b'#', b'#', b'#', b'.', b'#',
            b'#', b'.', b'.', b'.', b'.', b'.', b'#',
            b'#', b'#', b'#', b'#', b'#', b'#', b'#',
        ]),
        12,
        17,
    )
);