Cody

# Problem 42619. Flip the right coin to survive!

Solution 771344

Submitted on 4 Nov 2015 by Alfonso Nieto-Castanon
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
%% board = [ 1 1 0 1 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1]; warden_key = [8 8]; flip_correct = [5 5]; assert(isequal(flip_survive(board,warden_key),flip_correct))

8 8 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

2   Pass
%% board = [ 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1]; warden_key = [4 8]; flip_correct = [6 7]; assert(isequal(flip_survive(board,warden_key),flip_correct))

4 8 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

3   Pass
%% board = [ 1 1 1 0 1 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1]; warden_key = [8 7]; flip_correct = [2 7]; assert(isequal(flip_survive(board,warden_key),flip_correct))

8 7 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

4   Pass
%% board = [ 0 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 0]; warden_key = [6 6]; flip_correct = [4 2]; assert(isequal(flip_survive(board,warden_key),flip_correct))

6 6 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

5   Pass
%% board = [ 0 0 1 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0]; warden_key = [5 1]; flip_correct = [5 3]; assert(isequal(flip_survive(board,warden_key),flip_correct))

5 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]