assignment 3 + gray code generator