Teach me to play, gamer! Imitative learning in computer games via linguistic description of complex phenomena and decision trees

In this article, we present a new machine learning model by imitation based on the linguistic description of complex phenomena. The idea consists of, first, capturing the behaviour of human players by creating a computational perception network based on the execution traces of the games and, second, representing it using fuzzy logic (linguistic variables and if-then rules). From this knowledge, a set of data (dataset) is automatically created to generate a learning model based on decision trees. This model will be used later to automatically control the movements of a bot. The result is an artificial agent that mimics the human player. We have implemented, tested and evaluated this technology from two different points of view: performance by using classical metrics (accuracy, ROC area and PRC area) and believability by using a Turing test for trained bots. The results obtained are interesting and promising, showing that this method can be a good alternative to design and implement the behaviour of intelligent agents in video game development.


Introduction
In recent years, videogames have surpassed cinema in market share and have positioned themselves as one of the most popular and complex software systems in the world.In addition to entertainment purposes, they have been consolidated in other disciplines such as education or scientific research, where for example, [5] mentions that "modern video games have become an alternate, low-cost yet rich environment for assessing machine learning algorithms".
One of the most important phases in the development of video games is the modelling and programming of opponents, usually known as NPCs from their acronym in English, non-player characters.NPCs are autonomous and intelligence agents that play a fundamental role in their final quality; that is, they allow games to be made more "challenging and enjoyable" [3].
The role of NPCs in video games has at least two dimensions: quantity and quality.The quantity refers to having an adequate number of actors that provide the viewer with the feeling of participating in a real world; the second is the ability to create the illusion of credibility and is directly related to the behaviour of the actors [2].Currently, NPCs are programmed using deterministic computational techniques such as fuzzy state machines (FSMs) or scripting languages.Although these techniques are easy to use and quick to implement, some limitations have been pointed out in the literature, as mentioned in [7]: "there are some undesirable side effects with their use such as behaviours being less believable and more predictable due to the deterministic nature of these techniques".
On the other hand, although more techniques have been incorporated into advances, such as behaviour trees (BTs) [6], the main limitation of FSMs or BTs is that their design is top down and not bottom up.Including a bottomup phase (data-driven) can improve the FSMs and BTs and the knowledge of the designers about their game.Recently, bottom-up techniques, such as gameplay metrics and machine learning ones, have been developed [7].Regarding this last point, in the literature, some challenges and open problems related to the programming of NPCs have been raised: 1. "Developing automated agents that intelligently perform complex realworld tasks is time consuming and expensive.The most expensive part of developing these intelligent task performance agents involves extracting knowledge from human experts and encoding it into a form useable by automated agents" [15]; 2. "Modern Computer Game AI still relies on rule-based approaches, so far failing to develop a convincing, human-like opponent" [13]; 3. "Additionally, while players get more familiar with the game mechanics and improve their skills and devise new strategies, agents do not change and eventually become obsolete" [5].
One of the techniques used to solve these challenges has been learning by imitation, which is a very powerful learning mechanism that humans have and allows the acquisition of knowledge from observation [14].In [3], for example, it is mentioned that "although reinforcement learning (RL) has been a promising approach to creating the behavior models of NPCs, an initial stage of exploration and low performance is typically required.On the other hand, imitative learning is an effective approach to pre-building an NPC's behavior model by observing the opponent's actions, but learning by imitation limits the agent's performance in relation to that of its opponents." One of the requirements of this type of learning is as stated in [12]: "imitation requires a mechanism to map perceptions onto actions".This suggests that the theory of perceptions [16], and therefore, the management of imprecision plays an important role in achieving good models of imitation learning.
Although several learning algorithms have been applied in computer games, none have actually been used to dictate agent behaviour directly by using Linguistic Description of Complex Phenomena (LDCP).Another innovation of this paper is that LDCP is typically used to analyse a report in natural language which is automatically genereted from the data; however, in this work, LDCP is used to generate a dataset that will be used for training a bot.
More precisely, it is intended to create a general method that allows it to map computational perceptions onto moves for training a bot from the human play sessions.To do this, the behaviour of the players will first be captured from a computational perception network that will be created from the observations (execution traces) of the games.Later, we will use the computational perception network to create a dataset that can be used to generate a decision tree.A decision tree will be incorporated into the video game so that through a classification process, the movements of the bots can be controlled automatically.Our results highlight that our model produces agents that behave like human players.As our model is based on the theory of computational perceptions, it has a high level of interpretability and makes the decision-making process of the bots transparent.At the same time, it provides solutions to the previously mentioned open problems since it allows for obtaining expert knowledge of the players' games in an automatic way that can help developers when programming bots.Both the system and the demonstration videos that show the results can be publicly accessed.The development can be found at the following URL: https://github.com/pp1856/Agent-Training The following are demonstration videos of bot training using LDCP and decision trees: • Test 1 (7 attributes): https://www.youtube.com/watch?v=A8Y4by5LlngThe rest of the article is organized as follows.In Section 2, the basic concepts necessary to understand the rest of the work will be described.In Section 3, we explain in detail the model of learning by imitation based on LDCP.Section 4 explains the tracking and attention phases and how the data is captured and prepared for the perception phase that is described in Section 5, where the computational perception network that is responsible for transforming the data will be presented with data on linguistic knowledge.The training and classification process using decision trees from previous knowledge is given in Section 6.The evaluation of the model is performed in Section 7, and the conclusions are presented in Section 8.

Preliminary concepts
This section introduces some needed definitions to understand the rest of the paper.

Our Computer Game
A computer game is an interactive system that provides players with immersive and pleasurable experiences.This is formed by three components: (i) the input-output devices that provide players with controllers and interfaces in order for players to interact with the game; (ii) the objectives and the rules of the game that establish the rules of interaction among the different elements; and (iii) the program that describes how the game is implemented at the code level.The game world is the environment in which the game takes place.It is formed by either static or active elements.The actors are the entities that exist within the game world and that can interact with the elements of the game world and with other actors.The mechanism of interaction is fixed by means of the rules of the game.The player is an actor whose movements are performed by human players.The agents are actors whose movements are performed by a virtual player, i.e., specialized software.
We employ our own 2D computer game based on the pac-man game created for this reseach.Others versions of this computer game has been previusly used in previous works [11,10].In each play session, the player navigates through a maze containing rewards and one opponent.The goal of the game is to collect all the rewards and escaping from the opponent.The opponent roams the scene and chase the player.The game ends when all rewards has been collected or when the player is captuted (see Figure 1).

Linguistic Description of Complex Phenomena
Automatic Linguistic Description of Complex Phenomena aims to extract and represent knowledge by using natural language sentences (report) as if they were produced by a human expert, describing the most relevant aspects of a phenomenon for certain users in specific contexts.
LDCP is based on the computational theory of perceptions [16].It is grounded in the fact that human cognition is based on the role of perceptions and their remarkable capability to granulate information to perform physical and mental tasks without any traditional measurements and computation.LDCP has been used in previous works to generate linguistic advice for saving energy at home [1].
The architecture is based on the concept of Computational Perception (CP).A CP is a pair (A,W) described as follows: A = (u 1 , . . ., u n ) is a vector of linguistic expressions (words or sentences in Natural Language) that represents the whole linguistic domain of CP.
W = (w 1 , . . ., w n ) is a vector of the validity degrees w i ∈ [0, 1] of each u i .w i represents the suitability of u i to describe the current perception of a specific aspect of the monitored phenomenon.
For example: The current situation is dangerous", w 1 = 0.8 u 2 ="The current situation is risky", w 2 = 0.2 u 3 ="The current situation is easy", w 3 = 0.0 u 4 ="The current situation is safe", w 4 = 0.0 We use Perception Mappings (PM) to aggregate CPs.We distinguish two kind of PMs, namely, First Order PMs (1PMs) and Second Order PMs (2PMs).We define a 1PM as a triple (Z,y,g); where Z is a special type of CP with a numerical value z, y is a 1CP, g is a function W = g(z), the function g(z) can be implemented by using membership functions w i = µ i (Z) associated with each component a i of A and therefore: W=(µ 1 (Z), µ 2 (Z), . . ., µ n (Z)) where n es the elements of elements in A. A 2PM is a tuple (U,y,g); where U is a vector of input CPs, y is the output CP and g is an aggregation function implemented by using a set of fuzzy rules (see several examples of PM later on).

Decision Tree Classifier
Classification using decision trees solves a classification problem by decomposing a complex decision into a set of simpler decisions.A decision tree is built from a training set, which is made up of objects.Each object is completely described by a set of attributes and a class label [8].The attributes of an object can have numerical or nominal values (unordered data).The class label is a nominal variable.
The structure of a decision tree follows a hierarchical order from top to bottom.It can be represented as a directed tree.A decision tree is made up of a root node, zero or more internal nodes, and at least one leaf node.Each node has an associated attribute, and each division of a node evaluates the value of an expression of the attribute associated with it.The attributes present in a tree are those considered good at discriminating the input information.Leaf nodes differ by having a class label associated with them.
We build our trees using the C4.5 Decision Tree Induction Algorithm.This algorithm uses the divide-and-conquer approach to construct the decision tree.This strategy, sometimes called top-down induction of decision trees, can be recursively expressed as follows: First, select an attribute to place at the root node and make one branch for each possible value.This splits up the example set into subsets, one for every value of the attribute.Now, the process can be repeated recursively for each branch, using only those instances that actually reach the branch.If at any time all instances at a node have the same classification, stop developing that part of the tree [9].
The attribute to select is the one that produces the smallest tree, and the criterion used by C4.5 is the information gain.The information gain represents the informational value of creating a branch with a certain attribute.The attribute with the highest information gain value is chosen.
Once a tree has been built, the classification is performed with an object (also called an instance) as input data, and the tree is followed using the values of the attributes of the instance until the classified label for the instance is obtained.The trees built are usually evaluated based on statistics obtained starting from the number of instances correctly and incorrectly classified.

Imitation model based on linguistic description of complex phenomena
In this section, we will describe in detail our model of learning by imitation based on LDCP.The model is explained as a fuzzy adaptation of the model presented in [4].Our model is made up of five submodules: tracking, attention, training, classification, and moves.At the same time, these modules are grouped into three modules: perception, learning, and action.In

Perception
The perception module is made up of two submodules, tracking and attention, which are used to acquire and prepare the data so that they can be processed by a computational perception network.In our model, tracking is responsible for extracting the information from the current state of the game.More formally, at a given time i, the state of a game can be defined by a vector that will contain the information about what is happening in the virtual world at that moment.We call this vector the vector of the virtual world w i ∈ W , with W being the game space where every state can be represented.The observation space O represents the observable information for a player and is therefore a subspace of W. We define an observation/instance as a vector o ∈ O with O ⊂ W . Considering the entire observation space, we will focus on those observations that can lead to some behaviours that cause a movement S. We define the state as a vector s = (s 1 , s 2 , . . ., s n ) as the projection of o in S.
The attention module is responsible for selecting the relevant information from the data captured in the tracking with the aim of simplifying the classification and learning.The selection is made considering the variables that intervene in the behaviour and that are believed to be key to implementing the imitation process.In particular, we will use fuzzy logic and computational perception networks (if-then rules with linguistic variables).We start from a state vector s = (s 1 , s 2 , . . ., s n ) formed by a set of precise variables.As some observations may be imprecise and depend on each player, we will handle imprecision using computational perception vectors.From a precise vector, a vector of computational perceptions can be created: l = (l 1 , l 2 , . . ., l n ).For each s i , there may be m perceptions (l 1 , l 2 , . . ., l m ) that will depend on the fuzzy linguistic definition of each s i .We employ the concept of CP.A CP state is a pair (U,W) described as follows:  L = (l 1 , . . ., l n ) is a linguistic vector that represents the whole linguistic domain of CP, which is defined from (s 1 , s 2 , . . ., s n ).
W = (w 1 , . . ., w n ) is a vector of the validity degrees w i ∈ [0, 1] of each l i .w i represents the suitability of l i to describe the current perception of a specific aspect of the monitored phenomenon.
Recapitulating, from a set of data obtained from an execution trace, we will obtain a set of observations or precise instances that can be transformed into a set of computational perceptions (list of pairs: (linguistic value, degree of validity)).An implementation of this module is explained in detail in section 5.

Learning
For the learning process, we will assume that the set of games (traces) is available and that they are generated from expert players.Each game contains the vectors presented in the previous phase.We are not going to make assumptions about the quality of the dataset.The objective is, therefore, to learn a relationship of the type P: CPs ← M that, based on perceptions, gives us the best move to perform given the state of the game at a given moment.The learning result (decision tree) can be seen in Figure 4 and the process is explained in detail in section 6.

Classification and Movements
The classification and movements submodule is in charge of carrying out the imitation process through the execution of the movements acquired in the learning phase.More precisely, the process is as follows: a row is read from the execution trace, the data are converted to CPs, which are organized in an instance, the instance is classified and the label resulting from the classification is used as input data in a function of search whose result determines the direction in which the agent moves.Once the direction is determined, the corresponding movement is carried out.The algorithms that perform these tasks are shown in Algorithm 1, 2 y 3 To generate the decision trees, we use J48, which is the implementation of the C4.5 algorithm from the Weka library.The resulting trees are exported as a static classifier (Java class), which provides us with a convenient function to perform the classification.The classification function is where an instance is used to create the data in the table in real time to determine the class label, the variable that determines the final decision to be made.

Algorithm 2: function classify
Input: Instance I to be classified Output: Class P most likely for the instance I P = NaN; P = nX(I); return P ; The function nX is a different function for each node of the tree, and X represents a hexadecimal number assigned to each node.The function is called in principle from the root node, and each subsequent call is made from an internal node.In each variation of the function, a different test is performed, and the different values of an attribute associated with a node are evaluated.It follows from node to node until obtaining the label (P) resulting from the classification.

Tracking
For tracking, we will use the concept of execution trace, which is a technique used to record the relevant information that occurs during the execution of a program.Execution traces are commonly used as a performance analysis and debugging tool.In our case, due to the nature of video games, we will use them to capture and store the data generated from the movements made by human players, agents and opponents.In this way, the traces perform the observation function (key in frameworks based on learning by imitation).
In particular, the data captured correspond to values associated with the state of the game at the time the movement is made.Specifically, the locations of the relevant entities include the player or agent, the adversary, and the reward closest to the player or agent.The time of the game, the event of the capture of a reward and the entity that performs the action are also recorded.
From the captured data, metrics are defined that provide useful data that cannot be inferred using the values captured individually.Using metrics, the state of the game and the behaviour shown by the player or agent can be interpreted.In this case, the defined metrics are as follows.
• Protection.Percentage of obstacles present between the player or agent and the opponent; a rectangular area created from the location of the player or agent and the opponent is used.
• Distance.Distance between two entities E1 and E2.
• Time.Time elapsed from the start of the game until the moment the action was performed.

Attention
Attention is implemented using the concept of a computational perception network.We will use a modified version of the network of perceptions presented in [11]; in this case, the computational perceptions (CPs) have been reduced.Although all first-order computational perceptions are maintained (1CP), two second-order computational perceptions (2CP), CP Ability and CP Skill, are eliminated.This is because our objective is not to evaluate the performance of the player but rather to use the perceptions that best represent the actions of a player.In this way, the 2 CPs used correspond to CP Situation, CP Attitude and CP Movement.The metrics, linguistic variables and rules used have been redefined for this development, so they will be explained in detail below.

First-order computational perceptions
We use numerical data obtained from the variables and metrics previously defined as input data for the membership functions that will determine the degrees of validity of each 1CP.• CP Distance.This is the perception used to perceive the space between entities.Given a scenario divided into cells of equal size and considering that an entity occupies the space of a cell, the distance is calculated according to the number of cells between a pair of entities.If each cell is represented by a location x, y, then the distance D between two locations is calculated using the following equation: D = (x-x') + (y-y').We define three different distance CPs: the distance between the player and the opponent, the distance between the player and the reward closest to the player, and the distance between the opponent and the reward closest to the player.We denounce this 1CP as follows: where N is the maximum distance in the game scenario.
• CP Protection.This is the perception used to perceive how obstructed the area is between the player and the opponent.Given a split stage in cells of equal size and considering that an entity occupies the space of a cell, the protection is calculated by determining the percentage of obstacles present in the area between the player and the opponent.If each cell is represented by a location x, y, the rectangular area formed by the player and opponent locations is calculated, then we count the number of obstacles present (Opr) and possible (Opo) in the area.Finally, we divide them to obtain the percentage P of obstacles present.The calculation reduces to the following equation: P = Opr/Opo.We define this 1CP as follows: Z = [0, 1] A = (low; medium; high) g: This function is constructed using three labels that are represented with trapezoidal membership functions: low (0,0,0.25,0.41),medium (0.25,0.41,0.58,0.75),and high (0.58,0.75,1,1).
• CP Time.This is the perception used to perceive the time elapsed since the start of the game.Time is calculated by determining the amount of time in milliseconds elapsed from the start of the game until the moment a move was made.Given the current time t and the time at the start of game t', the calculation of the difference results in the elapsed time T. The calculation reduces to the following equation: T = t -t'.We define this 1CP as follows: Z = [0, N ], N being the maximum time established for the duration of a game.

Second-Order Computational Perceptions
• CP Situation.This is the perception used to perceive the state in which the player is in relation to the opponent.Four possible situations are defined: risky, dangerous, safe, and easy.The situation is determined by evaluating the 1CP Protection and Distance (playeropponent).With the values of the linguistic variables obtained from these 1CPs, in this case, protection (low, medium, high) and distance (small, medium, large), an if-then rule set is used to determine the value of the CP.The rules used are the following: risky ←medium, small; risky ←large, small; dangerous ← low, small; safe ← medium, medium; safe ← high, medium; easy ← low, medium; easy ← low, high; safe in any other case.
• CP Attitude.This is the perception used to perceive the actions of the player.Four possible attitudes are defined: wise, brave, prudent and passive.The attitude is determined by evaluating the 1CP Distance (player-reward) and Distance (opponent-reward).With the values of the linguistic variables obtained from this 1CP, in this case, Distance (small, medium, large), a set of if-then rules is used to determine the value of the CP.The rules used are the following: wise ← small, medium; prudent ←small, large; prudent ← medium, large; brave ← small, small; brave ← medium, medium; wise ← medium, small; wise ← large, small; passive ←large, large; passive in any other case.
• CP Movement.This is the perception used to perceive the type of movement made by the player.Four possible moves are defined: good, scared, kamikaze and bad.Movement is determined by evaluating the 1CP Distance (player-reward) and Distance (player-opponent).With the values of the linguistic variables obtained from this 1CP, in this case, Distance (small, medium, large), a set of if-then rules is used to determine the value of the CP.The rules used are the following: good ← small, medium; good ← small, large; good ← medium, medium; scared ← large, medium; scared ←large, large; kamikaze←small, small; kamikaze← medium, small; bad ← large, small; scared in any other case.
The aggregation function g used to determine the degrees of validity of the 2CP corresponds to an average of the degrees of validity of the 1CPs that determine their value.

Classification
Agent learning was posed as a classification problem where the CPs associated with the actions of a human player are used as training data to implement a resulting static classifier in the video game to decide the movements of an agent according to its own CPs.A decision tree without pruning was used as a classification method.This method is very useful in this case since the resulting classifiers can easily be expressed as a set of if-then rules.In our case, J48 provides us with static classifiers that can be easily implemented in our video game.The attributes used for the generation of the classifiers were defined from CPs, and two attributes were assigned for each perception, one for the linguistic variable and another for the degree of validity.The tags used were constant throughout the tests.The class was defined as an action go ahead, get away.
The implementation of the static classifiers generated from these tests was performed using the code generated by the Weka library, which exports the source code as a class in Java.This can be implemented directly since the game is also written in Java.The data used for decision making with the static classifiers are CPs obtained in real time during a game.The first test (T1) points to the use of a minimum number of 1CP in the training data set.Three 1CPs were used, chosen based on the relevance of the metrics with which they were constructed.The 1CP used corresponded to the Protection CP, Distance CP (player-opponent), and Closeness CP.The latter was used exclusively for this test and is defined as follows.
• CP Closeness.This is the perception used to perceive how much closer or farther one entity is from another in relation to a third entity.Given a scenario divided into cells of equal size and considering that an entity occupies the space of a cell, the proximity is calculated according to the distance between entities, which is determined by the number of cells between them.We define Closeness C as the difference between the distances from entity a to entity b and from entity b to entity c.This can be calculated using the following equation: C = d (a, b) -d (b, c).In particular, we use this CP to perceive how much closer or farther the player is to the closest reward in relation to the opponent.We define this 1CP as follows: Z = [−N; N], where N is the maximum distance in the game scenario.A = ("much closer"; "closer"; "farther away"; "much farther away").g: This function is constructed using four labels that are represented with trapezoidal membership functions: "much closer" (2,6, N, N), "more close" (-2,2,2,6), "farther" (-6, -2, -2,2), and "much farther" (-N, -N, -6, -2).In this test, the class label values of each instance of the training dataset are determined by a simple rule based on the distance metric (player-opponent).The rule is that if the distance between the player and the opponent is maintained or increased, then the player is evading the opponent unless the player is ignoring the adversary.The second test (T2) points to the use of all the perceptions defined in the CP section as attributes keeping the class definition.The values of the class label of each instance of the training dataset are obtained in the same way as previously described.This test was divided into two parts: in the first part, a test was performed using all the CPs as attributes, and in the second part, another test was carried out using the 2CPs CP Situation, CP Attitude and CP Movement together with the 1CP Time as attributes.
The third test (T3), similar to the second, was divided into two parts with the same end, pointing to the use of all the perceptions defined in the section of CP as attributes maintaining the class definition, but with the difference that the values of the class label of each instance of the set of training data is determined differently, with a new set of rules based on the 2CPs used as attributes: CP Situation, CP Attitude and CP Movement.The rules used are the following: R1: go ahead ← wise, good, safe; R2: go ahead ← wise, scared, safe; R3: go ahead ← wise, good, easy; R4: go ahead ← wise, scared, easy; R5: go ahead ←wise, scared, safe; R6: go ahead ← wise, scared, easy; 1.0 0.9 0.9 0.9 1.0 1.0 0.9 0.9 0.9 1.0 1.0 0.9 0.9 0.9 1.0 1.0

10-fold crossvalidation results
Accuracy ROC Area PRC Area   get away in any other case.

Evaluation
The tests were conducted with a dataset of approximately 1,160 instances.We evaluated the classifiers with the validation method of 10-fold cross validation.From the results of the validation, we evaluate the performance of the models based on the following metrics.
• Accuracy: We define accuracy as the proximity of a measured value and a reference value.In our case, we represent accuracy as the percent-age of instances classified correctly.We use this metric to determine how correct the models are when classifying.
• ROC Area: This area is obtained from the receiver operating characteristic curve, which is plotted in a graph of axes (1-specificity) and sensitivity.The area under the receiver operating characteristic curve is a value that represents the expected performance of a classifier considering the correctly and incorrectly classified instances.We use this metric to determine how well the models perform in predicting actions (evade or go ahead).
• PRC Area: Obtained from the precision-recall curve, which is plotted on a precision and recall axis graph, the area under the precisionrecall curve is a value representing the expected performance of a classifier considering correctly predicted instances and correctly classified instances.We use this metric to determine how well the models predict the actions considering an imbalance in the data.
Table 3 presents the main values related to the evaluation of classifiers, from which it can be seen that the results were similar between the metrics of each test, showing that the models generated perform in a similar way through the metrics with which they are evaluated.From these results, we can conclude that the accuracy is representative of the real performance of the generated models and, therefore, that the generated models imitate the learned behaviour with a minimum accuracy close to 90%.In the third test, the values notoriously reach 100%, which is due to how the class values are obtained.By relying on rules that use the same values of the attributes of the dataset, the rules of the generated classifier results from the inference of the rules that determine the values of the class, ignoring any value irrelevant to the classification, as in this case would be the degrees of truth.Unfortunately, from this test, we can conclude that the training resulted in a classifier that mimics the rules that determine the value of the class rather than mimicking the behaviour of the player.
Through the observation of the agent's behaviour using the different classifiers, we found that, in general, the agent can finish the games successfully and without problems with almost all classifiers, except for the case of the classifier generated in the second test with 17 attributes (T2 (17)).This one showed a more inconsistent behaviour than the rest during the tests.On the other hand, a very similar classifier but with fewer rules, such as the result of the second test with 9 attributes (T2 (9)), was very effective.From this finding, it could be suggested that if it had been a pruned tree, the classifier with 17 attributes would have been much more effective.The classifier resulting from the first test was simple and effective, resulting in a set of rules smaller than those of the classifiers of the second test but much higher than those of the third test classifiers, since these turned out to have a minimum number of rules.In terms of the speed to successfully solve the video game scenario, the agent was progressively faster during the tests, starting with a game duration of approximately 2 minutes in the first test (T1) and ending near a minute and a half in the third test (T3).This is observable in the video demo files linked in the Introduction section.

Conclusions
Video games are a very powerful tool for investigating the techniques of artificial intelligence.We have pointed out the importance of the development of opponents in such environments and the limitations of the programming of their behaviour.In this sense, we have proposed a new way of programming behaviours by imitation, proposing and evaluating a machine learning model based on the linguistic description of complex phenomena and decision trees.The result was an architecture composed of three modules (perception, learning and action) that allow the creation of a correspondence between perceptions and movements.We have managed to make bots imitate human players based on the observations themselves, in our case, the games.From the results obtained after the evaluation, we can conclude that our model can be very useful for programming the behaviour of characters in video games since it uses fuzzy logic and possesses the ability to handle the imprecision and the underlying subjectivity in this process.
In terms of future work, we can suggest that future studies focus on obtaining more effective classifiers for this purpose through pruned trees and the use of a random forest.We can also suggest the use of explainable artificial intelligence to obtain a better understanding and evaluation of learned behaviours.

acknowledgements
This paper is the result of work by the SOMOS research group (SOftware -MOdelling -Science), funded by the Dirección de Investigación and Fac- Email address: clrubio@ubiobio.cl(Clemente Rubio-Manzano) Preprint submitted to Elsevier January 8, 2021 arXiv:2101.02264v1[cs.LG] 6 Jan 2021

Figure 1 :
Figure 1: 2D computer game developed by the research

Fig 3 ,
each of the modules is shown together with their dependencies.The components in charge of carrying out the functionality of each submodule is shown (see section 3.1): 1. Tracking -Execution Traces 2. Attention -Computational Perception Network 3. Training -Decision Tree 4. Classification -Static Tree 5. Moves -Bot

Figure 3 :
Figure 3: Our imitation model based on linguistic modelling of complex phenomenon

Algorithm 1 :
function toMove Input: T (execution trace) Output: void (executes a movement M i ) R = read last row(T) ; I = create instance(R) ; V = classify(I) ; R = search (V) ; foreach M i : possible movements do if R==M i then executes movement M i ; end

Algorithm 3 :
function nX Input: Instance I to be classified Output: Predicted most likely class P for the instance I (Note I is represented as an array of capacity C and P is represented as a double value.)P = NaN ; foreach decision rule R do if I[s] is compared with R evaluates to true then either P = nX(I) if there are more childnodes OR P = D if there are none else end end (Note s is an index of the instance evaluated in a specific node and D is a value of the class); return P ;