Created
August 19, 2020 12:29
-
-
Save TibebeJS/e91fe1456c9e4a80ff6b6f6e5300a89f to your computer and use it in GitHub Desktop.
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 characters
from random import shuffle | |
def generateCol(start, end): | |
num_pool = [num if num != 0 else 1 for num in range(start, end)] | |
shuffle(num_pool) | |
return num_pool[:5] | |
board = [ | |
generateCol((x - 1) * 15, x * 15) | |
for x in range(1, 5 + 1) | |
] | |
def printBoard(): | |
print(''.join(map(lambda x: f"[{x.center(4, ' ')}]", [ | |
'B', 'I', 'N', 'G', 'O' | |
]))) | |
print('------------------------------') | |
for row_counter in range(5): | |
row = zip(map(lambda a: a[row_counter], board)) | |
for y in row: | |
print(f"[{str(y[0]).zfill(0).center(4, ' ')}]", end='') | |
print() | |
printBoard() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment