finish the code : // TODO: // function locateQuadrant: // @param x: x coordinate of the…
- User
finish the code :
// TODO: // function locateQuadrant: // @param x: x coordinate of the empty cell // @param y: y coordinate of the empty cell // // If x < half width, y < half width, then return 1 // If x >= half width, y < half width, then return 2 // If x >= half width, y >= half width, then return 3 // If x < half width, y >= half width, then return 4 // // @return: int // The function returns after getting valid values for width, emptyXPos and emptyYPos int locateQuadrant(int width, int x, int y) {
// remove this line to start your work return LOCATEQUADRANT_NOT_IMPLEMENTED;}
// TODO: // [The most important function in this program] // The recursive function to fill up the character array: puzzleMap // You need to figure out the parameters of the fillPuzzleRecursive function by yourself void fillPuzzleRecursive(__ width, __ puzzleMap[][MAX_WIDTH], __ tx, __ ty, __ x, __ y, __ &nextChar) { // tx: top Left X coordinate // ty: top Left Y coordinate // x: x coordinate of the empty cell // y: y coordinate of the empty cell if (width == 2) { // The base case... }
// The general case // // Key idea: // Because qual must be equal to either 1, 2, 3 or 4 // As a result: // A L-shape MUST be created at the center of the bigger rectangle // Each Quad MUST have exactly 1 empty space return;}
- Assistant