Project Information Guidelines to K-12 Teachers Topics covered in this project: Artificial Intelligence K-12 grade targeted in this project: 12th Time required to cover the PowerPoint presentation and the Scratch Project: 1 hour Resource Required: a computer Runner Scratch Project "Runner" is a basic program in which the player moves a sprite. A sprite is an object; that the user created using graphics, like a person would in Microsoft Paint. The created sprite, is a car, that the user moves in a stage. The stage is the background, that the player is playing the "Runner" game on. The stage also contains other sprites; that are AI controlled. AI controlled sprites are uniquely programmed, so that it works off pure programming code and does not require human intervention to work. The AI sprites in this game are shaped as swords, and the "Sword" sprites move back and forth across the "stage". There are also other "Sword" sprites that appear 25 seconds into the program. Although unlike the "Sword" sprites 1, 2, and 3, the "Sword" sprites 6, and 7; bounce continuously until the game ends. When the game is started, the player has three lives, but if the AI sprite touches the user controlled "car" sprite, then a life is lost. This process continues; until all three lives are gone at which point the "Game Over" words display. This is all accomplished in its unique coding that makes use of user input, Boolean logic, loops, methods, conditional branches, and sound. Because of this the code is able to easily demonstrate computational thinking or analytical thinking. And Artificial Intelligence which is a human designed computer mind, that has been created to work off code on its own. One of the ways the game accomplishes making the human player sprite, is through its implementation of user input. User input in Scratch is just like user input in any other programming entity; the user uses a peripheral object such as a mouse or a keyboard and when the user moves the mouse or uses the keyboard there input is sent to the program and the action is executed. For example the program is designed so that it registers when a user hits the "left arrow" key; it makes the program human controlled sprite go left. Just as when the user hits the "right arrow" key it makes the sprite go right, when the "up arrow" key is hit it makes the sprite go up, and also when the user hits the "down arrow" key the sprite goes down. Another way it takes user input is if the "e" key on the keyboard is pressed. After "e" is pressed a question box pops up that asks for a password. If the password matches up with the set password then it unlocks the second stage; however if they do not match it will not go anywhere. The user input in the program is one of the reasons, that this is a very good program to teach students the topics of Artificial Intelligence and Computational thinking. Furthermore the program also implements various variables. Variables in scratch are important they contain values and be manipulated to create things in Scratch, that programming without variables cannot. Take for example how it uses the constant variable "speed". It defines "speed" to a certain number and then combines this variable with statements to produce movement at the set speed number. The program also makes use of two other variables, that hold set passwords for the two question boxes in the program. These are what essentially makes the whole question block in the program work. Without the password being set in a variable the program would have nothing to compare to and therefore would not work correctly. The program also utilizes a variable called "lives." "Lives" holds the amount of lives and displays it while the program is being run, without the "Lives" variable the program would not be complete. The variable is set to three, and then allows the program to mutate the value of lives every time the "car" sprite touches the AI sprite, which causes the user to lose a life. Finally the variable called "score counter" is the variable that holds the user it is what monitors their performance in game. The variable "score counter" is initially set to 0 and is then increased by 1 every time the user touches "black" in the program. The variables are an integral part of the program they are essentially what makes it function and also makes it easier to understand. Due to these variables Artificial Intelligence is able to be seen easier. For instance with variables the user can tell that when an AI "sword" is touched the user loses a life. Furthermore it clarifies Computational Thinking in its ability to make things work that otherwise couldn't and allows students to see how variables operate. The program also makes use of loops throughout its construction, so that it functions correctly. Loops are a huge part of the program they are what allow things to evaluate multiple times, or not evaluate when they shouldn't. Even bigger than this is, that they are used to create not only the movement code for the user but in the creation of AI sprites. It uses the forever loop, which runs until the program stops much like a while loop in "Java". A simplified explanation of the forever loop is, that it simply runs the code statement until the game stops. The forever-if loop runs similar to that of a "forever-loop" except that it is only executed if the condition of its "if- loop" are met. Finally the program uses "if "and "if-else" loops. These loops run through once if the condition inside it is met and evaluates to true. The key difference is that in an "ifelse" loop, if its Boolean condition evaluates false then it goes to the else part of the statement. One example of these loops in the program comes in the area in which I programmed the user input for left, right, up and down. The four "if" loops that were utilized only run, when the condition are met in this case it be would be either when the left, right, up, or down arrows are pressed. The loops are what allows the program to function correctly. Without loops the user would not have any control over how many time code should run and also when code should stop. These loops also clarify Computational Thinking by allowing students to see and understand why these AI move and stop moving when they do. These loops also help demonstrates AI functionality by allowing the AI to move at certain times and in certain patterns. Furthermore these program also shows the uses of conditional branches. Which are branches that are typically created from loops in their condition statements that allow them run only under certain conditions. In which operators, sensing blocks, and ect.. are built in to loop and then if the condition is met the chain of programming that follows inside the loop is executed. The statements embedded in the if , if-else and forever-if can be evaluated. These can then lead into more if statements that reside inside the if statement which have more conditions to be evaluated. These are what are called conditional branches. These branches also allow for Computational Thinking by students, in that it allows them to see how these branches evaluate and then run the program. It also shows AI because it is of course a building block for the AI, without conditional branches the loops would have no conditions and wouldn't function properly. The program also uses methods such as its method to move forward, backward, right, and left. Methods are something the programmer creates in code to perform a certain task for instance a programmer might create a method to simulate gravity. In "Runner" methods are used as well. For example when moving upwards an if loop is used with a piece from the sensor block. This tells the program that when this piece is pressed the if statement evaluates. Then inside the statement is the method, which takes advantage of the motion block in "Scratch." It uses my constant variable "speed" combined with the "move steps" piece to move at a certain speed. And then "point in direction 90" piece to tell the program, that whenever the "up arrow" key is pressed it should move upward. These methods allow for things to happen, they are more than just simple straightforward programming statements. These statements are not just sprinkled in some places. Rather they are a systematic chain of commands that when put together right produce powerful results. Like for instance the movement of the human sprite or the method to ask the question that is in the program. These also enhance the Students grasp on Computational Thinking by allowing them to see how these methods work. It also shows AI to the students by creating the methods to actually move the AI, or make the sprites take away health, without methods this would not be possible. This program also makes good use of Boolean logic which is the use of statements that equate to either "true" or "false". This program uses Boolean Logic in a lot of areas of the program. Such as in its use of its operators like greater-than. In the greater-than operator it evaluates a condition to either "true" or "false." If the quantity being compared is greater-than it is true. Otherwise the condition is evaluated to false and it doesn't run through. The program "Runner" also uses other forms of Boolean logic in its loop conditions like all the if statements that it incorporates with sensing statements such as when the "up arrow" key is pressed to make a car sprite go up. The sensing statements are also Boolean Logic when they are used they also equate to true or false. For instance when this key is pressed it moves the object that the user wants to control but when not pressed it goes to "false and therefore will not move. The Boolean Logic used in this program, allows the Students to see how ,and when the program will operate by allowing them to see if the statement will even evaluate. Also incorporated into the design of the program comes sound. Sound makes the program more interesting, and creates a mood of excitement when playing the program to hold the attention of the user. In this program it plays a drum sound every time the program starts and continues until the program ends. What sound does for the program is simple and definite. It enhances the feeling of the program and makes it more unique. For example a program without sound but with solid programming. Would have less chance than a program with good robust programming and enticing music, which tends to be entertaining which people enjoy. As one can see, this program is not too complicated and could easily be used by a High School teacher to teach the students Artificial Intelligence and Computational Thinking. The program has a total of 5 computer controlled sprites or AI players, that run across the screen continuously. With these the teacher then could simply show the students how and why these computer controlled sprites work. And then give a demonstration by allowing each one to watch the program in action and thereby allowing them to monitor the AI sprite behaviors to see AI in its processes. With understanding the code and then watching it run it could improve students' Computational Thinking vastly by challenging them to think more analytically about how to make things in other programs work similarly.