Пример #1
0
	def test_check_color(self):
		test_game = theGame.theGame(2)
		test_game.flip()
		card_x1 = Deck.Card("H", 1, True)
		card_x2 = Deck.Card("S", 4, False)
		self.assertEqual(test_game.check_color(card_x1), False)
		self.assertEqual(test_game.check_color(card_x2), True)
Пример #2
0
	def test_is_legal(self):
		test_game = theGame.theGame(2)
		test_game.flip()
		card_x1 = Deck.Card("H", 1, True)
		card_x2 = Deck.Card("S", 3, True) #first trash is 4..
		self.assertEqual(test_game.is_legal(card_x1), False)
		self.assertEqual(test_game.is_legal(card_x2), True)
Пример #3
0
 def test_checkColor(self):
     testGame = theGame.theGame(2)
     testGame.flip()
     cardX1 = Deck.Card("H", 1, True)
     cardX2 = Deck.Card("S", 4, False)
     self.assertEqual(testGame.checkColor(cardX1), False)
     self.assertEqual(testGame.checkColor(cardX2), True)
Пример #4
0
 def start_game(self, event):
     # display screen when you first run it
     if (app.first_game):
         app.frame.Show()
         app.first_game = False
         
     game = theGame.theGame(self.height, self.sortsOn)
     app.frame.display.start_game(game)
     self.Destroy()
Пример #5
0
 def start_game(self, event):
 	global game
 	game = theGame.theGame(self.height, self.sortsOn)
 	app.frame.display.start_game(game)
 	self.Destroy()
Пример #6
0
    def OnSize(self, event):
        self.Layout()

    def pandaGif(self):
        # Gif part
        gif_file = "panda.gif"
        self.gif = wx.animate.GIFAnimationCtrl(self.gif_panel, -1, gif_file, pos=(2, 200))
        # clears the background
        self.gif.GetPlayer().UseBackgroundColour(True)
        # continuously loop through the frames of the gif file (default)
        self.gif.Play()

class App(wx.App):
    def OnInit(self):
        # game window
        self.frame = Frame(parent = None)
        self.frame.Show()
        self.SetTopWindow(self.frame)

        # level window
        self.level_frame = LevelFrame(parent = None)
        self.level_frame.Show()
       
        return True

    
if __name__ == "__main__":
    game = theGame.theGame(4)  
    app = App()
    app.MainLoop()
Пример #7
0
 def on_new_game(self, event):
     self.game = theGame.theGame(4)
     self.display.start_game(self.game)
Пример #8
0
 def Kill(self, event):
     # if user doesn't pick level he get's level 1
     game_level_1 = theGame.theGame(5, False)
     app.frame.display.start_game(game_level_1)
     self.Destroy()
Пример #9
0
        self.vbox.Add(self.namePan, 1, wx.EXPAND | wx.ALL, 5)
    
    def OnButton(self, event):
        self.name = self.editname.GetValue()
        global dummy_game
        self.game = dummy_game
        nameStr = self.name + '\t'
        scoreStr = str(self.total) + '\n'
        self.game.scoreThing.addName(nameStr)
        self.game.scoreThing.addScore(scoreStr)
        self.button.Disable()

class App(wx.App):
    def OnInit(self):
        # game window
        self.frame = Frame(parent = None)
        self.SetTopWindow(self.frame)
        self.first_game = True

        # level window
        self.level_frame = LevelFrame(parent = None)
        self.level_frame.Show()

        return True

    
if __name__ == "__main__":
    dummy_game = theGame.theGame(4)  # used to get access to help.txt and allScores.txt
    app = App()
    app.MainLoop()
Пример #10
0
 def test_getOrigPyramidLength(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getOrigPyramidLength(testGame.height), 3)
Пример #11
0
 def test_getWinPoints(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getWinPoints(), 0)
Пример #12
0
 def test_getDeckPoints(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getDeckPoints(), 4900)
Пример #13
0
 def test_getTimePoints(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getTimePoints(), 1800)
Пример #14
0
 def test_getCurrentPoints(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getCurrentPoints(), "Score: 0")
Пример #15
0
 def test_getScore(self):
     testGame = theGame.theGame(2)
     self.assertEqual(testGame.scoreThing.getScore(), 6700)