Exemple #1
0
 def test_scoring(self):
     game_board = GameBoard()
     game_board.board = [
         [0, 0, 1, 3],
         [0, 6, 0, 2],
         [0, 12, 0, 0],
         [24, 0, 0, 0],
     ]
     self.assertEqual(game_board.calc_score(), 3*2+6+27+81)
Exemple #2
0
def main():
    game_board = GameBoard()

    keep_playing = True
    while keep_playing:
        print "Next Cards: {}".format(game_board.next_cards)
        print game_board
        in_keys = raw_input("Press awsd keys to move the board ulrd (or type quit): ")
        if in_keys == 'quit':
            print "Sorry to see you go!"
            break
        direc = key_map.get(in_keys, None)
        if direc is None:
            print "Invalid command! Try Again!"
        else:
            try:
                game_board.move_board(direc)
            except InvalidMoveException:
                print "You cannot move that direction! Try another!"
        if game_board.no_more_moves:
            print "Sorry Charlie, no moves remain for you!"

    print "Your score is: {:d}".format(game_board.calc_score())