There are many challenges in teaching and learning algorithms and programming, including the lack of motivation to learn and the lack of teaching models that make it easier to guide students adequately during their learning process. For its part, gamification in education offers the potential to make learning more motivating and enjoyable for those who learn. However, the design and implementation of teaching and learning models remains a largely unsatisfied challenge. Most of the authors present in their proposals the design of gamified virtual learning environments and very little in relation to the gamification of face-to-face activities within the classroom. This paper presents a model with the following features: 1) Independent work development, where activities are resolved within class with the teacher accompaniment; 2) bonuses-based evaluation in class for the assertive solution of challenges which are added to their test results; 3) Development of videogame projects that involve the interests and passions of the students, in which the concepts learned are applied. The implementation of this model during the development of two parallel courses of algorithms and programming for the first semester in 2019-1 and 2019-2 has shown positive results regarding the interaction of students in the classroom, autonomous learning, commitment to the assigned works, better understanding of the course contents and greater motivation to learn.