How separate Game Mechanic code From Level Design code?

Hello everyone i’m new in Cocos2d-x and C++ and i want create a puzzle Game for android that in each level are 4 or 9 square in Fixed Place each square different from other and only exist 32 type of square
person is winner that touch whole of square in the Screen in Specific order (with Touch Moved listener )
i read this article and My question is how i Managed my Code until prevent it from duplication
in the other hand how separate Game Mechanic code From Level Design code

I think there would be a number of ways to accomplish this.
I’d suggest breaking down your pieces into what makes sense to abstract the data away from the implementation.

My opinion is define three Class

  1. MainClass include a list view of Levels
    2)*LevelClass that there is in Sprite with Fixed Position
  2. HUD Class
    With click one each level the LevelClass init with Question and Answer
    @slackmoehrle and Others what’s your Opinion?

it is hard to give you an exact path to take. You will do this how you decide is best for you.

With the limited information, If it were me, I might make each level it’s own class, subclassing a base Level class. Inside each level class, I might read in what the level is supposed to be layout wise.

For the few games that I have, I surely have a HUD class, multiples, actually depending upon the type of HUD. They all derive from a base HIUD class. I also have a generic GameObject class that basically has member variables, getters, setters, etc I use a few singletons for this.