예제 #1
0
 def restart(self, event):
     size = 4
     self.gameboard = game2048.board(size)
     boardMatrix = self.gameboard.getBoard()
     self.view.render(boardMatrix, 0)
     self.window.bind('<Up>', self.moveupEvent)
     self.window.bind('<Down>', self.movedownEvent)
     self.window.bind('<Left>', self.moveleftEvent)
     self.window.bind('<Right>', self.moverightEvent)
예제 #2
0
    def __init__(self, size):
        self.window = tkinter.Tk()
        self.view = view.View(self.window, size)

        self.window.bind('<Up>', self.moveup)
        self.window.bind('<Down>', self.movedown)
        self.window.bind('<Left>', self.moveleft)
        self.window.bind('<Right>', self.moveright)
        self.window.bind('<r>', self.restart)
        self.gameboard = game2048.board(size)
        boardMatrix = self.gameboard.getBoard()
        self.view.render(boardMatrix, 0)

        tkinter.mainloop()
예제 #3
0
    def __init__(self, size):
        self.window = tkinter.Tk()
        self.window.title("2048 ParallelGame")
        self.view = view.View(self.window, size)

        self.window.bind('<Up>', self.moveupEvent)
        self.window.bind('<Down>', self.movedownEvent)
        self.window.bind('<Left>', self.moveleftEvent)
        self.window.bind('<Right>', self.moverightEvent)
        self.window.bind('<r>', self.restart)
        self.window.bind('<c>', self.calNextMoveEvent)
        self.window.bind('<p>', self.robotMode)

        self.gameboard = game2048.board(size)
        boardMatrix = self.gameboard.getBoard()
        self.view.render(boardMatrix, 0)

        self.rbt = robot.Robot()

        while 1:
            self.window.update_idletasks()
            self.window.update()
예제 #4
0
 def restart(self, event):
     size = 4
     self.gameboard = game2048.board(size)
     boardMatrix = self.gameboard.getBoard()
     self.view.render(boardMatrix, 0)