The main objective of this thesis is to enrich computer science education by studying two gameful teaching interventions: 1) achievement badges and 2) alternate reality games.Gamification is the use of game design elements in non-game contexts, and achievement badges are one commonly used gamification method that can be used to provide optional challenges for students. We studied the use of achievement badges in a Data Structures and Algorithms course and found out that badges can be used to steer students' behavior even if they are not tied to tangible rewards such as course grades. Specifically, students used more time in the online learning environment, had more sessions in the system, and spent more time between exercise submissions when the badges were used. Furthermore, we found out that students' attitudes towards the badges varied. We also studied the use of badges in relation to achievement goal orientations that characterize students' preferences to different goals and outcomes. We found out that students who had high avoidance orientation were less motivated by the badges than other students. On the other hand, students who were the most motivated by the badges had higher mastery-intrinsic, mastery-extrinsic, and performance-approach orientations, and lower avoidance orientation. Furthermore, we compared the badge intervention with the use of heatmaps that provided feedback on one's behavior in a nongameful way. An interest towards the badges correlated with mastery-extrinsic and performance-approach, whereas interest towards the heatmaps correlated with masteryextrinsic and performance-avoidance orientations.Alternate Reality Games (ARG), are games that blur the line between reality and fiction and typically they involve puzzles and an interactive narrative. We explored the use of ARGs for teaching computer science by organizing an ARG covering a wide range of computer science concepts. In the feedback collected after the game, participants reported learning several computer science concepts during the game. We also evaluated how authenticity, intrinsic motivation, and replayability were taken into account in the game design. Furthermore, we present an example of an educational ARG that was not part of any official curriculum and relied on voluntary participation. Based on the results, alternate reality games seem like a promising approach to be used in computer science education.In addition to evaluating the two approaches, we provide support for applying them in education by describing the implementation of our badge systems and introducing a method for producing automatically assessed programming tasks that are suitable for ARGs. Tiivistelmä Väitöskirjassa tarkastellaan kahta pelillistä tapaa monimuotoistaa tietotekniikan opetusta: 1) suoritusmerkit ja 2) vaihtoehtotodellisuuspelit.Pelillistämisellä tarkoitetaan pelielementtien soveltamista eri ympäristöissä. Suoritusmerkit ovat eräs yleinen pelillistämisen keino, jolla voidaan tarjota opiskelijoille vapaaehtoisia lisä-haasteita. Väitöskir...