Untitled
map0 = [ '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', '000000000000000000000000000000', ] ################################################# Ro = { '41x' : +4, '41y' : +1, '42x' : +1, '42y' : +4, 4 : { 's' : 4, 1:'1111', 2:'1002', 3:'1001', 1:'1211'}, '51x' : +5, '51y' : +1, '52x' : -1, '52y' : +3, 5 : { 's' : 5, 1:'11111', 2:'10002', 3:'10011', 4:'20001', 5:'11111'}, } def CreateBorder(data): for y, tiles in enumerate(data): for x, item in enumerate(tiles): match y: case 0: tiles = '1'*30 case 25: tiles = '1'*30 if y not in [0,25]: tiles = tiles[-1:0]+'10'+tiles[1+1:-1]+'1' data[y] = tiles return data def SpaceCheck(x, y, lenght): coords = [[x, y], ] for i in range(1,lenght): coords.append() return coords def CreateRoom(data, roomn): try: match roomn['s']: case 5: for y, tiles in enumerate(data): for x, item in enumerate(tiles): if data[y][:x] + '0' + data[y][x+1:] == data[y]: coords = SpaceCheck(x, y, roomn['s']) data[y] = tiles except IndexError: pass except KeyError: pass return data map0 = CreateBorder(map0) map0 = CreateRoom(map0, Ro[5]) for i in map0: print(i)
Leave a Comment