Untitled
unknown
plain_text
2 years ago
560 B
2
Indexable
Never
map = [ " ", " ", " %%%% ", " % ", " % %%%", " % " ] for i in range(6): for j in range(6): if map[i][j] != " ": continue if i > 0 and map[i-1][j] == " ": print(f" (connected loc-x{i}-y{j} loc-x{i-1}-y{j})") elif i < 5 and map[i+1][j] == " ": print(f" (connected loc-x{i}-y{j} loc-x{i+1}-y{j})") elif j > 0 and map[i][j-1] == " ": print(f" (connected loc-x{i}-y{j} loc-x{i-1}-y{j-1})") elif j < 5 and map[i][j+1] == " ": print(f" (connected loc-x{i}-y{j} loc-x{i-1}-y{j+1})")