Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
Z

zhijzan

@zhijzan
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can someone help me what I am doing wrong with this code?
    Z zhijzan

    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?

    Java question java game-dev help tutorial

  • How to swap address of pointers of 2 variables without using a temporary variable?
    Z zhijzan

    you can use swap() method in c/c++, is this you want?

    Managed C++/CLI question help tutorial career
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups