![]() |
|
|
Your'e It! by Emily, age 12The purpose of my project is to simulate a game of “Tag” between two different VisualBot objects called Bots. Each Bot has its own characteristics that affect the outcome game, just as in a real game of “Tag” between two friends. Speed and quickness are examples of these. In my simulation, one Bot sets out to tag another Bot. Once it has accomplished this task, its opponent then transforms into the chaser and it becomes the fleeing Bot. The chasing Bot counts to 10 before setting out to tag its adversary, giving it’s flee-er time to run away.
To create my simulation I first constructed the size of the Screen display area and its background color. Next I created two Bots and defined some initial characteristics. I gave them each their own shape (e.g. ant, spider, beetle, etc.), color, size, and Pen color. I also gave them each a speed which is modified according to whether they are currently “It” or not. Each Bot was then given the ability to change from the chaser into the flee-er and vice-versa as the game is played. After characterizing the Bot and the “world” around them I was then ready to start forming the game of “Tag”. First I programmed the simulation to run for a certain number of time steps in order that the simulation would not run without an end. Once I had done this I programmed the Bot to follow certain instructions when they were chasing and to follow others when they were fleeing. I created two versions of the game, with different sets of instructions, called “Tag 1” and “Tag 2”. In “Tag 1” I programmed the chasing Bot to sense the location of the Bot it was chasing and approach it. To make the simulation interesting I gave the fleeing Bot a faster speed than the chasing Bot (although the speeds can be altered during the simulation). When the chasing Bot reaches a certain distance from the flee-er, a message box appears and states that the flee-er has been tagged, roles have been switched, and the new chaser will begin counting. Along with the switching of roles, the Bots also take on the speeds of the changed roles. To initiate the counting, I programmed the chaser to pause for a selected amount of time to allow the flee-er some lead time to get away. And lastly, to finish off the simulation, I gave awareness to the Bot being chased. When the chaser is within a certain distance from the flee-er, the Bot being chased senses this and turns in the opposite direction of the chaser to flee. “Tag 2” was programmed exactly the same as “Tag 1” except for the fact that in “Tag 2” the Bot fleeing has been programmed to take random turns throughout the simulation. In order to design this program many VisualBot methods and properties were used. One of the most interesting is the element of randomness in behavior. For example, commands such as Bot.TurnRand -15, 15 causes the flee-er Bot to turn by a random amount between -15 and 15 degrees. Two very important VisualBot methods and properties are the methods DirTo and DistTo, which give the Bots awareness of each other by allowing them to judge the direction and distance to the other Bot in the game. These make it possible to chase and avoid, and to know when a Bot has been tagged. Another important command is the Bounds property, which I used to change the way the Bots behave at the edges of the Screen. There are three modes. One is to make the World like a box with walls, another is to make the edges open so that the Bots “wrap” to the other side of the display, and the third is to have no limits at all.
After observing my simulations I have discovered that in a “walled” environment the chaser must be slower than the flee-er or the game will not last long at all because the flee-er will usually be caught within a few seconds. I have observed that in a walled environment the game will last longer if the chaser and flee-er have equal speeds but the flee-er gets cornered more often in this case (the game doesn't last as long as it does when the chaser is slower than the flee-er). In the case of a “wrapped” environment the chaser must be faster than the flee-er or the flee-er will never be caught. I observed that in “Tag 1”, the game sometimes produces attractive symmetrical Pen designs where the Bots make repeated movements because of the lack of randomness in the game. I have learned a lot from this project. I knew very little about programming before and now I feel like I know a lot more. I have learned that only certain programming commands can be used to create the simulations, and if they are not correctly used or placed then the program will not run. I have also learned that the Bots can behave in complicated ways, even though my program that controls them has a simple design. Back to projects main page <<prev project next project>>
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Copyright © | This sited last updated Jan 05, 2008 |