Assignment 5B: Maze Game! 2D Arrays can be used to store and represent information about video game levels or boards. In this exercise, you will use this knowledge to create an interactive game where players attempt to move through a maze. You will start by creating a pre-defined 2D array with the following values: {"_","X","_","X","X"} "X","W"} "X","_"} "} ',"X"} {"_","X"," {"X","X" You will then set the player (represented by “O") at index 0, 0 of the array, the top-left corner of the maze. You will use a loop to repeatedly prompt the user to enter a direction ("Left", “Right", “Up", or “Down"). Based on these directions, you will try to move the player. • If the location is valid (represented by “_"), you will move the player there If the location is out of bounds (e.g. index 0, -1) or the command is invalid, you will inform the player and prompt them to enter another direction If the location is a wall (represented by “X"), you will tell the user they hit a wall and the game is over. If the player did not lose, you will print out the current state of the map and ask them for a new direction. You will keep doing this until they lose or they reach the end (represented by the "W").

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Assignment 5B: Maze Game! 2D Arrays can be used to store and represent information
about video game levels or boards. In this exercise, you will use this knowledge to
create an interactive game where players attempt to move through a maze. You will
start by creating a pre-defined 2D array with the following values:
:-, X","X"}
"X","W"}
"X","_"}
"}
'X","X"}
{"_"
" "y" " "
You will then set the player (represented by "O") at index 0, 0 of the array, the top-left
corner of the maze. You will use a loop to repeatedly prompt the user to enter a
direction ("Left", “Right", “Up", or “Down"). Based on these directions, you will try to
move the player.
If the location is valid (represented by “_"), you will move the player there
If the location is out of bounds (e.g. index 0, -1) or the command is invalid, you
will inform the player and prompt them to enter another direction
If the location is a wall (represented by “X"), you will tell the user they hit a wall
and the game is over.
If the player did not lose, you will print out the current state of the map and ask them for
a new direction. You will keep doing this until they lose or they reach the end
(represented by the "W").
Transcribed Image Text:Assignment 5B: Maze Game! 2D Arrays can be used to store and represent information about video game levels or boards. In this exercise, you will use this knowledge to create an interactive game where players attempt to move through a maze. You will start by creating a pre-defined 2D array with the following values: :-, X","X"} "X","W"} "X","_"} "} 'X","X"} {"_" " "y" " " You will then set the player (represented by "O") at index 0, 0 of the array, the top-left corner of the maze. You will use a loop to repeatedly prompt the user to enter a direction ("Left", “Right", “Up", or “Down"). Based on these directions, you will try to move the player. If the location is valid (represented by “_"), you will move the player there If the location is out of bounds (e.g. index 0, -1) or the command is invalid, you will inform the player and prompt them to enter another direction If the location is a wall (represented by “X"), you will tell the user they hit a wall and the game is over. If the player did not lose, you will print out the current state of the map and ask them for a new direction. You will keep doing this until they lose or they reach the end (represented by the "W").
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 15 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY