Esempio n. 1
0
 def test(self):
     twenty_forty_eight = TwentyFortyEight(6, 4)
     empty_grid = twenty_forty_eight.generate_empty_grid()
     twenty_forty_eight.grid = empty_grid
     self.assertEqual(
         twenty_forty_eight.__str__(),
         '[[0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0]]'
     )
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__()