implemented a star algorithm