Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLS FEEL THE ANSWERS Using C++ according to the questions. Q1 ) add code to the function named worldIsValid . This function takes a World,

PLS FEEL THE ANSWERS Using C++ according to the questions.

Q1) add code to the function named worldIsValid . This function takes a World, a row, and a column as parameters. The row and column represent a location, and the function should return a bool indicating whether that location is a valid world location. Valid world locations have a non-negative row value strictly less that ROW_COUNT and a non-negative column value strictly less than COLUMN_COUNT.

ANS:-

const int ROW_COUNT = 6;

const int COLUMN_COUNT = 9;

bool worldIsValid(const World world, int row, int column)

{

return false;

}

Q2) Add code to the functions named worldIsDeath and worldIsVictory. Each of these functions should take a World and a row and column, representing a location, as parameters and return a bool indicating whether that node is of the indicated type.

ANS:-

bool worldIsDeath(const World world, int row, int column)

{

return false;

}

bool worldIsVictory(const World world, int row, int column)

{

return false;

}

Q3) Add code to the four functions named worldCanGoNorth, worldCanGoSouth, worldCanGoEast, and worldCanGoWest. Each of these functions should take a World and a row and column, representing a location, as parameters and return a bool indicating whether the player can move in the indicated direction from that node. If the move would take the player out of the array, the function should return false. Also return false if the move would take the player to a node with a value of INACCESSIBLE. Otherwise, the player can move in that direction and the function should return true.

ANS:-

bool worldCanGoNorth(const World world, int row, int column)

{

return false;

}

bool worldCanGoSouth(const World world, int row, int column)

{

return false;

}

bool worldCanGoEast(const World world, int row, int column)

{

return false;

}

bool worldCanGoWest(const World world, int row, int column)

{

return false;

}

Q4) Add code to the function named worldFindValue. The function should takes a World, two references to ints and a NodeValue as parameters. The ints represent a row and a column, and the NodeValue is the value to search for. First, the function should set the row and column parameters to both be -1. Then it should search the World for a node with a value equal to the NodeValue parameter and, if it finds one, set the row and column parameters to that node's location. If there is more than one such value, you can use the location of any of them.

ANS:-

void worldFindValue(const World world, int& result_row, int& result_column, NodeValue value_to_find)

{

}

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

=+If the United States experiences a productivity slowdown,

Answered: 1 week ago