Applying Game Learning Analytics to a Voluntary Video Game: Intrinsic Motivation, Persistence, and Rewards in Learning to Program at an Early Age

Learning to program at an early age has been shown to be a vehicle for the development of Computational Thinking. Game-based environments are often used to develop these skills, but they lack sufficient voluntariness to assess aspects related to intrinsic motivation, such as interests, skills, persistence in solving a problem and behavior in response to rewards. These aspects directly affect achievement and academic performance, so it is necessary to analyze possible age and gender differences in order to adjust Computational Thinking curricula. With this aim, we deployed a voluntary video game which addresses basic computational concepts, based on intrinsic motivation, and aimed at early ages. Data were collected and analyzed using game learning analytics for 15 months, during which 4124 users played more than 28187 games. The analysis shows significant age and gender differences in relation to interests, skills, achievement, and progression through attempts. It was observed that the concepts addressed were achievable between the ages of 3 and 6 years and full mastery was possible by the age of 4 years, regardless of gender, as children persist with the challenge, intrinsically motivated, until it is overcome. In terms of persistence, significantly different behaviors were observed in the face of the challenge, which can help us to adjust the different learning methodologies to each age group and gender, adapting the way we provide reinforcement and rewards, especially for boys in the more complex challenges and for girls from the age of 5 years onwards.


I. INTRODUCTION
Computational Thinking (CT), first defined as a human problem-solving process that uses decomposition and requires thinking at multiple levels of abstraction [1], is considered as one of the 21st century skills [2], key to face the technological society of the future [3]- [5]. In addition, learning programming at an early age has been shown to be a vehicle for the development of Computational Thinking (CT) [6], however, since cognitive skills vary in each age group, the content to be learned, the learning strategies and methodologies and the assessment instruments should vary accordingly [7]. In order to make progress in all these domains, in addition to the need for more research in understanding how these CT skills are developed in early stages [8], it is necessary to identify the interests and The associate editor coordinating the review of this manuscript and approving it for publication was Saqib Saeed . motivations for programming and thus for computational thinking. Analyzing children's behavior in a voluntary game environment could provide information in this respect.

A. GAME LEARNING ANALYTICS
Game-based learning (GBL) has been widely adopted in education for teaching several topics in many different areas such as mathematics [9], data mining [10], and English language [11]. Moreover, it is one of the main strategies most frequently used and reported in the literature for learning programming and developing CT in Primary Education [7]. It is a problem-solving framework in which a challenge is created in order for students to seek solutions using game mechanics with a sense of achievement, while enhancing knowledge and skill acquisition [12]- [14]. There is evidence that meaningful learning occurs when games are design founded in relevant learning theories and when specific game design elements are included, such as interaction, immediate feedback, clear goals or low-stakes failure [14], [15]. The mayor theoretical foundations used by GBL are constructivism, where knowledge is actively created by the student himself in an interactive learning process [16]; and flow theory, where the player activity is driven by pleasure rather than external rewards and where a balance is created between the game challenge difficulty and the player's skill [14], [17].
Considering flow theory, the assessment of students in a game-based learning environment should not affect engagement, so data collection should be transparent to players. This could be achieved through stealth assessment embedded in gaming environments. Stealth assessment is based on evidence centered design (ECD) models [18] and allows storing low level players interactions and use this stream of gameplay evidence to assess student's skills and knowledge. This data is collected unobtrusively for the player, without disrupting engagement, and in real time, allowing immediate feedback if needed. There is evidence for accurate estimates of competencies using stealth assessment that could be used for a variety of purposes [19].
Game-based environments that incorporate stealth assessment could be powerful assessment tools as long as the data collected are properly analyzed. To this end, from research it is known that data-driven solutions that take advantage of Game Learning Analytics (GLA) are essential to guide the development of game-based learning environments [20]. GLA discipline is an extension of Learning Analytics [21] in educational settings, combined with Game Analytics [22] which focuses on analyzing user interaction data in games. There are many successful integrations of GLA for evaluation in educational games [23]- [25], for example, CMX which is an educational MMORPG aimed at secondary education for teaching programming [26], [27]. Similarly, there are various frameworks and standards for the correct analysis of data collected by games [22], [23], [25], [27]- [29].
GLA could be used to analyze data 1) at real-time to provide urgent feedback, 2) immediately after the playing session, and 3) after enough data is collected during several gameplays so the analysis could yield additional insights, through data mining processes that can be applied to extract patterns of use, motivation or interests, e.g., clusters of players that show different behaviors or characteristics, such as age or gender [30] could be extracted. Moreover, data from gameplay interactions contain valuable information on how players interacted with the game, progress, skills, persistence, problems encountered or understanding of concepts [22], [23]. Furthermore, GLA comparative visualization approaches facilitate the understanding of the differences among individuals and subsamples [30].

B. INTRINSIC MOTIVATION IN GAME-BASED ENVIRONMENTS
Game-based environments have many advantages as the student's motivation and engagement is higher than in traditional classroom environments and, therefore, a deeper and more authentic understanding of the underlying principles being taught is accomplished [22]. Zimmerman [31] defines games as ''a voluntary interactive activity, in which one or more players follow rules that constrain their behavior, enacting an artificial conflict that ends in a quantifiable outcome.'' This autonomous play responds to an intrinsic motivation (IM) towards performance or achievement under the perspective of the expectation of control and efficacy [32], [33]. In addition, IM correlates positively with learning, achievement motive and self-competence [34] as well as reducing anxiety [35]. Self-determination theory [36] explains IM as an innate tendency to engage in behaviors that arouse interest, rather than those that are compulsory. It is well known that people with high self-efficacy are more intrinsically motivated by tasks, set higher learning goals, persist more, and experience fewer adverse reactions [37].
Serious video games have been introduced in educational contexts as game-based environments, however, they are confined to controlled academic scenarios or to circumstances external to the player's entertainment, as they are designed as a support in which to introduce educational content, and therefore contrast with the distinctive characteristics of a game: both fun and voluntary, and its traditional motivational character. On the other hand, traditional video games can be defined as a playful activity, delimited by rules, exercised voluntarily through a specific hardware [38].
Video games use failure as a motivational tool and offer only intermittent opportunities for success that are accompanied by rewards [39], [40], either informative or controlling [41]. These experiences of failure can lead to feelings of frustration or, on the contrary, to a response of perseverance and interest in overcoming the proposed challenges in which the player proves to be persistent [42]. Persistence is defined as the aspiration to complete a challenge and exceed goals and has been shown to be an important skill for problem solving and learning in general [43]. Selfefficacy, satisfaction and IM are variables which lead to student persistence [44]. In addition, micro-persistence is the aspiration to complete an individual task successfully, e.g., in game-based learning environments, and can improve CT acquisition and the learning processes involved and has been recognized as a promising approach to improve learning outcomes [43], [45], [46]. Thus, behavior in the response of a given challenge according to the characteristics of the players could provide clues about their abilities and interests, and even predict their school achievement [39]. As Ventura et al. [39] suggest, further research that take these complexities into account are needed to significantly advance the field.
However, in the vast majority of the research conducted so far, players are tested in supervised sessions at schools [47], were the interaction with the learning environment is not voluntary nor autonomous as it is difficult to teach and at the same time create a climate of autonomy when you have to reach set curricular goals [48], therefore, there may be a lack of IM and the data obtained may not reflect students' interests and micro-persistence on learning certain concepts, or their VOLUME 9, 2021 behavior in response to rewards. Moreover, there might be interactions between learners that influence the results [8]. In addition, sample sizes used in these supervised sessions are in general quite low, Alonso-Fernández et al. [47] state that, from a systematic review on serious games with LA or GLA, only 8% of the studies report samples larger than 1000 participants. Small samples could restrict the significance and generalization of the results [49], as well as the application of complex GLA algorithms, which require large amounts of data points to be adequately applied [47] and visualized [30].

C. AIMS AND RESEARCH QUESTIONS
Based on the previous rationale, we consider that most of the recent research on game-environments lack sufficient voluntariness to be able to assess aspects related to IM, so that we propose a deployment of a video game as a game-based learning environment on anonymous platforms over the Internet without supervision nor limits on time or attempts, targeted to 3 to 12 years-old players. It is conceived as a voluntary and autonomous activity to learn to program, in which motivation is intrinsic, and aimed at a much larger sample than in a regular school environment. The intention is to evaluate aspects such as interests, skills, micro-persistence in solving a problem and behavior in response to rewards; based on stealth assessment and using GLA algorithms, and comparative visualizations [30]. This data analysis could provide findings on the motivation to learn to program among young players of different age and gender, as well as insights about the effects of rewards according to player characteristics. Furthermore, identifying the characteristics, such as age and gender, of players with skills and/or interests in certain programming concepts is essential in order to be able to adjust the CT curricular programmes, since the greater the interest in programming, the more likely it is that it will be easier to learn, have higher creative self-efficacy and, therefore, show greater programming empowerment [50].
Considering the research that has already been carried out, we are interested in the following main research question: Based on IM, what findings in terms of early interests, skills, micro-persistence and behavior in response to rewards in learning to program can be drawn from the application of game learning analytics to a voluntary video game?
In order to answer this main research question, the following sub-questions have been formulated in players according to their age and gender: (1) Are there differences in interest in learning to program and in solving specific computational problems? (2) Are there differences regarding skills and achievement over the course of the game attempts? and (3) Are there different playing behaviors in terms of micropersistence and rewards?
The research has been carried out under the following hypothesis: (1) The motivation to play an autonomous online game is intrinsic, (2) Data can be collected via stealth assessment in an online game-based environment (3) Interests, skills, micro-persistence and behavior in response to rewards can be explored by applying GLA techniques and comparative visualizations. Fig. 1 shows the connection between the concepts discussed in this section and how through a voluntary and autonomous online game environment, players' interests and behaviors can be analyzed, based on their intrinsic motivation.
The rest of the paper is structured as follows: section II details the methodology, describing the environment used (section II-A), defining the research variables (section II-B) and, in section II-C, the participants and the procedure. In section III, the results obtained are described and discussed: firstly, a general analysis of the data is carried out (section III-A), next, each research variable is analyzed in detail according to the computational concepts addressed (section III-B), the progression throughout the game (section III-C), and the persistence of the players (section III-D). In section III-E, the types of persistence behavior found (persistence-challenge behavior and persistence-reward behavior) are analyzed in depth and, in section III-F, behavior in response to rewards is explored in detail. Finally, section IV draws conclusions for each of the research questions.

II. METHODOLOGY A. ENVIRONMENT
To answer the research questions, we used Blue Ant Code (BAC) [51], a visual game-based environment that is both a learning instrument and a stealth assessment tool via datadriven real-time analytics. This game can be used in school classrooms, on devices such as tablets, both individually and in collaborative mode, for learning programming, as well as for further assessment of CT through game analysis using GLA techniques. The game is divided into six maze puzzle problem-solving levels where there are random challenges to solve using visual block-based instructions that can be dragged to assemble a piece of sequenced code. BAC is targeted to early ages and each level is focused on one CT concept (1: Simple sequences; 2: Long sequences; 3: Simple loops; 4: Nested loops; 5 Simple while; 6: Long while).
The following functionalities have been added to BAC to analyze player micro-behavior and with the aim of mass deployment of the game: 1) user creation/selection screen: each device on which the game is installed can have up to 6 different users; 2) initial screen for the collection of basic anonymous data on age and gender, plus optional nickname; 3) shop with access from the main menu, where the points obtained can be spent on accessories and clothes to customize the main character; 4) remote data base linked to the game for the collection of game data.
The scoring system built into BAC for each level is as follows: 2 points for reaching a partial objective (there can be 0 to 2 partial objectives in each level) and 10 points for completing the level. These points can be exchanged for items to customize the main character of the game in a virtual shop. This functionality has been implemented to analyze the effect of micro-persistence and rewards on player behavior at a later stage.

B. RESEARCH VARIABLES AND DATA COLLECTED
For creating assessment in game-learning environments it is highly recommended to specify and determine the game traces that will be collected before applying GLA [47], [52], and these should be powerful enough to feed the learning analytics system [53]. For this reason, the research variables to analyze player behavior were well defined before establishing the game traces to be collected: • Persistence: is a valuable skill when solving problems and can improve CT acquisition and the learning processes involved 45], [54]. It can be defined as the will to complete a learning process and achieve the learning goals. Micro-persistence is the aspiration to complete an individual task successfully, e.g., a level, and focuses on the learning process of each of the concepts and not in the learning process as a whole [55]. We will quantify this variable with the number of attempts made by the player.
• Achievement: We define achievement as the percentage of the number of games won over games played, both in total and at a given level.
• Skill: Grover et. al (2016) found that the time taken to solve a level predicts skill level with ∼63% accuracy 56]. We will quantify this variable according to the time needed to complete a level, with the higher the skill the less time needed.
• Mastery: we will consider mastery of a level (CT concept) at a given age, if we observe high achievement and skill, and/or high achievement and few attempts needed to complete a level, compared to the trend observed at earlier ages.
• Progression: we will consider a positive progression when mastery levels increase throughout the game attempts.
• Rewards: we will quantify the degree of rewards according to the number of points exchanged for items in the shop. We will analyze the relationship of this variable with that of persistence. Finally, we will draw conclusions regarding the interests and motivation, specifically IM, of the players based on the above variables and general observations. The traces collected in BAC and their relation to the research variables are shown in Table 1. In addition, unique identifiers are associated with each user, each game session and each level played. Information is also collected on age, gender, device type, date and time of each play, level and challenge proposed (as challenges are randomly set and are different for each play).
The data was stored in a remote SQL relational database that connects to the game via a.NET API to ensure data security. Data were analyzed using Python (with scikit-learn library), Microsoft Excel and SPSS software. There are different visualization techniques that have been applied to game analytics data [47], we have used the Python matplotlib library, Microsoft Excel and the Gephi software for various visualizations, such as performance metrics, game paths or learning curves.
BAC has been developed for Android and iOS operating systems and has been deployed on the virtual platforms ''Google Play'' and ''Apple Store'' [51], being made available for free download worldwide. No advertising campaigns have been carried out targeting any specific group or population to avoid prior bias.

C. PARTICIPANTS AND PROCEDURE
The data collected covers a period of 15 months during which any user was free to download the game and play as many times as they wanted. There were 741 downloads from Google Play, from 53 different countries, from them, Spain was the country with more downloads (24,5% of the total), followed by the US (5,98%). From the Apple Store, 2130 downloads have been made in 42 different countries, with Finland being the country with the most downloads (51.64% of the total), followed by Mexico (23.90%). Since each device can register up to 6 users and each user can play any number of times, 4124 users registered (Google Play=2294; Apple Store=1829) and 28187 games were played.

III. RESULTS AND DISCUSSION
The data will be analyzed by first getting an overview and then going deeper into each of the aspects of the study and VOLUME 9, 2021 the key ages where significant changes in terms of interests and play behavior have been observed.

A. OVERVIEW
After the data filtering pre-process, 1875 users and 25118 games have been analysed. The total playing time is 49563.85minutes (per user: Mean=26.43; Median=3.87; Standard Deviation (SD)=199.81). As we are interested in the analysis of CT at early ages, we will focus on the 3-12 age group in which a total of 23651 games have been played. Fig. 2 shows that the distribution of players by age from 3 to 12 years old fits a normal curve regardless of gender (Sample size (n)=1630, Mean=6.47; SD=1.744), although there are three times as many male users (70% from the total). From the distribution of downloads by gender, it can be deduced that boys are a priori more interested than girls in learning to program, in line with previous research [57]. However, there are more 6-year-old users than expected, both male and female, perhaps partly because this is the age that can be entered into the application most straightforwardly.
In a first analysis, we can see that the average total playing time is higher for female users (22.63 minutes) than for male users (17.32 minutes), but if we divide the sample by age, we can see that boys play longer up to the age of 5 and, after that, there is a very marked change in the trend and, at the age of 6, female users play an average of 72.44 minutes in total (Fig. 3). We consider this finding as an indication to pay special attention on ages 4 to 6 years, especially on females.
When we compare the average number of attempts (persistence) and the average time spent per attempt (related to skill), by age and gender (Fig. 4) we can observe that female users played more games per user overall (Male average attempts = 13.76; Female average attempts = 15.70). Although up to the age of 5 persistence is higher for male users, after that age  the trend is reversed, with female users playing significantly more games than males (from 6 to 8 years old: Student's ttest p=.011 < .05). Similarly, in the 3 to 5 age range, male users spent more time playing per user, but in the 6-8 age range, the time spent playing is much higher for girls (from 6 to 8 years old: Student's t-test p=.002 < .01). This provides the first indication of persistence, since although males seem to be more interested in downloading the game, once it is installed, females spend more time and make a greater number of attempts, especially from the age of 6. Moreover, it seems that persistence in the game is higher in girls from the age of 6, whereas in boys it decreases with age.
In regard to achievement as the percentage of games won over games played (Mean=42.89; SD=31.27), it can be observed in Fig. 5 that it is always higher for girls, regardless of age or the average time spent. In general, achievement is significantly higher in female users (Student's t-test p = .000 < .01), especially at the age of 3.
Finally, to assess the overall mastery of the game, both achievement and skill were compared by age and gender. It can be observed in Fig. 6, that from 3 to 5 years old, female users have a higher achievement with less time spent per attempt, and fewer attempts needed (Fig. 4), so we deduce that they could have a clear higher mastery than males.  However, from age 6 to 8, although their achievement is better, female users spend much more time playing, so we cannot infer greater mastery and consider that this behaviour needs to be explored in more detail, which we will do later in this chapter. From 9 to 12 years old, time spent is similar in females and males, with a higher achievement in female users.

B. COMPUTATIONAL CONCEPTS
Following these preliminary results, the variables have been analyzed by level. First of all, level 1 (simple sequences) is the one with the higher achievement (Mean=45.53; Median=46.00; SD=30.34), followed by level 3 (simple loops), 5 (simple while) and 6 (long while). The levels with the least achievements are 2 (long sequences) and 4 (nested loops). It was a surprise to find difficulties in level 2 (Mean=24.20; Median=15.00; SD=27.45) as this level deals with the concept of sequences, which is the simplest one addressed in the game, however, the particularity of this level and its only difference with level 1 is that the sequences to be built are very long. Our hypothesis is that this difficulty at level 2 is related to the working memory, which is crucial for storing information. This working memory develops throughout the school years and has important consequences for children's learning abilities [58]. Finally, level 4 has also a low achievement (Mean=29.44; Median=17.00; SD=32.67) and is considered the most difficult level included in the game as nested loops are known to be a difficult concept, unreachable at 4 years old [59], [60].
In terms of gender (Fig. 7, girls have a higher achievement than boys at the more difficult levels, particularly at levels 2 and 4, where boys have a very low median. The only level where boys have a higher achievement than girls is the medium difficulty level 3. In order to obtain an overall view of the mastery in each concept, achievement and persistence have been analyzed at each of the levels and by age ( Fig. 8 and Fig. 9).
It can be observed that at the age of 3, level 1 (simple sequences) is mastered with an average in the case of males of 42.8% of achievement and 14.9 average attempts per user, and, in females, 72.2% success rate and 5 attempts per user. From this point onwards, the persistence and achievement are similar at all ages, regardless of gender, at level 1. In addition, at the age of 3, males are more interested in level 3, with an average of 23 attempts and a 37% of achievement.
At age of 4, male users show high persistence in level 2 (49.3 average attempts per user) despite low achievement (32%) compared to 2 attempts per user in females and 0% of achievement. It is noteworthy that, at this age, at level 3, girls obtain an achievement of 25% compared to 0% for boys. Level 6 (long while) has a high achievement (50%) with few attempts.
At age of 5, the same behavior is observed in level 2; level 3 has high achievement with fewer attempts by both males and females; and level 4 begins to arouse interest in both genders equally (11 games on average per user), although achievement is higher for girls (66.5% compared to 41% for boys). At levels 5 and 6 there are no notable differences in terms of gender.
At age of 6, males are not so interested in level 2, but females are (67% achievement). Level 3 arouses more interest in females (32.8 attempts, compared to 14.2 in males) with a similar achievement (around 35%). Level 4 is evenly matched by gender (10.6 attempts with 27.6% achievement by males, compared to 7.7 attempts and 18.3% achievement for females). Levels 5 and 6 arouse more interest in males at this age.   At the age of 7, level 3 is no longer interesting for both genders and level 4 becomes very interesting for females, with 62.5 average attempts per user compared to 5 attempts for males. However, achievement is similar (around 30%).
Finally, at the age of 8, level 2 is totally mastered by female users, with a 92% of achievement, compared to 34.3% for males. Only females play level 4 (13 games per user on average) with an achievement of 23%, and boys lose interest in it. From this point onwards, there are no significant differences in the rest of the levels.
In conclusion, simple sequences seem to be mastered from the age of 3, but level 2 (long sequences) does not seem to be mastered until the age of 5. At level 3, on the other hand, achievement increases around the age of 3 years in the case of males and 4 years in the case of females. Level 4 (nested loops) seems to have better achievement from age 5 for females and age 6 for males, with better performance by girls. On the other hand, at levels 5 and 6 (conditionals), achievement increases at age 4 regardless of gender. These results are in line with previous research [8], [61], where males performed better than females at intermediate levels, whereas this trend was reversed at more difficult levels.
At age 4, females play many games on average at level 2 (long sequences) despite a low achievement, suggesting a behavior of self-improvement in response to a challenge. Similar behavior can be observed with females at age 6 at level 3, and at age 7 at level 4, which offers the most difficult challenge.

C. PROGRESSION
So far, we have obtained a general picture, but it is important to observe the progression of the players over the course of the game attempts. In Fig. 10 achievement and time per attempt is shown throughout the attempts and per gender.
Both girls and boys improve over the attempts, but in males, improvement is more significant (positive progression), with higher correlations compared to girls, both in time improvement (skill) (boys, coefficient of determination (R2)=0.83; girls R2=0.70) and in achievement (boys R2=0.82; girls R2=0.73). From the first time they play (first attempt), females have higher achievement and have a higher skill (spend less time) than boys in completing the challenge. From game 50 onwards, the achievement is similar.
If we focus on the achievement in the different levels ( Fig. 11 to 13), during the first 10 attempts, and we pay special attention to the years in which the greatest change in achievement has previously been observed (between the ages of 4 and 6).
It can be seen that at age 4 ( Fig. 11), that girls, as they play the game, achieve 100% success at all levels, except at levels 1 and 4. At level 1, 100% of achievement is reached at age 3, and it is possible that this level is not reached again at   age 4 because it is boring for children of this age, so there may be a lack of motivation to overcome the challenge. At age 4 and level 4, perhaps due to lack of interest in playing because it is perceived as difficult in the first instance, there is only a maximum of 57.14% of achievement for boys at attempt 5, and 50% of achievement at attempt 9 for girls in the first 10 attempts. However, they are able to reach 100% of achievement at this level at attempts 13 (girls) and 14 (boys).
At age 5 (Fig. 12), girls are able to complete level 4 with a 100% of achievement, at attempt 8. It is noteworthy that girls, at age 5, obtain a 50% of achievement at the first attempt, whereas boys only reach this same success rate at the third attempt, and a maximum of 55.6% at attempt 8.
One of the most remarkable behaviors is that girls obtain a significantly higher achievement than boys (4 and 5 years, 10 first attempts: p = .02 < .05; Male: n = 641, Mean=0.40; Female: n = 284; Mean=0.47). Females reach 100% of achievement on several occasions and at all levels in the first 10 attempts between the ages of 3 and 5, whereas this behavior is not observed in the case of males. This behavior is still observed even after the first 20 attempts. From 6 years old (Fig. 13) and onwards, girls take more time and attempts to solve the challenges, this might be because girls are more reflective than boys, but the following sections analyze this behavior in more detail and come to conclusions that differ from this first hypothesis. VOLUME 9, 2021 FIGURE 13. Achievements per attempt (10 first attempts) and level, for 6 years old.

D. PERSISTENCE
In order to further analyze the behavior of users in the game with regard to persistence, the sample has been divided into different clusters by applying the PCA (Principal Component Analysis) technique to reduce dimensionality and using the elbow method to determine the number of clusters. Since this analysis is done after sufficient data has been collected to be able to extract additional information to show different behaviors, and not in real time, low execution times are not essential [20].
Firstly, the aim is to distinguish between players who follow similar game trajectories and also between players who show persistence versus others who play only a few games and drop out. A first division of the sample into clusters was made (Fig. 14). Cluster 1 groups together those players who play several games, with an average of 58 games per user, especially at the easiest levels. Cluster 2 groups players with more attempts, with an average of 147 games per user and mostly concentrated in level 1. Cluster 3 groups users with an average number of attempts of 46 per user, but they are evenly distributed across all levels. Finally, cluster 4 groups users with a low profile (average of 7 games per user), distributed among the 6 levels. Table 2 shows that the ratio of females to males in all clusters is similar to the total ratio (70% of boys in the group of users aged 3 to 12), whereas in cluster 2 the ratio is not conserved and there are 66.5% of girls, aged between 5 and 7. From the age of 7 onwards, there are also more girls than the total proportion in cluster 1, Fig. 15 shows, for each age, what percentage of each cluster is composed of users of each gender. We can confirm, therefore, that the number of games per player is higher in the case of girls by far in specific cases where more than 200 attempts have been reached, especially at level 1, and that this behavior of female players with very high persistence is mostly observed between the ages of 5 and 7, and after that it is also noticeable, but not as pronounced. In the case of boys, there seems to be a change from the age of 8, when there is a lower proportion of male users in clusters 1 and 2; these users play at all levels without reaching a very high number of attempts.

E. PERSISTENCE TO OVERCOME A CHALLENGE OR PERSISTENCE TO OBTAIN A REWARD?
A deeper analysis leads us to analyze whether the immediate repetition of a level is caused by the intention of overcoming a challenge, in which case the level would be repeated after having lost it, which we will call persistence-challenge; or the intention to consolidate knowledge (satisfaction for winning) and/or obtaining a reward (victory points), in which case the level would be repeated after having won it, which we will call persistence-reward. To analyze these behaviors, we have  taken the first 30 games, so that we can analyze behavior over enough repetitions, considering whether in the case of winning or losing a game there has been a repetition immediately afterwards.
First, a characteristic vector has been created in which, for each user, an accumulated value has been determined in each component of the vector that varies depending on whether the current game has been won or lost in relation to the result of the previous game. Fig. 16 shows the division into clusters and Fig. 17 shows the cumulative trend in terms of success in the games of each cluster (curve rises in case of successive wins and falls in case of successive losses). In terms of age, there are no significant differences between the clusters, with the average age of all clusters oscillating around 6.5 years. The central clusters (1 and 2) are the ones with the least number of matches in total. A higher percentage of boys in cluster 1 (Table 3 ) is observed to lose the game and try again despite having lost on numerous occasions, suggesting a behavior persistence-challenge, however, these users have hardly any successful games. In cluster 2 the majority are girls, these users also show persistence-challenge behavior, although much lower, as there are far fewer unsuccessful games in a row and, at a certain point, the trend reverses and there are winning games. Clusters 3 and 4 group users with many games. In cluster 4, with most boys, the persistencechallenge behavior is again observed, with many consecutive games lost, and with a reversal of the trend around game number 20, where users start to win many games. Finally, in cluster 3, with most girls, a persistence-reward behavior is observed, as these users win most of the games from the beginning and throughout all of them. It can be concluded that, therefore, the behavior of repetition despite having lost (persistence-challenge) accumulates more male users and the persistence-reward behavior accumulates more female users.
Finally, to check these results, the behavior of each cluster has been analyzed again (Fig. 18, this time taking into account the following variables: nMaxL = Maximum number of  consecutive games lost; nMaxW = Maximum number of consecutive games won; nSec3L = Number of consecutive games lost =>3; nSec3W = Number of consecutive games won =>3; nCtLaW = Number of trend changes form lost to won; nCtWaL = Number of trend changes form won to lost; nL = Total number of games lost; nW = Total number of games won (Fig. 19).
Cluster 3 includes users with very few games played overall. Clusters 1 and 5 are where, proportionally, there are more girls. These clusters bring together a behavior in which there is a higher succession of games won, reaching an average of 7.71 successive games won in cluster 5 and a high success rate (64.56%). As shown in Table 4, in clusters 2 and 4 is where there are proportionally more boys with a behavior in which there are higher successions of games won, reaching, in cluster 2, an average of 11.65 successive games lost and a very low success rate (23.38%). The previous results are therefore confirmed: persistence-challenge behavior is more common in boys, as opposed to persistence-reward behavior.

F. REWARDS
Finally, we have analyzed in depth the persistence-reward behavior, in order to clarify whether this behavior is due to the VOLUME 9, 2021  satisfaction of winning the challenge in order to consolidate knowledge, or whether there is a desire to obtain reward points to exchange them in the virtual shop and personalize the main character. We first analyzed the path graphs between levels in the game (Fig. 20), where the nodes (levels) are larger according to the number of attempts (persistence) that have been made on that level and the edges are thicker according to their outdegree (level outdegree: 1=10467; 2=3835; 3=2628; 4=2135; 5=3302; 6=2751). There are connections between all levels, especially from level 1 to the rest, and from each level to the next higher level (the outgoing edge is the same color as the origin node). Fig. 21 shows trajectories after a game has been won (level outdegree: 1=6017; 2=1993; 3=1308; 4=672; 5=1228; 6=1075); a clear progression between levels can be observed in order from level 1 to 6, since after winning, users often try next level. Few repetitions of a level after winning are observed, especially in level 4, considered difficult; and except in level 1, the easiest, with a large number of repetitions (thick loop in node 1), which reinforces the hypothesis that repetition after winning is due to a persistence-reward behavior (which was observed earlier, especially in girls), and not due to the will to consolidate knowledge. Fig. 22 shows trajectories after a game has been lost (level outdegree: 1=4450; 2=1842; 3=1320; 4=1463; 5=2074; 6=1676); it can be observed that there is more persistence at each level (thick loops at the nodes) if the game has been lost. Although level 4 is the most difficult and the least played, it is not the one with the lowest persistence-challenge behavior, players persist in the challenge, even after losing, and even though it is the most difficult level (the level in which they lose the most times) and in which boys have a particularly low achievement compared to girls. In addition, level 3 is the level where the least persistence after losing is observed (thin   loop in node 3) and the level where boys show the highest achievement compared to girls. These observations reinforce our hypothesis that this persistence-challenge behavior is more frequent in boys than in girls. Table 5 shows persistence-challenge behavior in terms of percentage of players who, having lost the level, replay it; and persistence-reward behavior in terms of the percentage of players who, having won the level, replay it, by age, gender and level. Persistence-challenge behavior is clearly lower in girls, especially in the more difficult levels (2 and 4), and at age 4 (Chi-Square test p = .018 < .05). In contrast, persistence-reward behavior is observed more in girls, especially at the easier levels, which leads us to our hypothesis that the ultimate goal of this behavior is to obtain reward points to exchange them in the shop for objects. This hypothesis is confirmed since the analysis of the number of points spent and visits to the shop is significantly higher in girls (Student's t-test p = .003 < .01). A particular persistence-reward behavior has also been detected, in which partial goals of little value are collected and the game is abandoned before the challenge is overcome. This behavior has been detected mostly in boys.

IV. CONCLUSION
From the results obtained in BAC and supported by the initial theoretical basis, we can conclude that the use of a voluntary video game based on intrinsic motivation, to which GLA techniques and comparative visualizations have been applied, can provide findings that might be relevant in terms of interests, skills, micro-persistence and behavior in response to rewards.

A. INTEREST IN LEARNING TO PROGRAM AND SOLVING SPECIFIC COMPUTATIONAL PROBLEMS
In line with previous research [57], a priori there seems to be greater interest in learning to program in boys than in girls, since 70% of downloads correspond to male users and, once BAC is installed, boys play more often and spend more time playing up to the age of 5 years; however, from the age of 6 onwards, the time spent playing and the number of games is much greater in girls than in boys. This drastic change in behavior has required further analysis in terms of persistence. Achievement at all ages is significantly higher for girls than for boys, especially from 3 to 5 years old, when girls seem to be more skilled than boys in solving challenges, as they need much less time and attempts to overcome challenges and their achievement (number of games won over games played) is higher, so we deduce that they could have a clear higher mastery than males. However, from 6 to 8 years of age, although their performance is still better, female users spend much more time playing and, according to the results of our research, this behavior is not related to mastery, but is due to a persistence-reward behavior.
When solving specific computational problems, girls have a higher interest and achievement at the more difficult levels (nested loops and long sequences), compared to boys, who have similar interest for each concept but a higher achievement only at the level that addresses simple loops, which is of medium difficulty. These results are in line with previous research [8], [61], where males performed better than females at intermediate levels, whereas this trend was reversed at more difficult levels.
Simple sequences seem to be mastered from the age of 3 regardless of gender. However, working memory [58], [62] that is considered to be a predictor of programming skill acquisition [4], seems to play an important role when working with long sequences and this may influence learning, as they are not mastered until the age of 5 years, regardless of gender. Simple loops are mastered around the age of 3 years for boys and 4 years for girls. On the other hand, nested loops seem to be overcome from the age of 5 years for females and 6 years for males. Finally, with regard to conditionals, achievement increases at the age of 4, regardless of gender. All the concepts addressed can be overcome between the ages of 3 and 6 years, which could be an aspect to consider for the preparation of school curricula.

B. SKILLS AND ACHIEVEMENT OVER THE COURSE OF THE GAME ATTEMPTS
In terms of progression, both girls and boys improve over the attempts, but male's improvement is more significant both in time and in achievement. However, girls obtain a significantly higher achievement than boys and reach complete achievement at all levels in the first 10 attempts between the ages of 3 and 5, whereas this behavior is not observed in the case of males. From 6 years old and onwards, girls take more time and attempts to solve the challenges due to a persistence-reward behavior.
It is remarkable that, although nested loops appear to be difficult for primary school students [43], [55], it is possible to fully master this concept by the age of 4 years, regardless of gender, if enough attempts are made and, moreover, children are able to persist with the challenge voluntarily, intrinsically motivated, until it is mastered. This could also be an aspect to take into account for the development of school curricula, as all the concepts addressed (sequences, simple and nested loops, and conditionals) might be mastered by the age of 4 if there is intrinsically motivated persistence.

C. PLAYING BEHAVIORS IN TERMS OF PERSISTENCE AND REWARDS
In a game-based environment, a positive reaction to failure, in the form of persistence in the face of a challenge, may predict better academic performance [63], [64] and, in turn, players are highly motivated to repeat the task and overcome the challenge, and the development of this positive motivational style may lead to educational success [39]. On the other hand, rewards in video games are very effective in training behaviors as they teach players that persistence in the face of failure reaps rewards [39], [40].
This behavior of persistence in the face of failure, which we have called persistence-challenge behavior (repetition despite losing) has been clearly observed in both genders but is more pronounced in boys, which could explain why their progress is highly correlated with persistence. In contrast, persistence-reward behavior (repetition after winning) is observed significantly more in girls, especially between the ages of 5 and 7, when they have mastered all the concepts addressed.
From our analysis we can conclude that this persistencereward behavior is mainly for the accumulation of reward points and their exchange for virtual objects in the game, and not for concept assimilation. We believe this might be a relevant finding of our research, as these users do not play the game with the aim of overcoming challenges or learning concepts, but rather with the sole objective of receiving a reward. Although learning derived from this behavior is possible, this learning could be reduced as the goal is not to overcome the challenge, in fact, an extreme behavior in this regard has been detected in which players play successive attempts and in all of them quit the challenge after having accumulated partial rewards with the clear goal of accumulating points to redeem, but without overcoming the challenge in any of the attempts. Given that children are able to master the concepts addressed before the age of 5 years through continuous practice, we wonder whether it is not counterproductive to delay the acquisition of these concepts until after the age of 5 years when persistencechallenge behavior is lower and persistence-reward behavior emerges, especially in girls.
On the other hand, for learning programming from the age of 5, motivating through rewards could also be suggested, especially in girls, as it is known that rewards have a positive motivational or metacognitive effect on learning in a way that increases engagement [43], but always bearing in mind not to exceed the limit at which rewards can be detrimental to learning, decreasing intrinsic motivation [36] and potentially reaching the extreme case detected in which there is no longer any intention to learn, and also being careful not to exceed the ''sweet spot'' [16], [65] where there is a balance between challenge and frustration.
Our research has some limitations, for example, it is possible that some users may have logged in twice with different devices and been treated as two different people; entered the wrong data with respect to age or gender; or left the game on by mistake, impacting on play time. However, given the large volume of data collected from different populations and the filtering pre-process of data, this impact has been minimized.
The possible applications derived from the research findings are based on the recommendation to analyze the aspects of persistence and rewards in educational games. The BAC environment could be used in school contexts, in addition to learning programming and its assessment, to analyze aspects related to intrinsic motivation, but, in this case, provided that its use is completely voluntary. In this same way, it is recommended to incorporate educational games based on intrinsic motivation in school environments. School curricula could be designed considering that, through this motivation, children may be able to overcome the computational concepts addressed (including nested loops) before the age of 5, there being gender differences in the acquisition of these concepts. It is also recommended to design educational games taking into account these aspects, and in this way to enhance persistence-challenge behavior in and, from the age of 5, to monitor or enhance persistencereward behavior regarding girls.
In conclusion, by using a completely voluntary and uncontrolled game, behavioral aspects associated with intrinsic motivation, such as progression on voluntary attempts, persistence, and behavior in response to rewards, can be explored in detail. We believe that our findings could guide the design of better tools for learning programming and CT development. Given that age and gender influence achievement in such challenges, it is advisable to adapt learning tools accordingly, as well as the school curriculum. In addition, learning environments could adapt the way they provide reinforcement and rewards especially for boys in more complex challenges and for girls from the age of 5. However, new studies that take these complexities into account are needed.
Although new learning approaches based on intrinsic motivation have been provided in this research, open questions remain, for example: how could learning environments based on intrinsic motivation be included in school settings? Could relevant conclusions be drawn from the analysis of the code constructed by players to overcome challenges? In addition to analyzing post-game data as done in this analysis, it is possible to use our findings to improve learning environments that make use of GLA to predict and adapt learning, but how could predictive and adaptive elements be directly implemented in a voluntary video game without reducing intrinsic motivation? In addition, there are other concepts and skills related to CT that have not been addressed and other versions of BAC could be developed to address them in future research.
Intrinsic motivation correlates positively with learning, interest, persistence, self-competence and self-efficacy [32], [33], [41], [48]. Moreover, specific motivational styles directly affect achievement and academic performance, and these styles could be detected and developed through video games [40]. Given the findings that have been reported in this research and the questions that remain open, we believe that more research should be done on the behaviors that arise from intrinsic motivation, using voluntary, game-based learning and assessment environments. We also consider GLA techniques and comparative visualizations to be appropriate for analyzing these behaviors.