Using C#, solve the following problem by making use of a
2 dimensional array
USE C#
text in instructions file
West
East
South
South
South
South
South
East
East
West
East
East
West
West
South
South
West
East
South
South
West
North
North
North
North
North
Vusi has constructed a robot that operates on a two-dimensional grid of size 21 by 21 (a 7 by 7 grid is used here for illustration purposes only). From its initial position in the centre of the grid the robot can move based on the instructions North, East, South or West, so the robot's path is determined by a sequence of instructions stored in a text file (Instructions.txt). The robot cannot move off the grid so any instruction that would cause it to move outside the bounds of the grid is simply ignored (although that instruction counts as an additional visit the robot's current cell). (0,0) (6,0) North West East South
West East South (0,6) (6,6) Make use of a two dimensional array to determine all the cells on the grid that is visited by Vusi's robot after processing all the instructions in the Instructions.txt file. Keep track of how many times each cell is visited. Display a diagram which highlights the cells that were visited. For example, if the sequence of instructions in the file were East, East, East, East, East, South, South West, South West, South, then the diagram should look something like this: +++++++ +++++++ +++++ +++ *** +++++++ +++++** ++++*++
Using C#, solve the following problem by making use of a 2 dimensional array USE C# text in instructions file West East
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Using C#, solve the following problem by making use of a 2 dimensional array USE C# text in instructions file West East
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!