From 39928347125c45cbb739d0ccbaf810b798f50cb1 Mon Sep 17 00:00:00 2001 From: punix Date: Mon, 15 Jul 2024 20:58:31 +0200 Subject: [PATCH] part one try to add computer as a player --- main.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ca82d92..aa79a77 100755 --- a/main.py +++ b/main.py @@ -37,10 +37,27 @@ def player_names2(): pl_names = False -name_player1 = player_names1() -name_player2 = player_names2() +def gamers(): + while True: + pl_ai = input( + "Gegen den Computer spielen, die 1 drücken.\nFür 2 Spieler die 2 drücken.") # pl_ai player or künstliche + # intelligenz + pl_ai = int(pl_ai) + if pl_ai == 1: + name_player1 = player_names1() + return name_player1 + if pl_ai == 2: + name_player1 = player_names1() + name_player2 = player_names2() + return name_player1, name_player2 + else: + print("Bitte nur 1 oder 2 wählen!") + continue +one_two = [gamers()] +print(one_two) + def p_field(): # p_ = print. Damit wird das Spielfeld aus der Liste field auf der Konsole ausgegeben print("") print(" " + field[1] + "|" + field[2] + "|" + field[3])