Question

2 Super Mario Run A Mario World M consists of a k xk grid. Each field in the grid is either empty or brick. Two empty fields

IIDID goal LLLLLL start 0--00--0 0--0-- LULULULLLLLLLL TUTTTTTTTTTT 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 (a) (b) Figure 1: An 8 X 8

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm:

  1. Assuming a k*k matrix in the form of 0's and 1's, where 0 denote empty space and 1 denotes brick.
  2. Now we start from start point given. We will be traversing through Breadth First Search algorithm.
  3. For each coordinate from where we are passing on we will be applying each travelling option (forward, jump, fall) one by one.
  4. For each option we will be checking if it satisfies the given rules and takes Mario to a valid position. If a valid position is found we will be adding its coordinates to a queue(storing pair as x coordinates and y coordinates).
  5. Once all options for that particular coordinates are dealt with we will be poping stored coordinates from queue and then applying the same procedure to it.
  6. There may be a situation when we haven't reached our destination but our queue is empty. This simply means that there is no valid path after that. So,no path between start and destination point.
  7. If we are able to reach destination coordinates we will be printing "Path found".

Time complexity: O(k^2)

Add a comment
Know the answer?
Add Answer to:
2 Super Mario Run A Mario World M consists of a k xk grid. Each field...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2 Super Mario Run A Mario World M consists of a k xk grid. Each field...

    2 Super Mario Run A Mario World M consists of a k xk grid. Each field in the grid is either empty or brick. Two empty fields are marked as start and goal (see Fig. 2(a)). The goal of the game is to move the player, called Mario, from the start field to the goal field. When Mario is in field (x,y) he has the following options: Forward Mario moves to the field (x + 1,y). This move is possible...

  • 2 Super Mario Run A Mario world M consists of a k × k grid. Each field in the grid is either empt...

    Big O run time of algorithm 2 Super Mario Run A Mario world M consists of a k × k grid. Each field in the grid is either empty or brick. Two empty fields are marked as start and goal (see Fig. 2(a)). The goal of the game is to move the player, called Mario, from the start field to the goal field. When Mario is in field (x, y) he has the following options Forward Mario moves to the...

  • Big O run time of algorithm

    Figure 1: An 8 x & Mario world and corresponding Mario graph. 2 Super Mario Run A Mario world M consists of a k xk gid. Each field in the grid is either empy or brick. Two empty fields are marked as start and goal (see Fig. 21a). The goal ot the game s to move the playe, called Mario, irom the start field to the goal field. When Mario is in field (x,y) he has the following options: Forward...

  • 2. Super Mario must travel through a landscape made up of n spaces each filled with a mushroom, a spike or nothing. He...

    2. Super Mario must travel through a landscape made up of n spaces each filled with a mushroom, a spike or nothing. He wishes to reach the princess who is on space n. Super Mario can choose to advance 1 step or jump J steps. To start, J- 2, if he lands on a space that has a mushroom then J increases by You are given an array of the landscape L1,.., n] such that L] N if there is...

  • I need help with my programming assignment. The language used should be java and the algorithm...

    I need help with my programming assignment. The language used should be java and the algorithm should use search trees so that you play against the computer and he chooses the best move. The tree should have all possibilities on the leaves and you could use recursion to so that it populates itself. The game can be a 3*3 board (no need the make it n*n). Please put comments so that I can understand it. Thanks The game of ‘Walls’...

  • This lab will use 2D arrays, recursive algorithms, and logical thinking. The following grid of hashes(#)...

    This lab will use 2D arrays, recursive algorithms, and logical thinking. The following grid of hashes(#) and dots(.) is a 2D array representation of a maze # # # # # # # # # # # # # . . . # . . . . . . # . . # . # . # # # # . # # # # . # . . . . # . # # . . . . #...

  • The Problem A robot is asked to navigate a maze. It is placed at a certain...

    The Problem A robot is asked to navigate a maze. It is placed at a certain position (the starting position) in the maze and is asked to try to reach another position (the goal position). Positions in the maze will either be open or blocked with an obstacle. Positions are identified by (x,y) coordinates. At any given moment, the robot can only move 1 step in one of 4 directions. Valid moves are: ● Go North: (x,y) -> (x,y-1) ●...

  • I have to make a Reversi game in C++ where 2 algorithms play against eachother and I do not know ...

    I have to make a Reversi game in C++ where 2 algorithms play against eachother and I do not know how to even start it. In this project you are required to: 1. Implement Reversi for a board size of n x n where 4 ≤ n ≤ 16 and n is always even. 2. Implement two different algorithms that will play Reversi against each other e.g. an algorithm that randomly chooses a valid move may be one of your...

  • Question 2* Consider th following twelve diagrams A,... , L C: G: I: K: (a) Each diagram represents a simple graph of o...

    Question 2* Consider th following twelve diagrams A,... , L C: G: I: K: (a) Each diagram represents a simple graph of order 6 with exactly one circuit, but not all graphs are different. When X, Y represent the same graph we write XY. For example, A B. Partition the set {A, B,, Ly using the equivalence relation. (b) Any hydrocarbon molecule consists of joined-up carbon and hydrogen atoms, and can be represented by a connected graph in which each...

  • I NEED HELP IN MAZE PROBLEM. Re-write the following program using classes. The design is up...

    I NEED HELP IN MAZE PROBLEM. Re-write the following program using classes. The design is up to you, but at a minimum, you should have a Maze class with appropriate constructors and methods. You can add additional classes you may deem necessary. // This program fills in a maze with random positions and then runs the solver to solve it. // The moves are saved in two arrays, which store the X/Y coordinates we are moving to. // They are...

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