0
def take_turn(Nplayers, hands, player, pile, turn):
while finished(hands) is not True:
pile.append(hands[player][0]) # this line
hands[player].pop(0)
while pile[-1] <= 10:
print(turn, ':', '\nPile:', pile, '\nHands\n', '\n'.join(map(str, hands)), '\n')
check_players(Nplayers, hands, player, pile, turn)
turn += 1
player = (player + 1) % Nplayers
if len(hands[player]) == 0:
hands.pop(player)
Nplayers -= 1
player = player % Nplayers
pile.append(hands[player][0])
hands[player].pop(0)
if table[-1] > 10:
break
penalty_card(Nplayers, hands, player, pile, turn)
return turn
줄에 표시된 내용은 내 프로그램에서 제목에 표시된 오류를 반환합니다. 플레이어를 초기에 0으로 설정 했으므로 다음과 같이해야합니다. 아무런 문제가 없습니까?TypeError : 목록 색인은 목록이 아닌 정수 여야합니다.
편집 : 손이 목록의 목록입니다, 플레이어는 정수
'take_turn' 기능을 호출하는 추적 코드와 코드를 표시 할 수 있습니까? – falsetru
'손'과 '플레이어'는 무엇입니까? – karthikr
손이 목록의 목록입니다, 플레이어는 정수입니다, 코드는 수백 줄입니다 ... – harryjmm