ads "Cpomuter as Player 2"
This commit is contained in:
parent
3992834712
commit
b2b8458f73
17
main.py
17
main.py
@ -38,14 +38,16 @@ def player_names2():
|
|||||||
|
|
||||||
|
|
||||||
def gamers():
|
def gamers():
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
pl_ai = input(
|
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
|
"Gegen den Computer spielen,\ndie 1 drücken.\nFür 2 Spieler die 2 drücken.\n") # pl_ai player or künstliche
|
||||||
# intelligenz
|
# intelligenz
|
||||||
pl_ai = int(pl_ai)
|
pl_ai = int(pl_ai)
|
||||||
if pl_ai == 1:
|
if pl_ai == 1:
|
||||||
name_player1 = player_names1()
|
name_player1 = player_names1()
|
||||||
return name_player1
|
name_player2 = 'Computer'
|
||||||
|
return name_player1, name_player2
|
||||||
if pl_ai == 2:
|
if pl_ai == 2:
|
||||||
name_player1 = player_names1()
|
name_player1 = player_names1()
|
||||||
name_player2 = player_names2()
|
name_player2 = player_names2()
|
||||||
@ -53,10 +55,17 @@ def gamers():
|
|||||||
else:
|
else:
|
||||||
print("Bitte nur 1 oder 2 wählen!")
|
print("Bitte nur 1 oder 2 wählen!")
|
||||||
continue
|
continue
|
||||||
|
except ValueError:
|
||||||
|
print("Bitte nur 1 oder 2 wählen!")
|
||||||
|
gamers() # Hier steht nachher main() drin!
|
||||||
|
|
||||||
|
|
||||||
one_two = [gamers()]
|
one_two = gamers()
|
||||||
print(one_two)
|
|
||||||
|
name_player1 = one_two[0]
|
||||||
|
name_player2 = one_two[1]
|
||||||
|
print(one_two[0], one_two[1])
|
||||||
|
|
||||||
|
|
||||||
def p_field(): # p_ = print. Damit wird das Spielfeld aus der Liste field auf der Konsole ausgegeben
|
def p_field(): # p_ = print. Damit wird das Spielfeld aus der Liste field auf der Konsole ausgegeben
|
||||||
print("")
|
print("")
|
||||||
|
Loading…
Reference in New Issue
Block a user