The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Question:
Purpose : classes, recursion, 2 dimensional Arrays, test plan, machine). (C++ use Input & output)
Universal Merriment Design (UMD) is building an electronic checkers game. They have hired you to write a small part of the game. Given the position on the board, you need to compute the maximum number of jumps of one specific king checker in one turn. Checkers is played on a board made up of 8 rows and 8 columns of alternating black and white squares. A king making a capturing move (a jump) leaps over one of the opponent's pieces, landing in a straight diagonal line on the other side and the opponents's piece is removed from the board. If the landing square is occupied, that jump is not legal. Only one piece may be captured in a single jump (and removed from the board); however, multiple jumps are allowed on a single turn
Input:
The input will consist of multiple test cases. The first line of input will be an integer n, indicating the number of test cases. Each test case will begin with 2 integers (m and n) on 1 line , separated by a space, specifying the number of your pieces and the number of your opponent's pieces. The next m lines will contain the row (0 < r < 7) and column (0 < c < 7) information for each of your pieces separated by a space. The last n lines will contain the row (0 < r < 7) and column (0 < c < 7) information for each of your opponents pieces separated by a space.
Output:
Each test case will result in 1 line of output with the phrase, "the number of jumps is x", where x is the number of jumps your first piece (a king) can make legally.
Sample Input (from the single and triple jumps illustrated above)
2
1 1
3 3
4 4
1 4
3 3
4 4
6 6
6 2
6 4
Sample Output
the number of jumps is 1
the number of jumps is 3
| Pre/Post conditions for functions |
| Functionality (minimum functions you should have) |
|
void addChecker(char who, int r, int c) // puts who at position (r,c) |
| void print() // prints the board |
| int main() |
| int numJumps(int row, int col)// returns the number of jumps a checker can make starting at (row, col) |
|
void reset( ); //clears the board Required Data Structure You can add more to the data structure but the minimum should be : Class Board { public: Board(); //creates an empty board void reset( ); //clears the board void addChecker(char who, int row, int col); int numJumps(int row, int col); // num of jumps possible from row, col void print() ; // print the board for debugging only private: char board[8][8]; }; |
CIS 200Program 1Fall 2013Lost SurvivorDue Sept 19th, Oct 1stPurpose : classes, recursion, 2 dimensional Arrays, test plan, machine).Universal Merriment Design (UMD) is building an electronic checkers game. They havehired you to write a small part of the game. Given the position on the board, you need tocompute the maximum number of jumps of one specific king checker in one turn.Checkers is played on a board made up of 8 rows and 8 columns of alternating black andwhite squares.A king making a capturing move (a jump) leaps over one of theopponent's pieces, landing in a straight diagonal line on the other side and the opponents’piece is removed from the board. If the landing square is occupied, that jump is not legal.Only one piece may be captured in a single jump (and removed from the board);however, multiple jumps are allowed on a single turn7654321001234567Checker boardbefore making a jumpafter making a jumpbefore a triple jumpafter a triple jumpInput:The input will consist of multiple test cases. The first line of input will be an integern,indicating the number of test cases. Each test case will begin with 2 integers (mandn) on1 line , separated by a space, specifying the number of your pieces and the number ofyour opponent’s pieces.The nextmlines will contain the row (0 <r< 7) and column (0<c< 7) information for each of your pieces separated by a space.The lastnlines willcontain the row (0 <r< 7) and column (0 <c< 7) information for each of youropponents pieces separated by a space.Output:Each test case will result in 1 line of output with the phrase,“the number of jumps is x”,where x isthe number of jumps your first piece (a king) can make legally.Sample Input (from the single and triple jumps illustrated above)21 1https://www.coursehero.com/file/9174358/CheckeredF13-2/This study resource wasshared via CourseHero.com
Attachments: