Just don't let the balls occupy the entire board.
In order to win put five or more balls in a line in the direction you like. You can move only one ball to any empty cell. Then if there is a line of five or more balls they disappear, you get points......