44.6k views
1 vote
Elana is programming a video game. She needs to simulate the power up that the player gets when they reach a certain level. The computer can run a program to return a random integer between 1 - 100. Elana wants the best power up to be rewarded 15% of the time. Explain how Elana can use the computer to simulate the player getting the best power up at least 2 out of 3 times

User Rjh
by
5.0k points

1 Answer

3 votes

Answer:

You have to define when the power should be pushed up using the 'For' statement and let an impulse be sent to the CPU to increase power by 15%

Explanation:

We use certain functions in writing computer programs.

For the 'For' statement ; we can define conditions. First Elana would define at what point does she want the player power to get the best power.

For example if she defines that when the player has played for 2hours return an integer 1 for instance.

This value returned will now send a pulse to the CPU to increase its power to 15%.

If the player plays for further 1hour she can define the count to be 10 and so send another pulse to the CPU to increase the processing power by additional 15%

User HaltingState
by
6.3k points