Skip to content

Instantly share code, notes, and snippets.

@gunnarig
Created October 14, 2018 21:06
Show Gist options
  • Save gunnarig/77a63630940fe4c2b782945da8faa1f1 to your computer and use it in GitHub Desktop.
Save gunnarig/77a63630940fe4c2b782945da8faa1f1 to your computer and use it in GitHub Desktop.
def user_input_dimentions():
not_correct_input = True
while not_correct_input == True:
try:
boardDimentions = int(input("enter width of board: "))
not_correct_input = False
except ValueError:
print("please stop being an idiot")
return boardDimentions
def make_board(boardDimentions):
width_list = []
for i in range(boardDimentions):
for j in range(boardDimentions):
#print(str((j+1)+(i*boardDimentions)) + " ", end='')
width_list.append(int((j+1)+(i*boardDimentions)))
chunks = [width_list[x:x+boardDimentions] for x in range(0, len(width_list), boardDimentions)]
#print(width_list)
#print(chunks)
return chunks
def make_col(a_list_of_lists):
allColumns = []
for j in range(len(list)):
column = [ listi[i][j] for i in range(len(list)) ]
print(column)
allColumns.append(column)
def main():
board_list = make_board(user_input_dimentions())
make_col(board_list)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment