Question
Week 6 Assignment - Pseudocode Translation Exertise Please translate the following formula to pseudocode using appropriate control flow. f(x)=1831x1+2 Evaluate the following mathematical function by
Week 6 Assignment - Pseudocode Translation Exertise Please translate the following formula to pseudocode using appropriate control flow. f(x)=1831x1+2
Evaluate the following mathematical function by using your intuition of pseudocode. Remember to break down each part by steps. Given lists: x=[5,3,2,1]y=[2,2,3] And farmula: f(x)=j=13(i=14xi1)yj Find the value of f(x) given the above information.
Consider the design of a video game, Dungeons and Dragons style, Say a physical attack has a 90% chance to inflict damage. A fireball spell has a 70% chance of inflicting huge damage. A silence spell prevents the opponent from casting spells, but only works 35\% of the time. Well computers can't come up with random numbers. They use a deterministic algorithm to figure things out. The linear congruential generator is a common method to generate random numbers. Let's use the [somewhat awful) RANDU parameter as follows: xn+1=65539xnmod231
Let's say your character gets a sneak attack in and casts a silence spell, then unleashes their awn fireball spell, and then jumps in for the attack. We're gaing to use dur random number generator (RNG) ta determine if these actions are successful. We'll do this by fetching the first two digits of our number. Let's say an ability has a 60% chance of success. If your randam number value is 312688 , then your RNG would be 31 . Since 31<=60 the ability suceeeds. Hawever, if the ability has a 20% chance of success it would not succeed with an RNG of 31. First, write some simple pseudocode for the formula above, Then given x0=13325, find x1,x2,x3 and determine whether a silences speell, fireball, and attack are successful in that particular order. You will use the cutput value of the previous iteration as the input value for the next iteration!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started