在python地图中生成道路

时间:2018-07-12 02:35:17

标签: python

我想知道如何在python中连接两个房间,现在它会生成类似的内容:

###################################################
#..............#########..........................#
#..............#       #...........#########......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#########...........#       #......#
#..................................#########......#
#.................................................#
#.................................................#
#.................................................#
#..#########......................................#
#..#       #......................................#
#..#       #....####################..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#########....#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#.#####.........####################..............#
#.#   #...........................................#
#.#   #...........................................#
#.#   #...........................................#
#.#   #.........##########........................#
#.#   #.........#        #........................#
#.#   #.........#        #........................#
#.#####.........#        #........................#
#...............##########........................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
###################################################

我希望它生成类似这样的东西

###################################################
#..............#########..........................#
#..............#       #...........#########......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #...........#       #......#
#..............#       #############       #......#
#..............#                           #......#
#..............#       #############       #......#
#..............##### ###...........#       #......#
#..................# #.............#########......#
#..................# #............................#
#..................# #............................#
#..................# #............................#
#..#########.......# #............................#
#..#       #.......# #............................#
#..#       ######### ###############..............#
#..#                               #..............#
#..#       ######                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#       #....#                  #..............#
#..#########....#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#...............#                  #..............#
#.#####.........####### ############..............#
#.#   #...............# #.........................#
#.#   #...............# #.........................#
#.#   #...............# #..........................#
#.#   #.........####### ##........................#
#.#   ###########        #........................#
#.#                      #........................#
#.###############        #........................#
#...............##########........................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
#.................................................#
###################################################

我该怎么做?

地图存储为嵌套列表[[]],因此对于4x4地图,它看起来像这样[[],[],[],[]],我将列表的大小存储为一个值self.size的类与[x,y]一起存储在列表中。

预先感谢

0 个答案:

没有答案