Question

please write the matlab function that corresponds with this algorithm

Create maze algorithm 1) Function create maze( maze size: whole number, monsters: whole number) returns maze: [1..N][1.N] of trings 2) maze-maze-size][maze-size] array of strings, filled with O 3) mazerandom # between 1 and maze size [random # between 1 and maze-size-P 4) tempx random whole number between 1 and maze size 5) tempy random whole number between 1 and maze_size 6) while mazeltempx] [tempy]=P a. tempx random whole number between 1 and maze_size b. end while loop mazeltempx] [tempy]=E for i from 1 to monsters tempy random whole number between 1 and maze_size 7) 8) 9) while mazeltempx] [tempy]--P or mazeltempx] [tempy] maze[tempx][tempyj a. E or tempx random whole number between 1 and maze_size ii. tempy random whole number between 1 and maze_size 10) mazeltempx] [tempylM 11) end for loop 12) return maze

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
please write the matlab function that corresponds with this algorithm Create maze algorithm 1) Function create...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Write the MatLab code for the following algorithm: reate maze algorithm 1) Function create mazel maze...

    Write the MatLab code for the following algorithm: reate maze algorithm 1) Function create mazel maze size: whole number, monsters: whole number) returns maze: [1.NI][1.N] of Strings 2) maze = [mazesizelimaze size] array of strings, filled with "0" 3) maze(random # 6etween 1 and mazesize] [random # between 1 and maze-size] 4) tempx - random whole number between 1 and maze size 5) tempy random whole number between 1 and maze size 6) while mazeltempx][tempd="P" "P" temps.# random whole number...

  • C++ Program Int Main First Please Write one program that does the following: 1.       1.   Ask the...

    C++ Program Int Main First Please Write one program that does the following: 1.       1.   Ask the user for ten (10) grades, and store the data in an array.  Compute the average of all the grades.  Print the original ten grades and the average. a.       Declare an integer array with the name of “grades” of size 10 in the main function. b.      Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array.                                                                i.      The function will receive...

  • 1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector...

    1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...

  • write a Matlab program ( solve the three questions). please use array and create your own...

    write a Matlab program ( solve the three questions). please use array and create your own function to check primality Question 1 : [10 points) Write a MATLAB program that will store all the first 1000 prime numbers in an array variable named arr_of_primes. Please note that a prime number is a positive integer that is bigger than or equal to 2 which is divisible only by 1 and itself. Examples of the first 8 primes are: 2, 3, 5,...

  • Please answer question on MATLAB showing work and the script. Thank you. Create a function M-ile...

    Please answer question on MATLAB showing work and the script. Thank you. Create a function M-ile that will implement a for loop to perform the tollowing tasks for a random input array, tt x. Count how many elements are greater than an arbitrary integer and display these values as well as the count using fprintf. loop to perform the following tasks Create a function M-ile that will implement a for l for a random input array, x. Calculate the arithmentic...

  • Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized...

    Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized with the following strings: “Einstein”, “Newton”, “Copernicus”, and “Kepler”. 2. Assume names in an Integer array with 20 elements. Write a pseudocode algorithm a For Loop that displays each element of the array. 3. Assume the arrays numberArray1 and numberArray2 each have 100 elements. Write a pseudocode algorithm that copies the values in numberArray1 to numberArray2 . 4. Write a pseudocode algorithm for a...

  • Write a function shuffle that takes an array of 20 integers and then shuffles the integers...

    Write a function shuffle that takes an array of 20 integers and then shuffles the integers using the following algorithm. For each element X of the array, generate a random number N between 0 and 19, inclusive. swap X with the element that corresponds to N.

  • 6. Consider the following algorithm, where P is an array containing random numbers. The function swap(v1,v2)...

    6. Consider the following algorithm, where P is an array containing random numbers. The function swap(v1,v2) will swap the values stored in the variables v1 and v2. Note that % is the modulus operation, and will return the integer remainder r of a/b, i.e., r-a%b Require: Array P with n > 0 values 1: i-1, j-n-l 2: while i<=j do for a=i to j by i do 4: 5: 6: 7: if Pla>Pat 11 and Pla]%2--0 then swap(Plal, Pla+1l) end...

  • Special Problem: Automated Factorial Create a MATLAB function called xfact that uses a loop to calculate...

    Special Problem: Automated Factorial Create a MATLAB function called xfact that uses a loop to calculate the factorial of an integer. Your function should take a single integer input. Your function should compute the factorials of every integer from 1 to the integer provided by the input. Test your function by prompting the user to enter an integer N and, using a loop create an array named X of length N that contains the factorials of the numbers 1 to...

  • Be sure to include the number of total swaps in each sort. Create a total_Time variable...

    Be sure to include the number of total swaps in each sort. Create a total_Time variable is the total time it takes all 1000 iterations to run. DO NOT INCLUE THE TIME IT TAKES TO GENERATE A UNIQUE RANDOM ARRAY EACH LOOP. In java, Write a computer program that prompts the user for one number, n for the number of items in the array to sort and create and sort 1000 different arrays of this size,  timing the run to get...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT