Cody

# Problem 3100. Rumis Scorer 2

Solution 2153929

Submitted on 8 Mar 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
clear board board(:,:,1) = ['rrbrbbr';'rbrbbrb';'bbrbbrb';'rbrrrbr';'bbrbbbr';'bbbrrbr']; board(:,:,2) = ['brbbbrb';'rrrbbbr';'bbrbrbr';'brbrbrr';'rbrrrbr';'brbbbbr']; %blue wins 22 to 20 assert(isequal(rumis_scorer2(board),'b'))

l = 'br' ans = 1

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test1 (line 5) assert(isequal(rumis_scorer2(board),'b'))

2   Fail
clear board board(:,:,1) = ['ppbrpbr';'rbrpbrb';'bbrbbrb';'rbrrppr';'bbrpbbr';'bbprrbr']; board(:,:,2) = ['brbpbrb';'rrpbbpr';'pprbrbr';'brprbrr';'rbrrpbr';'brppbbr']; %red wins 18 to 15 (b) to 9 (p) assert(isequal(rumis_scorer2(board),'r'))

l = 'bpr' ans = 3

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test2 (line 5) assert(isequal(rumis_scorer2(board),'r'))

3   Fail
clear board board(:,:,1) = ['brbrb';'rrrbb';'bggob';'ggoro';'bbrbr']; board(:,:,2) = ['bobrb';'roggr';'bogor';'bgoor';'rgrrr']; board(:,:,3) = ['bobrg';'rrbgr';'rooor';'brbrg';'rgrrr']; board(:,:,4) = ['borbg';'rrbbr';'bbrbr';'bboog';'rgrog']; board(:,:,5) = ['robbr';'bbror';'borbr';'rrobb';'boobg']; %blue wins 10 to 8 (r) to 6 (o) to 1 (g) assert(isequal(rumis_scorer2(board),'b'))

l = 'bgor' ans = 4

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test3 (line 8) assert(isequal(rumis_scorer2(board),'b'))

4   Fail
clear board board(:,:,1) = ['rrbrryr';'rbrrryb';'brrrbyb';'rbrbyyr';'rbrbryr';'brrrybr']; board(:,:,2) = ['brbybrb';'rbybbbr';'bbrbrbr';'brbryrr';'rbrrbbr';'brbbybr']; board(:,:,3) = ['byyybry';'ybbbyyr';'bbrbyyr';'brbyyrr';'rbyyybr';'brybybr']; %yellow wins 16 to 15 (b) to 11 (r) assert(isequal(rumis_scorer2(board),'y'))

l = 'bry' ans = 2

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test4 (line 6) assert(isequal(rumis_scorer2(board),'y'))

5   Fail
clear board board(:,:,1) = ['prbrby';'pprbby';'bggoyb';'gpyoro';'bppbyr']; board(:,:,2) = ['pobrby';'rogygr';'bogoyr';'bgyoor';'rgyyyr']; board(:,:,3) = ['ppbrgy';'rpybgr';'roooyr';'brybrg';'rgryrr']; board(:,:,4) = ['borbgy';'rpbybr';'bbrbry';'bbyoog';'rgrpog']; board(:,:,5) = ['robbry';'bprory';'borbry';'rroybb';'booybg']; board(:,:,6) = ['oobyry';'bpryor';'bopbyr';'rooppb';'boobyg']; %orange wins 8 to 7 (b) to 5 (r,y) to 4 (p) to 1 (g) assert(isequal(rumis_scorer2(board),'o'))

l = 'bgopry' ans = 5

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test5 (line 9) assert(isequal(rumis_scorer2(board),'o'))

6   Fail
ind = randi(5); switch ind case 1 clear board board(:,:,1) = ['rrbrbbr';'rbrbbrb';'bbrbbrb';'rbrrrbr';'bbrbbbr';'bbbrrbr']; board(:,:,2) = ['brbbbrb';'rrrbbbr';'bbrbrbr';'brbrbrr';'rbrrrbr';'brbbbbr']; assert(isequal(rumis_scorer2(board),'b')) case 2 clear board board(:,:,1) = ['ppbrpbr';'rbrpbrb';'bbrbbrb';'rbrrppr';'bbrpbbr';'bbprrbr']; board(:,:,2) = ['brbpbrb';'rrpbbpr';'pprbrbr';'brprbrr';'rbrrpbr';'brppbbr']; assert(isequal(rumis_scorer2(board),'r')) case 3 clear board board(:,:,1) = ['brbrb';'rrrbb';'bggob';'ggoro';'bbrbr']; board(:,:,2) = ['bobrb';'roggr';'bogor';'bgoor';'rgrrr']; board(:,:,3) = ['bobrg';'rrbgr';'rooor';'brbrg';'rgrrr']; board(:,:,4) = ['borbg';'rrbbr';'bbrbr';'bboog';'rgrog']; board(:,:,5) = ['robbr';'bbror';'borbr';'rrobb';'boobg']; assert(isequal(rumis_scorer2(board),'b')) case 4 clear board board(:,:,1) = ['rrbrryr';'rbrrryb';'brrrbyb';'rbrbyyr';'rbrbryr';'brrrybr']; board(:,:,2) = ['brbybrb';'rbybbbr';'bbrbrbr';'brbryrr';'rbrrbbr';'brbbybr']; board(:,:,3) = ['byyybry';'ybbbyyr';'bbrbyyr';'brbyyrr';'rbyyybr';'brybybr']; assert(isequal(rumis_scorer2(board),'y')) case 5 clear board board(:,:,1) = ['prbrby';'pprbby';'bggoyb';'gpyoro';'bppbyr']; board(:,:,2) = ['pobrby';'rogygr';'bogoyr';'bgyoor';'rgyyyr']; board(:,:,3) = ['ppbrgy';'rpybgr';'roooyr';'brybrg';'rgryrr']; board(:,:,4) = ['borbgy';'rpbybr';'bbrbry';'bbyoog';'rgrpog']; board(:,:,5) = ['robbry';'bprory';'borbry';'rroybb';'booybg']; board(:,:,6) = ['oobyry';'bpryor';'bopbyr';'rooppb';'boobyg']; assert(isequal(rumis_scorer2(board),'o')) end

l = 'bpr' ans = 3

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test6 (line 12) assert(isequal(rumis_scorer2(board),'r'))

7   Fail
ind = randi(5); switch ind case 1 clear board board(:,:,1) = ['rrbrbbr';'rbrbbrb';'bbrbbrb';'rbrrrbr';'bbrbbbr';'bbbrrbr']; board(:,:,2) = ['brbbbrb';'rrrbbbr';'bbrbrbr';'brbrbrr';'rbrrrbr';'brbbbbr']; assert(isequal(rumis_scorer2(board),'b')) case 2 clear board board(:,:,1) = ['ppbrpbr';'rbrpbrb';'bbrbbrb';'rbrrppr';'bbrpbbr';'bbprrbr']; board(:,:,2) = ['brbpbrb';'rrpbbpr';'pprbrbr';'brprbrr';'rbrrpbr';'brppbbr']; assert(isequal(rumis_scorer2(board),'r')) case 3 clear board board(:,:,1) = ['brbrb';'rrrbb';'bggob';'ggoro';'bbrbr']; board(:,:,2) = ['bobrb';'roggr';'bogor';'bgoor';'rgrrr']; board(:,:,3) = ['bobrg';'rrbgr';'rooor';'brbrg';'rgrrr']; board(:,:,4) = ['borbg';'rrbbr';'bbrbr';'bboog';'rgrog']; board(:,:,5) = ['robbr';'bbror';'borbr';'rrobb';'boobg']; assert(isequal(rumis_scorer2(board),'b')) case 4 clear board board(:,:,1) = ['rrbrryr';'rbrrryb';'brrrbyb';'rbrbyyr';'rbrbryr';'brrrybr']; board(:,:,2) = ['brbybrb';'rbybbbr';'bbrbrbr';'brbryrr';'rbrrbbr';'brbbybr']; board(:,:,3) = ['byyybry';'ybbbyyr';'bbrbyyr';'brbyyrr';'rbyyybr';'brybybr']; assert(isequal(rumis_scorer2(board),'y')) case 5 clear board board(:,:,1) = ['prbrby';'pprbby';'bggoyb';'gpyoro';'bppbyr']; board(:,:,2) = ['pobrby';'rogygr';'bogoyr';'bgyoor';'rgyyyr']; board(:,:,3) = ['ppbrgy';'rpybgr';'roooyr';'brybrg';'rgryrr']; board(:,:,4) = ['borbgy';'rpbybr';'bbrbry';'bbyoog';'rgrpog']; board(:,:,5) = ['robbry';'bprory';'borbry';'rroybb';'booybg']; board(:,:,6) = ['oobyry';'bpryor';'bopbyr';'rooppb';'boobyg']; assert(isequal(rumis_scorer2(board),'o')) end

l = 'br' ans = 1

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test7 (line 7) assert(isequal(rumis_scorer2(board),'b'))

8   Fail
ind = randi(5); switch ind case 1 clear board board(:,:,1) = ['rrbrbbr';'rbrbbrb';'bbrbbrb';'rbrrrbr';'bbrbbbr';'bbbrrbr']; board(:,:,2) = ['brbbbrb';'rrrbbbr';'bbrbrbr';'brbrbrr';'rbrrrbr';'brbbbbr']; assert(isequal(rumis_scorer2(board),'b')) case 2 clear board board(:,:,1) = ['ppbrpbr';'rbrpbrb';'bbrbbrb';'rbrrppr';'bbrpbbr';'bbprrbr']; board(:,:,2) = ['brbpbrb';'rrpbbpr';'pprbrbr';'brprbrr';'rbrrpbr';'brppbbr']; assert(isequal(rumis_scorer2(board),'r')) case 3 clear board board(:,:,1) = ['brbrb';'rrrbb';'bggob';'ggoro';'bbrbr']; board(:,:,2) = ['bobrb';'roggr';'bogor';'bgoor';'rgrrr']; board(:,:,3) = ['bobrg';'rrbgr';'rooor';'brbrg';'rgrrr']; board(:,:,4) = ['borbg';'rrbbr';'bbrbr';'bboog';'rgrog']; board(:,:,5) = ['robbr';'bbror';'borbr';'rrobb';'boobg']; assert(isequal(rumis_scorer2(board),'b')) case 4 clear board board(:,:,1) = ['rrbrryr';'rbrrryb';'brrrbyb';'rbrbyyr';'rbrbryr';'brrrybr']; board(:,:,2) = ['brbybrb';'rbybbbr';'bbrbrbr';'brbryrr';'rbrrbbr';'brbbybr']; board(:,:,3) = ['byyybry';'ybbbyyr';'bbrbyyr';'brbyyrr';'rbyyybr';'brybybr']; assert(isequal(rumis_scorer2(board),'y')) case 5 clear board board(:,:,1) = ['prbrby';'pprbby';'bggoyb';'gpyoro';'bppbyr']; board(:,:,2) = ['pobrby';'rogygr';'bogoyr';'bgyoor';'rgyyyr']; board(:,:,3) = ['ppbrgy';'rpybgr';'roooyr';'brybrg';'rgryrr']; board(:,:,4) = ['borbgy';'rpbybr';'bbrbry';'bbyoog';'rgrpog']; board(:,:,5) = ['robbry';'bprory';'borbry';'rroybb';'booybg']; board(:,:,6) = ['oobyry';'bpryor';'bopbyr';'rooppb';'boobyg']; assert(isequal(rumis_scorer2(board),'o')) end

l = 'bgor' ans = 4

Output argument "winner" (and maybe others) not assigned during call to "rumis_scorer2". Error in Test8 (line 20) assert(isequal(rumis_scorer2(board),'b'))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!