added algorithm for computer move