can no longer override in a full column. need to fix non integer inp
This commit is contained in:
parent
f1cb1ddc74
commit
cb2c99c369
26
main.py
26
main.py
|
|
@ -31,7 +31,7 @@ def printBoard(board):
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
row = ""
|
row = ""
|
||||||
for column in board:
|
for column in board:
|
||||||
row += "|" + column[i]
|
row += "| " + column[i] + " "
|
||||||
row += "|"
|
row += "|"
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ def printBoard(board):
|
||||||
for row in rows:
|
for row in rows:
|
||||||
toPrint += (row + "\n")
|
toPrint += (row + "\n")
|
||||||
|
|
||||||
print(f"===============\n{toPrint[:-1]}\n===============")
|
print(f"=============================\n{toPrint[:-1]}\n=============================")
|
||||||
|
|
||||||
def getIntInput(prompt):
|
def getIntInput(prompt):
|
||||||
success = False
|
success = False
|
||||||
|
|
@ -77,18 +77,20 @@ turn = 'R'
|
||||||
|
|
||||||
while playing:
|
while playing:
|
||||||
clear()
|
clear()
|
||||||
|
printBoard(board)
|
||||||
|
|
||||||
chosenColumn = getIntInput(f"{turn} where do you want to drop your tile? 1-7.\n>>> ")
|
tile = ""
|
||||||
|
while tile == "":
|
||||||
try:
|
try:
|
||||||
tile = findLowest(board, chosenColumn)
|
chosenColumn = getIntInput(f"{turn} where do you want to drop your tile? 0-6.\n>>> ")
|
||||||
except ValueError:
|
tile = findLowest(board, chosenColumn)
|
||||||
print("You chose a column that is full. Try again")
|
break
|
||||||
|
except ValueError:
|
||||||
|
print("You chose a column that is full. Try again")
|
||||||
|
clear()
|
||||||
|
printBoard(board)
|
||||||
|
tile = ""
|
||||||
|
|
||||||
board[chosenColumn][tile] = turn
|
board[chosenColumn][tile] = turn
|
||||||
|
|
||||||
printBoard(board)
|
|
||||||
|
|
||||||
input()
|
|
||||||
|
|
||||||
turn = 'Y' if turn == 'R' else 'R'
|
turn = 'Y' if turn == 'R' else 'R'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user