def main(): g = TwoThousandFortyEight( board=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1024, 1024]]) while not g.has_lost(): try: g.print_board() print('Waiting for input') g.parse_input() g.add_value_to_random_zeroed_cell() if g.has_won(): print('Congratulations! You won the game :)') except ValueError as e: print(str(e)) print('You lost')
def test_has_lost_when_not_lost(self): g = TwoThousandFortyEight( board=[[8, 4, 2, 4], [4, 8, 4, 2], [8, 4, 8, 4], [4, 2, 4, 0]]) self.assertFalse(g.has_lost())