complete compChooseWord function