Example #1
0
 def endGame(self):
     self.display()
     del self.ssg, self.plateau, self.currentPlayer
     self.ssg = None
     self.root = None
     self.graphWin.getMove()
     self.graphWin.stop()
     self.graphWin = None
     g = graphicTTT(self.pixelSize, matrix("2 2 2; 2 2 2; 2 2 2"), 1)
     suite = g.getChoise("New game", "Exit")
     g.window.close()
     if suite == 1:
         self.startGame()
Example #2
0
 def startGame(self):
     clear()
     t = Texttable()
     t.set_cols_align(["c", "c"])
     title = ["Choice", "Do you want to play first ?"]
     t.add_rows([title, ["1", "Yes"]])
     t.add_rows([title, ["0", "No"]])
     print t.draw()
     g = graphicTTT(self.pixelSize, matrix("2 2 2; 2 2 2; 2 2 2"), 1)
     first = g.getChoise("I play first", "Artificial intelligence plays first")
     g.window.close()
     if first:
         self.currentPlayer = 1
     else:
         self.currentPlayer = 0
     self.createPlateau()  # creation of the game plateau
     self.count = size(self.plateau)
     self.lineCount = getLineCount(self.plateau)
     self.play()  # starting to play
Example #3
0
 def displayGraph(self):
     if self.graphWin == None:
         self.graphWin = graphicTTT(self.pixelSize, self.plateau)  # creation
     else:
         self.graphWin.update(self.plateau)  # update