Cave Map
A port of the Cellular Automata Method for generating random cave-like levels to Rust.
Example
cave_map 45 45 45 5 1 6
W[0](p) = rand[0, 100) < 45
Repeat 6: W'(p) = R[1](p) >= 5 || R[2](p) <= 1
#############################################
#.#####....#####...##.......####...###..###.#
#######....#####..####.....######..###..#####
#.#####.....###...####....#######..###..###.#
#...###..#........#####...##...##..###..###.#
#....##..###.....###.#######.......####..##.#
###..##..#####..####.######.......#####..##.#
###..##..#####..###########......######..####
#....###........##########........#.......###
#...####.........##..#####...###............#
#...####..#####.......####...####....#..#...#
#....##..#######.......##....####.......##..#
###......#######...##.........##..#.....#...#
###......#######..####...###......##........#
#.##......#####...####..####.....#........###
#.##...............##....##...............###
###...##.....................##...##......###
###..###.....####......##...###..####.....###
#....###....##############..###..#####......#
#....###....##############..###..######.....#
#...#####....############....#....#####...###
#..######.......########..........##..##..###
#.#######..##....#######..##...#..##..##..###
#..#####..#####...#######..#####..######..###
#..####...######..#######..#####..#####..##.#
#..###...#######..######..###..##..####..##.#
#.###...#######....####...#.........##..###.#
#.##...######............##..##.....##..###.#
####..######.....##....####..##....###...####
###..######.......########...##...#####...#.#
###..######....#..######..........######..#.#
###...#####...###..#####..###......##########
####...###.....#...#####..######....##..#####
#####..###..#.....######..#######...##..#####
######..##..##....######......##...###..###.#
######..##..#.....##..##..........####..###.#
#####..####....#..........##.....#####.####.#
#.#....####...###...##...####....##########.#
#.....####.....#...####..####.........#######
##...####.........#####...##.............####
##..####..###......###..........##........###
##..###...####..........##......###.......###
#...###..######........######..#######....###
#...###...#####........######...######....#.#
#############################################