Cody

Problem 2565. Determine the Result of a Move in Reversi

Solution 563646

Submitted on 23 Jan 2015 by Alfonso Nieto-Castanon
• Size: 102
• This is the leading solution.
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
%% boardIn = ... [ 0 0 0 0 0 1 2 0 0 2 1 0 0 0 0 0 ]; side = 1; move = 14; boardOut = ... [ 0 0 0 0 0 1 1 1 0 2 1 0 0 0 0 0 ]; assert(isequal(boardOut,boardResult(boardIn,side,move)))

2   Pass
%% boardIn = ... [ 0 0 0 0 0 1 1 1 0 2 1 0 0 0 0 0 ]; side = 2; move = 5; boardOut = ... [ 0 2 0 0 0 2 1 1 0 2 1 0 0 0 0 0 ]; assert(isequal(boardOut,boardResult(boardIn,side,move)))

3   Pass
%% boardIn = ... [ 0 2 0 0 0 2 1 1 0 2 1 0 0 0 0 0 ]; side = 1; move = 4; boardOut = ... [ 0 2 0 0 0 2 1 1 0 1 1 0 1 0 0 0 ]; assert(isequal(boardOut,boardResult(boardIn,side,move)))

4   Pass
%% boardIn = ... [ 0 0 0 0 0 0 1 1 2 2 0 2 1 1 0 0 0 2 1 0 0 0 0 0 0 ]; side = 1; move = 9; boardOut = ... [ 0 0 0 0 0 0 1 1 2 2 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 ] assert(isequal(boardOut,boardResult(boardIn,side,move)))

boardOut = 0 0 0 0 0 0 1 1 2 2 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0