Click here to Skip to main content
15,887,822 members
Home / Discussions / Java
   

Java

 
GeneralRe: File Owner name Pin
karyampudi20-May-15 2:36
karyampudi20-May-15 2:36 
GeneralRe: File Owner name Pin
Richard MacCutchan20-May-15 3:04
mveRichard MacCutchan20-May-15 3:04 
GeneralRe: File Owner name Pin
karyampudi20-May-15 2:41
karyampudi20-May-15 2:41 
GeneralRe: File Owner name Pin
Richard MacCutchan20-May-15 3:10
mveRichard MacCutchan20-May-15 3:10 
QuestionCan someone help me what I am doing wrong with this code? Pin
Jainam Patel12-May-15 1:42
Jainam Patel12-May-15 1:42 
RantREPOST Pin
Richard Deeming12-May-15 3:31
mveRichard Deeming12-May-15 3:31 
AnswerRe: Can someone help me what I am doing wrong with this code? Pin
Afzaal Ahmad Zeeshan12-May-15 4:24
professionalAfzaal Ahmad Zeeshan12-May-15 4:24 
AnswerRe: Can someone help me what I am doing wrong with this code? Pin
zhijzan7-Jun-15 21:24
zhijzan7-Jun-15 21:24 
C#
public class tictok {

    private int OO = 1;
    private int XX = -1;
    public int arr[] = new int[10];

    public int getArrPos(int i,int j)
    {
        if (i==1) {
            return j == 4?1:j==15?2:j==26?3:-1;
        }
        if (i==5) {
            return j == 4?4:j==15?5:j==26?6:-1;
        }
        if (i==9) {
            return j == 4?7:j==15?8:j==26?9:-1;
        }
        return -1;
    }

    public void printMap() {
        for(int i=0;i<11;i++) {
            for(int j=0;j<32;j++) {
                if (i==3 || i==7) {
                    System.out.print("-");
                    continue;
                }
                if (j==10 || j==21) {
                    System.out.print("|");
                    continue;
                }
                if(getArrPos(i, j)!=-1){
                    if (arr[getArrPos(i, j)]== OO) {
                        System.out.print("O");
                    }else if (arr[getArrPos(i, j)]==XX) {
                        System.out.print("X");
                    }else  {
                        System.out.print(getArrPos(i, j));
                    }
                    continue;
                }
                System.out.print(" ");
            }
            System.out.println();
        }
    }

    public void play(int n,boolean isO)
    {
        if (n>9) {
            System.out.println("silly B");
            return;
        }
        arr[n]= isO?1:-1;
    }


    public static void main(String[] args) {
        tictok tt = new tictok();
        tt.play(8, true);
        tt.play(6, false);
        tt.printMap();

    }

}


is it useful?
QuestionI am getting this Exception: Pin
Rupsingh Mathwale7-May-15 1:32
Rupsingh Mathwale7-May-15 1:32 
AnswerRe: I am getting this Exception: Pin
Richard MacCutchan7-May-15 1:58
mveRichard MacCutchan7-May-15 1:58 
GeneralRe: I am getting this Exception: Pin
Rupsingh Mathwale7-May-15 18:56
Rupsingh Mathwale7-May-15 18:56 
QuestionRe: I am getting this Exception: Pin
Richard MacCutchan7-May-15 21:17
mveRichard MacCutchan7-May-15 21:17 
AnswerRe: I am getting this Exception: Pin
Rupsingh Mathwale7-May-15 22:10
Rupsingh Mathwale7-May-15 22:10 
AnswerRe: I am getting this Exception: Pin
Afzaal Ahmad Zeeshan12-May-15 4:22
professionalAfzaal Ahmad Zeeshan12-May-15 4:22 
GeneralRe: I am getting this Exception: Pin
Sascha Lefèvre12-May-15 10:41
professionalSascha Lefèvre12-May-15 10:41 
SuggestionRe: I am getting this Exception: Pin
Sascha Lefèvre12-May-15 10:43
professionalSascha Lefèvre12-May-15 10:43 
Questionmaps Pin
Member 116652324-May-15 23:18
Member 116652324-May-15 23:18 
AnswerRe: maps Pin
Richard MacCutchan4-May-15 23:52
mveRichard MacCutchan4-May-15 23:52 
QuestionKruskal Algorithm Pin
Member 116604013-May-15 1:46
Member 116604013-May-15 1:46 
AnswerRe: Kruskal Algorithm Pin
Sascha Lefèvre3-May-15 2:01
professionalSascha Lefèvre3-May-15 2:01 
QuestionI am getting a Compile Error Pin
Member 115176992-May-15 8:30
Member 115176992-May-15 8:30 
AnswerRe: I am getting a Compile Error Pin
Richard MacCutchan2-May-15 20:53
mveRichard MacCutchan2-May-15 20:53 
GeneralRe: I am getting a Compile Error Pin
Member 115176993-May-15 7:45
Member 115176993-May-15 7:45 
GeneralRe: I am getting a Compile Error Pin
Sascha Lefèvre3-May-15 14:33
professionalSascha Lefèvre3-May-15 14:33 
GeneralRe: I am getting a Compile Error Pin
Richard MacCutchan3-May-15 21:25
mveRichard MacCutchan3-May-15 21:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.