Sunday, February 23, 2020
Programming with Alice Assignment Example | Topics and Well Written Essays - 750 words
Programming with Alice - Assignment Example Alice does not have primitive methods to perform front left leg up and front left leg down. It is therefore required that the code for this movement be designed. Elegant design requires that methods are kept from being too large. To maintain a small size for the methods, additional methods are added to do the small tasks. The following is done A loop is implemented at the point where the mouse takes a step ahead of the mouse. This loop ensures that whenever the mouse takes a step the cat takes another step of the same magnitude so that the mouse is always one step ahead of the cat. The next step is transforming the storyboard into program code. The first action of the storyboard is the mouse turns to see the cat. The first method is therefore turn to face. We use the turn to face to make the mouse turn to look in the direction of the cat. The next step is the cat taking one step away from the cat. We use the move away method. Alice contains control statements that are vital in controlling movements. In the cat chase program the cat moves away from the cat while the cat moves towards the mouse. The control statement Do in order is used to tell Alice to first make the cat look at the mouse and the mouse move away from the cat. Other actions must be done together. When the front right leg is up for example, the front left leg must be held down. To achieve this functionality Alice is told to Do this actions together through the DO together control statement. To implement this program into Alice a scene must first be created. The initial scene is a room (Farooq, 2012). The intention of the cat is to catch the mouse. It should follow it while the mouse should always be one step ahead of the cat. We select the room scene and then a cat and a mouse. The next stage is in the program code editor. The code that makes the program is written. In Alice the program code editor is at the bottom right of the main window. The instructions are edited in the area
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.