()
| 119 | return t |
| 120 | |
| 121 | def main(): |
| 122 | # Create a "canvas" to draw the tiles on: |
| 123 | canvas = {} |
| 124 | for x in range(WIDTH): |
| 125 | for y in range(HEIGHT): |
| 126 | canvas[(x, y)] = ' ' |
| 127 | |
| 128 | for x in range(0, WIDTH, 5): |
| 129 | for y in range(0, HEIGHT, 5): |
| 130 | # Choose a random tile, rotate it a random number of times: |
| 131 | tile = rotateTileClockwise(random.choice(TILES), random.randint(0, 3)) |
| 132 | drawTile(tile, x, y, canvas) |
| 133 | |
| 134 | # Create a string from the canvas dictionary: |
| 135 | allRows = [] |
| 136 | for y in range(HEIGHT): |
| 137 | row = [] |
| 138 | for x in range(WIDTH): |
| 139 | row.append(canvas[(x, y)]) |
| 140 | allRows.append(''.join(row)) |
| 141 | canvasStr = '\n'.join(allRows) |
| 142 | |
| 143 | print(canvasStr) |
| 144 | |
| 145 | # Copy the canvas to the clipboard if pyperclip is installed: |
| 146 | try: |
| 147 | import pyperclip |
| 148 | pyperclip.copy(canvasStr) |
| 149 | except: |
| 150 | pass # Do nothing if pyperclip is not installed. |
| 151 | |
| 152 | main() # After defining all the functions, call main() to start the game. |
no test coverage detected