Created
April 5, 2020 09:21
-
-
Save mariokostelac/a865bbcacd05980a8a1ae84d7797c08b to your computer and use it in GitHub Desktop.
Revisions
-
mario-at-intercom revised this gist
Apr 5, 2020 . 1 changed file with 120 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,120 @@ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ x■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx ■■■■■■■■■x ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx x■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx ■■■■■■■■■x ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx x■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx ■■■■■■■■■x ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx x■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx ■■■■■■■■■x ■■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx x■■■■■■■■■ ■■■■■■■■■■ xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx ■■■■■■■■■x -
mario-at-intercom created this gist
Apr 5, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ i = 0 def dfs(arr, x, y): if x < 0 or x >= len(arr) or y < 0 or y >= len(arr[0]): return if arr[x][y] == 'x': return arr[x][y] = 'x' global i; i+=1 if i % len(arr)-1 == 0: p(arr) dfs(arr, x, y+1) dfs(arr, x-1, y) dfs(arr, x, y-1) dfs(arr, x+1, y) def p(arr): for row in arr: print(''.join(row)) print() arr = [['■']*10 for _ in range(10)] if __name__ == "__main__": p(arr) dfs(arr, 0, 0)