J2ME artificial intelligence entry

xiaoxiao2021-03-06  130

Artificial Intelligence Start Today I will discuss artificial intelligence and synthetic intelligence world. The math concept behind artificial intelligence and related science is too advanced, even a Philosophora can only understand most of the content. Therefore, with its chattering, the Baysian learning algorithm, the nervous network model, and many other abstract nonsense are not as simple as the complex content. We will learn how to use simple rules and simple software synthesis seeming complicated things. Artificial intelligence describes techniques for simulating logical thinking and decision on a computer. However, the techniques used in the past conventional artificial intelligence are all based on certainty algorithms, that is, attribute-based rules systems. These systems are based on the "IF ... the" structure. A database, or a knowledge base is created in the form of information (this information is related to each other). Subsequently, rules based on logic, statements, grammar, etc. are used to solve problems generated by the system, as shown in Figure 1-1. The problem of traditional artificial intelligence systems is that they are almost certain. Although some systems can use the modulo, select almost the same solution, but the artificial intelligence system will not provide unbeartable things in an indirect manner. Artificial intelligence "new" science is not based on this "simply" logic. New discovery of cellular automated machine, artificial life, fuzzy logic, nervous network, sparse distribution, etc. Tell our thinking is not certain. There are many absence of scientific and personal preferences. For example, if you are walking and selecting a specific road, in this case, you will definitely not consider every step of walking. You only know there is a destination and choose the best way to arrive there. "Best" is a difficult part. How can your brain can calculate the "best" road? Is it a shortest approach to continue to calculate the trajectory or get the shortest distance? Or does it refer to you a total direction, then turn again when it feels wrong? The problems and calculation models based on these observations are the foundation of artificial intelligence. We understand the human brain as a computer scientist and neurologist (in this regard, all animals' minds) have a "fuzzy" nature (for their logic) and decision-making function, which is why we are so complex the reason. Figure 1-2 shows a blurred logic system. The artificial intelligence theory we study today is very simple. Anyway, it is a starting point, we can continue to work and build a more complex system on this basis. -------------------------------------------------- --------------------- Modes Now our brain has been installed: tracking (chase) and evading decisions move in random direction, however, many times a person Or the behavior displayed by a thoughtful animal is foreseeable and in order or mode. For example, when starting a car in the morning, it is to follow a foreseeable order step - a mode - is the case every time the task is completed. This mode is through inference, logic or experience, perhaps it is integrated. Anyway, the end result is that we follow a model. We are very familiar with the model of game opponents and players in computer games. Many people playing games always find the pattern by knocking on the computer. The reason is that the computer itself will use mode. You can find the back of the computer mode (symbolic statement) as a game programmer and use it to knock on the computer. User mode in a game is what we want to do. For the author, I think a game should not always be moderate; that will be very boring. However, we (game) should have the ability to perform mode, as part of our brain structure. In the example I mentioned just, starting a car is the best reason for getting a model.

Aunt, if we use logic and have knowledge about mechanical and electronic knowledge, it is likely to find a way to start a car, but it is easier to use a model. In an instance of computer games, we can use the model to provide everything we want, such as selecting a direction to select a rule to select a behavior, of course, this list can continue, imagination is the only limit factor. Let's talk about how to use the mode to move a player opponent on the screen. We can even choose a model with a random number from a set of modes. The example we have lifted is the familiar "little bee", put the player role in the bottom of the screen, put the computer-controlled opponent on the top of the screen and arranged in a certain formation. We may want the player to perform a certain flight mode - tuning, rotation, decomposition, and S-shaped rotation, etc. - then restore the original formation. To implement these we can create a pattern table for the game, the program can be arbitrarily selected from this table, and then the program will be used. Here is the table we use (array): int patterns [num_patterns] [max_patterns_elements] = {1, 1, 2, 2, 0, 3, 4, 4, -1, 2, 2, 1, 1, 4, 4, 4, 1, -1, 0, 0, 0, 4, 4, 4, 1, 1, 1, 2, 2, 2, 2, 1, 3, 3, 4, -1}; as you As seen, there are four modes. Each mode contains up to 5 instructions. These instructions are converted into a direction, and then converted into actual rate vectors to control external robots, this mode can be shown in Figure 4-1. In the mode device provided for "small bees", the author uses the mode of moving the robot on the screen. This program reads into the table, then mobile robots in the appropriate direction based on the elements in the current table. The mode device can understand six values ​​or instructions. Value 1 - 4 is direction, north (n), south (s), east (E), West (W). 0 means that it does not move, and -1 means the mode ends. The use of mode can not only be connected. Mode can be used to select actions, random numbers, and the like. For example, a pattern can be used as the root source of the random number generator to facilitate the flow of time, and the generated random number is based on a different root value. This will achieve the effect of changing the probability distribution of the number, and the behavior of any system that uses the random number is changed. For the brain we make, we use mode only as movement order. However, you can use them to provide anything you want. -------------------------------------------------- -------------------- Copeic and escape In order to facilitate analysis, we can use a player and a game object or a model of the player object. The problem is that we want the player to track and chase the role of the player. There is a pair of coordinates and the player's role, pointing out what positions they are in the game, as shown in Figure 2.1. Tracking algorithm 2.1 acquisition (PX, PY) - Player's position (CX, CY) - opponent's position begin // do x tracking if (px> cx) THEN CX ; Else IF (PX CY) THEN CY ; ELSE IF (PY

Therefore, the player's opponent looks like a chasing the role of the player. Algorithm 2.1 causes the player to track or attack the player's role. Regardless of the player moving it in that direction. Well here: We move the player opponent to the player's role in every coordinate, as shown in Figure 2.2. Algorithm 2.1 is somewhat cruel; it stops until the player's opponent is on the gamer's role. Of course, this may be what you want. However, this may have an aggressive. It is like a track missile: it will stop until you hit. To make further improvements, we can increase the following logic premise: When something is chasing you, it must first see you first. In other words, it is certainly within a certain range. Consider this situation, we can use a visible radius. We can test to see if the player's opponent is within a certain distance of the player's role (its visual range or sensing range). If the condition is true, we open this algorithm. Otherwise, we can make the player's opponent, rather than chasing the role of the player, because it is simply unable to see the player's role. 2.2, escaping the rebuy words of the chasing. The approach is the same as chasing, but everything is reversed. If the player opponent on the right of the player role, the player's opponent continues to move to the right instead of moving left (near the player role), as shown in Figure 2.3. Escape algorithm 2.2 acquisition (PX, PY) - Player role (CX, CY) - opponent location Begin // DO X Tracking IF (PX> CX) THEN CX -; ELSE IF (PX cy) Then Cy -; Else IF (PY

Please refer to Figure 5-2. The example we talk about is a typical example of a limited state machine provided by the game object. In short, a game object may have a lot of status, complex rules control status, and these status changes we are called state migration. In addition, a state can be output. For example, in the instance of our status model, the death status may have an output, and the signal is notified the sound system to play a scream. Through the above description, we already know what is a limited state machine, but how do we make it in your computer? Below we will write pseudo code as an example: We can define some variable tracking status based on each state and possible input to set rules // definition status #define state_chase 1 // chase #define state_random 2 // random #define state_evade 3 // Escape #define state_pattern 4 // mode // Give the Elf State_Chase Status INT Sprite_State = State_Chase; // Enter the Game Main Cycle While (! DONE) {... Switch (Sprite_State) {Case State_chase: {/ / Chasing status control logic} Break; case state_random: {// Random status control logic} Break; Case State_EVADE: {// Escape of status control logic} Break; case state_pattern: {// mode status control logic} Break DEFAULT: BREAK;} // end switch sprite_state Please remember the simple AI model above, maybe you will use. Another point can be added to a limited state machine: Painting status control. This is to change the status before the state is completely not "mature" based on certain variables or functions. In the pseudo code above, each state must be completed. We can increase the conditions as: If there is enough factors in the execution of the state, the limited state machine will "jump out". Summary: When designing a limited state machine, it is necessary to carefully consider all state and state migration rules to avoid "unlimited loops" that are beginning in two intermediates. -------------------------------------------------- --------------------- Fuzzy logic and probability How to say as described in our first chapter, human and animal behavior can be predicted - even Livestock, they also have their own behavior. This has a fuzzy logic and probability. Fuzzy logic is introduced in the 1960s, but it became a mainstream concept until the 1990s. The fuzzy logic is based on selecting a set of inputs and conditions, and then we use the things we call Defuzzifier to draw a simplicity based on data and probability. For example, when you face the obstacle that makes decisions, you are going to the left or right? The two opportunities are equal, and the decision is random, or "blur". This will have a fuzzy logic. Use a fuzzy logic using a set of rules, then use statistics and probabilities to draw results between rules and answers. This is like the same as the answer by the throwing, but we do this in most time, then why can't you make your computer do this? In this chapter, we use fuzzy logic to control our player opponents. After that, we will see a more complicated application of fuzzy logic and probability, but now let us start from simple.

转载请注明原文地址:https://www.9cbs.com/read-101956.html

New Post(0)