Re: MATLAB Reversi Coding

Welcome Aruhi

While it is okay to post questions about other languages, we do ask that you post in an appropriate location on the forum.

Anyway, the problem you face is not related to any specific language, you just need an algorithm to do what you want to do.

To lower the complexity, work on one of the 8 directions at a time.

Imagine a 2d grid, or draw it on paper. Say it is 10x10 for this example. x is positive to the right and let's assume y is positive going up.

Given point (3,4) what is the location of the element above (3,4)?

In general terms, it is at (x, y+1) from (3,4) or for this example it is at (3,5)

Work out the steps needed to find the elements on each side of the element in question. Do not forget the case where the given element is on an edge or corner, where there may be no element next door in one or more directions

Re: MATLAB Reversi Coding

Matlab is very different from Java, but like jps said the problem at hand isn't necessarily language specific.