Edited codegen

Fixed loop in Pieces create and changed rule return type to bool