here's the code and i have ran out of ideas. i've tried changing the indenting, but it didn't work either. the purpose of the nim game is: "a player sets up 2 piles of blocks, the second player chooses whether to go first or second, they each take turns removing blocks (in this case instead of blocks i put -) the players have to remove at least one or not more than 3 blocks from any pile, whichever player takes the last block wins.
from math import *
from random import randint
pile1 = randint(1,20)
pile2 = randint(1,20)
player= 1
print("it's,"+str(player ) +' playing')
while pile1+pile2>0 :
if pile1>0:
print ('pile 1 :'+'-'*pile1)
if pile2>0:
print('pile 2:'+'-'*pile2)
break
which_pile=int(input('On which pile would you like to play ? : '))
while which_pile !=1 and which_pile != 2:
which_pile=int(input('On which pile would you like to play ? : '))
tokens=int(input('How many tokens would you like to take ? : '))
if which_pile==1:
while tokens<1 or tokens>min(3,pile1):
tokens=int(input('How many tokens would you like to take ? : '))
pile1-=tokens
else:
while tokens<1 or tokens>min(3,pile2):
tokens=int(input('How many tokens would you like to take ? : '))
pile2-=tokens