Use the Alice Program

Use the Alice Program from the link below to complete and save the five projects .

https://alice.org/ (should be Alice 2.2 or newer)

Assignment 1

Binary Code Game

Build a world with three switches (Controls) and a lightbulb (Lights), as seen below. Set

the emissive color property of the lightbulb to black (turned-off).

In this game, the positions of the levers on the switches represent a binary code.

When a lever is up, it represents 1 (electric current in the switch is high) and when

down, 0 (electric current in the switch is low). In the above world, all three levers are

up, so the binary code is 111. The correct binary code is chosen at the beginning of the

game. (You can enter a given code, and then have a friend try to guess it, or you can use

the world-level random number function, as described in Tips & Techniques 6.) The

idea is to have the user try to guess the correct binary code that will light up the lightbulb

(its emissive color will be yellow). To guess the binary code, the user will click on

the levers to change their position. Each time the user clicks on a lever, it moves in the

opposite direction-up (if currently down) or down (if currently up). When all three

switches are in the correct position for the binary code, the bulb will turn on.

Each switch should respond to a mouse-click on the switch. If the handle is down,

flip it up. If the handle is up, flip it down. To track the current position of a handle, an

invisible circle can be placed on the switch and used as a point of reference. When the

handle is above the circle, turn it down. When the handle is below the circle, turn it up.

See Exercise 12 for more detail.

Your program must include a Boolean function that determines whether the

Boolean code is correct.

Hint: You can use the color of the circles (even though they are invisible) as a flag that

indicates the correct position of the lever.

 

Project 2

Drinking Parrot

A small toy popular with children is a drinking parrot. The parrot is positioned in front

of a container of water and its body given a push. Because of the counterbalance of

weights on either end of its body, the parrot repeatedly lowers its head into the water.

Create a simulation of the drinking parrot (Objects). Use an infinite Loop statement to

make the parrot drink.

Hint: We used the blender object (Kitchen gallery), pushed the base into the ground,

deleted the lid, and changed the color of the blender to blue to simulate a bucket of water.

Hint: Repeated turn and roll motions will eventually make the bucking bronco assume

very unrealistic positions. To avoid this result, carefully position a reference object at

the peak of the cone on which the bronco is suspended. Make it invisible and then modify

the motion statements to use asSeenBy the reference object.

 

Project 3

Why did the chicken cross the road?

A popular child's riddle is, "Why did the chicken cross the road?" Of course, there are

many answers. In this project, the chicken (Animals) has a real sweet-tooth and crosses

the road to eat the gumdrops (Kitchen/Food) along the way.

Write a game animation where the player guides the chicken across the road to get to

the gumdrops. Cars and other vehicles should move in both directions as the chicken tries

to cross to where the gumdrops are located. Use arrow keys to make the chicken jump left,

right, forward, and back. Use the space bar to have the chicken peck at the gumdrop. When

the chicken is close enough to the gumdrop and pecks, the gumdrop should disappear.

A recursive method is used to control the play of the game. If the chicken gets hit

by a vehicle, the game is over (squish!). The game continues as long as the chicken has

not managed to peck all the gumdrops and has not yet been squished by a vehicle. If the

chicken manages to cross the road and peck at all the gumdrops along the way, the

player wins the game. Signal the player's success by making 3D text "You Win" appear

or by playing some triumphant sound.

 

Project 4

 

Game: Got Me!

In this project, you will create a game in which the goal is to click on objects that are

moving across the screen. When the player clicks on an object, that object says, "Got

me!" The objects should alternately move from left to right and right to left on the

screen.

To create the world, add 12 different objects to the world and have them all facing

in the same direction. Be sure to choose 12 objects that have a center point at their base

(where they touch the ground). Then, add two axes (Shapes) objects to the scene. Position

one axis on the far left and the second axis on the far right of the scene. The "Forward"

axis of each axes object should be directly facing the other. The axes will act as a

starting point for the objects on each side. Two screen captures are shown below. The

picture on the left shows the full scene with the axes on the far left and right and the 12

objects clustered in between. The picture on the right shows the initial scene for the

game, where the camera is moved in to get a closer view of the 12 objects and the axes

are not in view of the camera.

To organize the twelve objects for playing the game, create four world-level lists.

The first list, named allObjects, should contain all 12 objects that will move across the

screen. The second list, named objectsOnTheLeftSide, should contain 6 of the 12

objects. The third list, named objectsOnTheRightSide, should contain the other 6 of the

12 objects (those not on the left side are on the right side). The fourth list, named objects-

ThatWereClicked, is initially empty.

To prepare the objects for moving across the screen one at a time, create a worldlevel

method named setUpGame. This method should set the point of view of each

object in the objectsOnTheLeftSide list to that of the axes object on the left of the scene.

And, the method should do the same for objectsOnTheRightSide, using the axes object

on the right of the scene.

To create the code for playing the game, create three methods:

(1) playGame loops through the size of the objectsOnTheLeftSide list and uses the

index of the loop to move each of the objects forward (across the screen), one at a

time. This loop should work to alternately move an object from the left side and then from the right side, until all objects have moved across the screen once. Use a

random value for the duration as each object moves across the screen.

(2) addObjectToList checks whether an object that the user has clicked is one of the 12

valid objects. If the object is a valid object, then it is added to the objects-

ThatWereClickedOn list and the object says "Got me!" To make this method work,

create a mouse-click event that listens for a mouse click and calls this method, sending

in the object that was clicked.

(3) showWhoWasClickedOn, which (after all objects have moved once across the

screen) provides an end-of-game report by moving all of the objects that were

clicked to the center of the screen. Each of them should move forward and say "Got

Me!"

 

Project 5

 

Game: Freestlylin' Frostee

This project is an extension of Project 1, from Chapter 6 "Help the Snowman Get

Home." If you did not complete Chapter 6. Project 1, please refer to that project's

instructions on creating the original world scene. For this project, modify the original

scene by removing the igloo and adding at least 20 more pine trees (Nature). Also add

12 ramp objects (Skate Park) positioned here and there between the trees. The object of this game is to challenge the player to use keyboard control keys to

steer Frostee over as many ramps as possible before the clock runs out, while avoiding

collisions with the trees. The player earns points by going over the ramps and landing

on the other side. The player loses points each time Frostee collides with a tree.

When the world starts, display game instructions using a billboard. Create a button

(located in front of the billboard) to allow the user to click on the button to start the

game. The rules of the game are:

  • Use the arrow keys to steer the snowman through the woods and over the ramps.
  • Each ramp jump earns 1 point; 6 or more points wins game.
  • Collision with a tree takes away 1 point.
  • Passing through a lightening bolt boosts Frostee's speed.
  • When time runs out, the game is over.

Create while key is pressed (BDE) events for each of the arrow keys to move the

snowboard (with the snowman along for the ride). Create methods to have the snowman's

body tilt at the beginning and return to upright at the end of each snowboard

right/left move actions.

Use 3D text objects to display the player's score and the number of seconds

remaining in the game. If the player scores 6 or more points before time runs out, display

3D text to say the player won the game. Otherwise, display 3D text to say the

player lost and to please try again. The camera should follow the snowman as he winds

down the slopes, and the player should be able to see the score and the timer while the game is being played. Create world-level lists to organize the pine trees, one list for each 12 trees. You

can then check whether the snowman has collided with a tree by using For all together

to determine whether the snowman is within 2 meters of any tree in each list. If so, then

the snowman should blush and say OUCH!!. Be sure to return the snowman's color to

normal and reduce the score by 1 point.

Similarly, create a list of the ramps. Then, create an event that continuously calls

a method to check the ramps while the world is running. The checkRamps method can

use a For all together loop to check whether the snowboard is near enough to a ramp to

ski over it. If so, call a method named jumpRamp that has the snowboard (with Frostee

on board) ski up, over, and then drop down to the other side of the ramp. Also, add 1

point to the score.

   Related Questions in Programming Languages

  • Q : Explain Recursion Recursion : Recursion

    Recursion: Recursion outcomes from a method being invoked whenever an existing call to the similar method has not yet returned. For example:     public static void countDown(int n){  

  • Q : What is an Unary operator What is an

    What is an Unary operator: It is an operator which takes a single operand. Java's unary operators are as -, +, !, !, ++ and --.

  • Q : Explain Package declaration Package

    Package declaration: It is a declaration employed to name a package. This should be the first item in the source file, preceding any import statements. For example,     pa

  • Q : Explain the relationship between XHTML

    Explain the relationship between XHTML and SGML.

  • Q : Main uses of Virtual memory Illustrate

    Illustrate the main uses of Virtual memory?

  • Q : What is Java What is Java: It is a

    What is Java: It is a portable high level programming language introduced by Sun Microsystems.

  • Q : What is an Instruction set Instruction

    Instruction set: The set of instructions which characterize a specific Central Processing Unit. The programs written in the instruction set of one type of CPU can’t usually be run on any other kind of CPU.

  • Q : Define the term Inheritance Inheritance

    Inheritance: It is a feature of object-oriented programming languages in which a sub-type inherits methods and variables from its super-type. The Inheritance is most generally employed as a synonym for class inheritance {class!inheritance}, however in

  • Q : What is message queue Describe the

    Describe the message queue?

  • Q : Introduction to Programming for

    The purpose of this assignment is to get you started with C++ programming. You'll develop simple programs (with input and output) to solve simple mathematical and engineering problems. 1. Write a program to compute the area A of an

©TutorsGlobe All rights reserved 2022-2023.