todo list

This commit is contained in:
Vincent Rodley 2025-08-02 10:51:13 +12:00
parent eb184b9a7d
commit 498c4c453b
2 changed files with 9 additions and 5 deletions

View File

@ -5,3 +5,6 @@ This will eventually become a connect-4 game written in Python with an AI oppone
I will make and train the AI myself.
I might make a GUI in Pygame, depends if i cbs
todo list:
3 gamemodes total. ~~player vs player on the same device~~, player vs player lan, and player vs computer

11
main.py
View File

@ -29,9 +29,8 @@ def printBoard(board):
{Colours.BOLD}==1===2===3===4===5===6===7=={Colours.END}""")
def getIntInput(prompt):
success = False
inp = ""
while not success:
while True:
inp = input(prompt)
try:
inp = int(inp)
@ -39,7 +38,7 @@ def getIntInput(prompt):
except:
clear()
printBoard(board)
print("Only integers allowed")
print("Only positive integers 1-7 allowed")
return inp
@ -109,17 +108,19 @@ while playing:
while True:
try:
chosenColumn = getIntInput(f"{colourTile(player)} where do you want to drop your tile? 1-7.\n>>> ") - 1
if chosenColumn <= 0:
raise IndexError
tile = board[chosenColumn].index("O")
break
except ValueError:
clear()
printBoard(board)
print(f"{Colours.BOLD}You chose a column that is full.{Colours.END} Try again")
print(f"{Colours.BOLD}You chose a column that is full. Try again{Colours.END}")
tile = ""
except IndexError:
clear()
printBoard(board)
print(f"{Colours.BOLD}You chose a column outside of the board.{Colours.END} Try again")
print(f"{Colours.BOLD}You chose a column outside of the board. Try again{Colours.END}")
tile = ""
board[chosenColumn][tile] = player