Pa 3

You might also like

You are on page 1of 3

Volatile Avatar

Bending is the ability to manipulate an element and is significant to many aspects of life in the
World of Avatar. There are five known bending arts; four of them bend a specific physical element
while the fifth bends the energy within the human body itself.[1] The four elemental bending arts
are based on the four classical elements, water, earth, fire, and air, and each is manipulated
through certain martial art styles which are reminiscent of the qualities of the element itself.

In this world (game), you are a volatile avatar, one that changes its element of mastery every day.
You initially have ‘H’ amount of health and ‘A’ amount of armor. At any instant you can be a
master of any of the four elements - fire, earth, water and air. Every day, you have to change your
element. For example if you are currently a firebending master, you can either be a waterbender,
an earthbender or an airbender the following day.

If you become an airbender, your health increases by 3 and your armor increases by 2.

If you become an earthbender, your health decreases by 5 and your armor increases by 5.

If you become a waterbender, your health increases by 10 and your armor decreases by 15.

If you become a firebender, your health decreases by 20 and your armor increases by 10.

If your health or armor becomes <=0, you will die instantly.

Find the maximum time you can survive.

1
IImplementation
Step 1. Write a program that accepts from user, values for health and armor. Your program will
display the number of days your avatar will survive and also the transitions.

Sample Dialogue:

Welcome to Volatile Avatar!


Please enter the initial health: 40
Please enter the initial armor: 34

Avatar’s Initial Health(40) & Armor(34).

Transitions: Firebender[20/44] -> Earthbender[15/49] ->


Waterbender[25/34] -> Firebender[5/44] -> Earthbender[0/49]
Avatar survived for 5 days.

Continue[Y/N]? Y

Welcome to Volatile Avatar!


Please enter the initial health: 36
Please enter the initial armor: 52

Avatar’s Initial Health(36) & Armor(52).

Transitions: Firebender[16/62] -> Waterbender[26/47] ->


Airbender[29/49] -> Waterbender[39/34] -> Firebender[19/44] ->
Earthbender[14/49] -> Firebender [-6/59]
Avatar survived for 7 days.

Step 2. Design an algorithm that will compute the maximum number of days you will survive. The
successive moves can also be pseudorandomly generated as long as it does not stay on the
same element the next day.

2
References
http://avatar.wikia.com/wiki/Bending_arts

You might also like