Skip to content

Instantly share code, notes, and snippets.

@TibebeJS
Created August 19, 2020 12:29
Show Gist options
  • Save TibebeJS/e91fe1456c9e4a80ff6b6f6e5300a89f to your computer and use it in GitHub Desktop.
Save TibebeJS/e91fe1456c9e4a80ff6b6f6e5300a89f to your computer and use it in GitHub Desktop.
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