Ejemplo n.º 1
0
 def setGridGame(self, gameName):
     if gameName == 'Random':
         gameName = random.choice(['MineSweeper', 'Roll', 'Avoid', 'Drag'])
     self.gridGame = gameName
     if hasattr(self, 'game'):
         self.game.delete()
         self.game = None
     if gameName == 'Drag':
         self.game = LaserGameDrag.LaserGameDrag(self.trapDisable,
                                                 self.trapFire,
                                                 self.sendField,
                                                 self.setGrid)
     elif gameName == 'MineSweeper':
         self.game = LaserGameMineSweeper.LaserGameMineSweeper(
             self.trapDisable, self.trapFire, self.sendField, self.setGrid)
     elif gameName == 'Roll':
         self.game = LaserGameRoll.LaserGameRoll(self.trapDisable,
                                                 self.trapFire,
                                                 self.sendField,
                                                 self.setGrid)
     elif gameName == 'Avoid':
         self.game = LaserGameAvoid.LaserGameAvoid(self.trapDisable,
                                                   self.trapFire,
                                                   self.sendField,
                                                   self.setGrid)
     else:
         self.game = LaserGameMineSweeper.LaserGameMineSweeper(
             self.trapDisable, self.trapFire, self.sendField, self.setGrid)
     self.game.startGrid()
     self.sendField()
     self.sendUpdate('setGridGame', [gameName])
     return
Ejemplo n.º 2
0
    def setGridGame(self, gameName):
        if gameName == "Random":
            gameName = random.choice(["MineSweeper", "Roll", "Avoid", "Drag"])

        self.gridGame = gameName
        #print("setting Grid Game %s" % (gameName))
        if hasattr(self, 'game'):
            self.game.delete()
            self.game = None

        if gameName == "Drag":
            self.game = LaserGameDrag.LaserGameDrag(self.trapDisable,
                                                    self.trapFire,
                                                    self.sendField,
                                                    self.setGrid)
        elif gameName == "MineSweeper":
            self.game = LaserGameMineSweeper.LaserGameMineSweeper(
                self.trapDisable, self.trapFire, self.sendField, self.setGrid)
        elif gameName == "Roll":
            self.game = LaserGameRoll.LaserGameRoll(self.trapDisable,
                                                    self.trapFire,
                                                    self.sendField,
                                                    self.setGrid)
        elif gameName == "Avoid":
            self.game = LaserGameAvoid.LaserGameAvoid(self.trapDisable,
                                                      self.trapFire,
                                                      self.sendField,
                                                      self.setGrid)
        else:
            self.game = LaserGameMineSweeper.LaserGameMineSweeper(
                self.trapDisable, self.trapFire, self.sendField, self.setGrid)
        self.game.startGrid()
        self.sendField()
        self.sendUpdate("setGridGame", [gameName])