Esempio n. 1
0
    def test(self):
        twenty_forty_eight = TwentyFortyEight(6, 4)
        twenty_forty_eight.reset()
        self.assertEquals(self.tiles_greater_zero(twenty_forty_eight._grid), 2)
        self.assertEquals(
            self.sum_of_tiles(twenty_forty_eight._grid) > 0, True)

        twenty_forty_eight = TwentyFortyEight(7, 18)
        twenty_forty_eight.reset()
        self.assertEquals(self.tiles_greater_zero(twenty_forty_eight._grid), 2)
        self.assertEquals(
            self.sum_of_tiles(twenty_forty_eight._grid) > 0, True)
Esempio n. 2
0
from game_template import TwentyFortyEight

print "DOWN"
game = TwentyFortyEight(4, 3)
game.reset()
game.new_tile()
game.new_tile()
print game.__str__()
game.move(2)
print game.__str__()

print "UP"
game = TwentyFortyEight(4, 3)
game.reset()
game.new_tile()
game.new_tile()
print game.__str__()
print "\n"
game.move(1)
print game.__str__()

print "RIGHT"
game = TwentyFortyEight(4, 3)
game.reset()
game.new_tile()
game.new_tile()
print game.__str__()
print "\n"
game.move(4)
print game.__str__()