change structure of folders
This commit is contained in:
1 parent
61ab2df755
commit
c10382b0c0
20 files changed
No files matched your search
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from termcolor import colored
|
||||
|
||||
def show(tile):
|
||||
for line in tile:
|
||||
print(colored(''.join(line), 'blue'))
|
||||
print('\n')
|
||||
|
||||
def fliph(tile):
|
||||
next = ['n'] * 10
|
||||
for i in range(0,len(tile)):
|
||||
next[i] = tile[len(tile)-i-1]
|
||||
return next
|
||||
|
||||
def flipv(tile):
|
||||
for i in range(0, len(tile)):
|
||||
tile[i] = tile[i][::-1]
|
||||
return tile
|
||||
|
||||
def rotate(tile):
|
||||
next = [['o' for i in range(len(tile[0]))] for j in range(len(tile))]
|
||||
for i in range(0, len(tile)):
|
||||
for j in range(0, len(tile[1])):
|
||||
next[len(tile[1])-j-1][i] = tile[i][j]
|
||||
return next
|
||||
|
||||
def options(tile):
|
||||
return [tile,
|
||||
fliph(tiles[t]),
|
||||
rotate(tiles[t]),
|
||||
rotate(rotate(tiles[t])),
|
||||
rotate(rotate(rotate(tiles[t]))),
|
||||
fliph(rotate(tiles[t])),
|
||||
fliph(rotate(rotate(tiles[t]))),
|
||||
fliph(rotate(rotate(rotate(tiles[t]))))]
|
||||
|
||||
if __name__ == '__main__':
|
||||
tilestrings = open(sys.argv[1]).read().split('\n\n')
|
||||
tiles = {}
|
||||
for tile in tilestrings:
|
||||
tid, *data = tile.split('\n')
|
||||
try:
|
||||
tid = tid.rstrip(':').split(' ')[1]
|
||||
except IndexError: continue
|
||||
grid = [[c for c in line] for line in data if len(line) >= 1]
|
||||
tiles[int(tid)] = grid
|
||||
for t in tiles:
|
||||
print(colored(str(t), 'red'))
|
||||
|
||||
|
||||
Reference in new issue
Block a user