Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB code for the following; Write a function called generate_monster that: has no parameters will randomly generate a 1x2 array of numbers i.the first element

MATLAB code for the following;

Write a function called generate_monster that:

has no parameters

will randomly generate a 1x2 array of numbers

i.the first element will represent monster health

ii.the second element will represent monster damage

returns the 1x2 array that was created

Write the function that corresponds to algorithm 1

Write the function that corresponds to algorithm 2

When you get to step 3.c.i. of my instructions for algorithm 2, above, instead of following what you wrote in your algorithm, call the first function I asked you to create generate_monster and use that for your monster, instead.

Write a script that will simulate playing the game. The script should at least do the following things:

Should allow the user to replay the game as many times as they like (without having to rerun the script) while loop

Provide a default value for the player stats variable, but it should ALSO ask the user if theyd like to enter custom stats and use that instead for player health and damage

Ask the user how large they would like to make the maze and use that when they create the maze

Ask the user how many monsters they would like and use that value when they create the maze

Provide two ways to play the game, where the user gets to choose which style they want

i.One way should be an auto-play feature, where the game completely plays itself unless the user has to enter a number for a monster fight

ii.The second way should prompt the user EACH time a SINGLE move has been made, to ask whether or not they are ready to continue

TIPS: Here is an example of how you might simulate Playing the game in the script. This is not a complete example, it is only meant to illustrate how to use the functions that you have created.

Key:

create_maze first algorithm

random_move second algorithm

player = [5 5];

maze_size = 5;

monsters = 3;

maze = create_maze(maze_size, monsters);

[maze, player, game_over] = random_move(maze, player);

Keep repeating statement above until game_over variable indicates that game is over

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

62 Potential violent behavior and workplace violence conditions.

Answered: 1 week ago