Cody

Solution 688215

Submitted on 17 Jun 2015 by Sam
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   Pass
%% 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'))

2   Pass
%% 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'))

3   Pass
%% 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'))

4   Pass
%% 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'))

5   Pass
%% 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'))

6   Pass
%% anti-cheating case 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

7   Pass
%% anti-cheating case 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

8   Pass
%% anti-cheating case 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

Suggested Problems

More from this Author161