tags:

views:

232

answers:

5

i would to like need the baisc Othello as this :

0 : 0 0 0 0 0 0  
1 : 0 0 0 0 0 0 
2 : 0 0 1 2 0 0 
3 : 0 0 2 1 0 0 
4 : 0 0 0 0 0 0 
5 : 0 0 0 0 0 0
+2  A: 

There are probably zillions of open source Othello implementations in any language imaginable. Here's one implementation.

In fact, there is a Code Golf: Reversi question right here on Stack Overflow which provides quite a number of implementations in different languages including Java.

Greg Hewgill
first thanks for your helpbut i need the code
sunspaul
dear sir plz send the codez
simon
@sunspaul: Have you tried Googling? And if this is homework, are you sure you *need* code? Don't you think you *need* to *write it yourself*?
Stephan202
A: 

first thanks for your help but i need the code

sunspaul
Please remove this non-answer.
Stephan202
A: 

you can probably find some code at SourceForge

pablochan
A: 

Not sure what the "basic Othello" is, but to create that printout you can do something like:

public class Othello {

    private final int[][] board;

    public Othello(int size) {
        if (size <4 || (size % 2) != 0)
            throw new IllegalArgumentException("wrong size: " + size);

        board = new int[size][size];
        int half = size / 2;
        board[half][half] = 1;
        board[half-1][half-1] = 1;
        board[half][half-1] = 2;
        board[half-1][half] = 2;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            builder.append(" ").append(i).append(" :");
            for (int j = 0; j < 6; j++) {
                builder.append(" ").append(board[i][j]);
            }
            builder.append("\n");
        }
        return builder.toString();
    }
}

EDIT: How to show the board:

public static void main(String[] args) {
    Othello othello = new Othello(6);
    System.out.println(othello.toString());
}
Carlos Heuberger
it doesn't show the games table ..........but thanks spend time to help me
sunspaul
@sunspaul: thats is the reasson for the `toSTring` mehtod (as defined in `Object`). Edited to add an example.
Carlos Heuberger
A: 

i don't how to eat the chess of Othello

it is the table ;

enter code here

import java.util.*;

class chess {

public static void main(String args[]) {

int array[][] = new int[6][6];

array[3][3] = 2;

array[2][3] = 2;

array[3][2] = 2;

array[2][2] = 2;

array[4][1] = 1;

array[1][2] = 1;

array[1][3] = 2;

array[2][1] = 1;

array[3][4] = 1;

array[3][5] = 2;

array[4][3] = 1;

array[3][1] = 2;

array[2][4] = 2;

sunspaul