update second trial of gray-code