0
您好我一直在尝试在Python中构建井字游戏,因此我正在检查相邻符号的列表清单。我知道代码并不优雅。但我主要关心的是,这个例程给我随机结果。你们能看到为什么吗?Python。相邻空格列表检查列表
def winx(self):
if self.current_table [0][0] and self.current_table [0][1] and self.current_table[0][2]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [1][0] and self.current_table [1][1] and self.current_table[1][2]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [2][0] and self.current_table [2][1] and self.current_table[2][2]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [0][0] and self.current_table [1][0] and self.current_table[2][0]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [0][1] and self.current_table [1][1] and self.current_table[2][1]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [0][2] and self.current_table [1][2] and self.current_table[2][2]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [0][0] and self.current_table [1][1] and self.current_table[2][2]== "x":
print "Good Boy, you won"
self.winner=1
elif self.current_table [0][2] and self.current_table [1][1] and self.current_table[2][0]== "x":
print "Good Boy, you won"
self.winner=1
else:
self.winner=None "
Maan ....我的大脑融化了..谢谢! – 2014-08-30 20:28:11