Add automater js to implement board looping