Cody

Problem 2538. Find the Next Legal Move in Reversi

Solution 528181

Submitted on 13 Nov 2014 by rifat
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 = [ 0 0 0 0 0 1 2 0 0 2 1 0 0 0 0 0 ]; side = 1; moves = [3 8 9 14]; assert(isequal(reversi_moves(board,side),moves))

2   Pass
%% board = [ 1 2 2 1 ]; side = 1; moves = []; assert(isequal(reversi_moves(board,side),moves))

3   Pass
%% board = [ 0 0 0 0 0 1 1 1 0 2 1 0 0 0 0 0 ]; side = 2; moves = [5 13 15]; assert(isequal(reversi_moves(board,side),moves))

[Warning: This concatenation operation includes an empty array with an incorrect number of rows. Concatenation including empty arrays will require all arrays to have the same number of rows in a future release.] [> In reversi_moves at 34 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!