Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: MATLAB Reversi Coding

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Thanked 0 Times in 0 Posts

    Default MATLAB Reversi Coding

    Hey, now I know what you're thinking, "This is a java forum, why are you posting here about MATLAB you crazed lunatic?"
    Well, I need help with an assignment, and MATLAB is based off of java, so I figured that I might be able to get some help.

    If you know any MATLAB, I would be especially thankful for your help.


    I have been given an assignment in which I need to remake the game Reversi/Othello in MatLAB using an 8x8 matrix where black is 1 and white is -1, and have a functional GUI.

    I have been able to do the GUI etc, by myself, but when I reach the point where I need to allow for only valid moves, I become a little stuck.

    I was curious if any of you would know of a way in which that could be done, because I've hit a road block. Essentially I need to scan all 8 directions of the matrix from the centre point, and find a valid combination of player_number*-1, in a row which end in a player_number (where player_number is the current players turn), but I am not sure how to accomplish this.

    Again, thanks for your time.

  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    My Mood
    Thanked 263 Times in 232 Posts

    Default 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

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Thanked 619 Times in 561 Posts
    Blog Entries

    Default Re: MATLAB Reversi Coding

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

Similar Threads

  1. Replies: 2
    Last Post: February 19th, 2012, 07:36 AM
  2. Need Reversi Please It's urgent
    By Mr.Y in forum Java Theory & Questions
    Replies: 1
    Last Post: December 29th, 2011, 06:28 PM
  3. Help on some work i got ! Reversi game
    By benni7 in forum Algorithms & Recursion
    Replies: 9
    Last Post: September 22nd, 2011, 11:38 AM
  4. [SOLVED] UnsatisfiedLinkError from Matlab code
    By RandalF in forum Java Native Interface
    Replies: 2
    Last Post: August 18th, 2011, 09:42 AM