add new board implementation using union find algorithm