我想制作一个连接4游戏,但它涉及列表清单 . 让's say if there is a ' counter ' in column 1, then I would have to add 1 to the list name (line1 -> line2). I' ve使用了字典,但我最终得到了元组错误和不可用的类型列表错误 .
这里's what I'得到了:
col1 = 0
col2 = 0
col3 = 0
col4 = 0
col5 = 0
col6 = 0
col7 = 0
line7 = [0,0,0,0,0,0,0]
line6 = [0,0,0,0,0,0,0]
line5 = [0,0,0,0,0,0,0]
line4 = [0,0,0,0,0,0,0]
line3 = [0,0,0,0,0,0,0]
line2 = [0,0,0,0,0,0,0]
line1 = [0,0,0,0,0,0,0]
alllist = {
line1,
line2,
line3,
line4,
line5,
line6,
line7,
}
a1 = int(input("What column do you want to place your counter on? "))
line1[(a1-1)] = (1)
if line1[0] == (1):
col1 += 1
b1 = randrange(1,7)
b2 = random.choice(line1,line2,line3,line4,line5,line6,line7)
if b1 == col1:
alllist[(0)+1] = (2)
一条错误消息:
TypeError:不可用类型:'list'
任何帮助,将不胜感激!