Results 1 to 15 of 15

Thread: Chess in Java

  1. #1
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Chess in Java

    Hello!
    I'm new on this forum, so welcome everybody!

    I'm a very beginner in Java and programming and i have a little problem. I want to make simple chess game, without graphic mode. I have written one class, i'll show you a code, and explain that is a problem:

    Main project
    Java Code:
    package javaapplication15;
    import java.util.*;
    import javax.swing.*;
    import java.io.*;
    /**
     *
     * @author Kuba
     */
    public class JavaApplication15 {
    
        public void Ruszaj(char a, char b, char c, char d) {
            ObjectOutputStream strumien_zapis = null;
            try
            {
                strumien_zapis = new ObjectOutputStream(new FileOutputStream("save.txt"));
                szachownica szachy = new szachownica(a,b,c,d);
                 strumien_zapis.writeObject(szachy);
                 strumien_zapis.close();
            }
            
            catch (Exception e)
                    {
                       e.printStackTrace(); 
                    }
        
    }
        public void Czytaj() {
            ObjectInputStream strumien_odczyt = null;
            
            try
            {
                strumien_odczyt = new ObjectInputStream(new FileInputStream("save.txt"));
                Object obj = null;
                while ((obj = strumien_odczyt.readObject()) != null) {
                    
                    //sprawdzamy, czy odczytany obiekt naleĹĽy do klasy
                    if (obj instanceof szachownica) {
                        
                        // jezeli tak, to wyswietlamy dane na ekran
                        System.out.println(((szachownica)obj).innyToString());
                    }
                    
                }
                strumien_odczyt.close();
                
            }
            
            catch (EOFException ex)
            {
                System.out.println("Koniec pliku.");
            }
            
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        
        public static void main(String[] args) {
            char [ ][ ] szachy = new char [9][9];
            int x=64;
            char pionek='|';
            char pionek_c='!';
            char wieza='W';
            char wieza_c='w';
            char skoczek='S';
            char skoczek_c='s';
            char goniec='G';
            char goniec_c='g';
            char krol='K';
            char krol_c='k';
            char krolowa='Q';
            char krolowa_c='q';
            char czarne='x';
            char biale='o';
            ObjectOutputStream strumien_zapis = null;
            try 
            {
            for (int j=0;j<szachy.length;j++)
            {
                for (int i=0;i<szachy.length;i++)
                {
                    if (j==8)
                    {
                        x++;
                        szachy [i][j]=(char)x;
                    }
                    
                    if (i==8)
                            {
                               
                        int numer=j+1;
                        if (numer==9)
                        {
                            break;
                        }
                        String numer2=Integer.toString(numer);
                        String numer3= Integer.toString((numer-9)*(-1));
                        
                        szachy [i][j]=numer3.charAt(0);
                        //kol=numer3.charAt(0);
                            }
                    if ((j==1||j==6)&&i!=8)
                    {
                        if (j==1)
                        {
                        szachy [i][j]=pionek;
                        }
                        else
                        {
                            szachy [i][j]=pionek_c;
                        }
                    }
                    
                    if ((j==0||j==7)&&(i==0||i==7))
                    {
                        if (j==0)
                        {
                        szachy [i][j]=wieza;
                        }
                        else
                        {
                          szachy [i][j]=wieza_c;  
                        }
                        
                    }
                    
                    if ((j==0||j==7)&&(i==1||i==6))
                    {
                        if (j==0)
                        {
                        szachy [i][j]=skoczek;
                        }
                        else
                        {
                           szachy [i][j]=skoczek_c; 
                        }
                    }
                    
                    if ((j==0||j==7)&&(i==2||i==5))
                    {
                        if (j==0)
                        {
                        szachy [i][j]=goniec;
                        }
                        else
                        {
                           szachy [i][j]=goniec_c; 
                        }
                    }
                    
                    if ((j==0||j==7)&&(i==3))
                    {
                        if (j==0)
                        {
                        szachy [i][j]=krol;
                        }
                        else
                        {
                           szachy [i][j]=krol_c; 
                        }
                    }
                    
                    if ((j==0||j==7)&&(i==4))
                    {
                         if (j==0)
                        {
                        szachy [i][j]=krolowa;
                        }
                         else
                        {
                           szachy [i][j]=krolowa_c; 
                        }
                    }
                    
                    if (j>1&&j<6&&(((i%2)==1)&&(j%2==1)||((i%2)==0)&&(j%2)==0)&&i!=8)
                    {
                        szachy [i][j]=biale;
                    }
                    
                    if (j>1&&j<6&&(((i%2)==1)&&(j%2==0)||((i%2)==0)&&(j%2)==1)&&i!=8)
                    {
                        szachy [i][j]=czarne;
                    }
                    
                    System.out.print(szachy [i][j]);
                    char znak=szachy[i][j];
                    szachownica obj = new szachownica(i,j,znak);
                    obj.ustawszachy(i,j,znak);
                    System.out.print(" ");
                    
                    
                }
                System.out.println();
                
            }
            //strumien_zapis.writeObject(obj);
           
            for (int f=0;f<100;f++)
            {
             String pozycja=JOptionPane.showInputDialog("Podaj iksową pozycji figury/pionka, którego chcesz ruszyć (literka):");
             char a=pozycja.charAt(0);
             pozycja=JOptionPane.showInputDialog("Podaj igrekową pozycji figury/pionka, którego chcesz ruszyć (literka):");
             char b=pozycja.charAt(0);
             pozycja=JOptionPane.showInputDialog("Podaj iksową pozycji na którą chcesz ruszyć (literka):");
             char c=pozycja.charAt(0);
             pozycja=JOptionPane.showInputDialog("Podaj igrekową pozycji na którą chcesz ruszyć (cyferka):");
             char d=pozycja.charAt(0);
             
             new JavaApplication15().Ruszaj(a,b,c,d);
             new JavaApplication15().Czytaj();
            }
            }
            
            catch (Exception e)
            {
                
            }
        }
    }
    Class szachownica
    Java Code:
    package javaapplication15;
    import java.io.Serializable;
    /**
     *
     * @author Kuba
     */
    public class szachownica implements Serializable {
        
        char [ ][ ] szachy = new char [9][9];
        final char pionek='|';
        final char pionek_c='!';
        final char wieza='W';
        final char wieza_c='w';
        final char skoczek='S';
        final char skoczek_c='s';
        final char goniec='G';
        final char goniec_c='g';
        final char krol='K';
        final char krol_c='k';
        final char krolowa='Q';
        final char krolowa_c='q';
        final char czarne='x';
        final char biale='o';
    
        
        public szachownica (char a, char b, char c, char d)
        {
            
            int index_y=b-1;
            int y=(int)a;
            int index_x=y-65;
            int g=(int)c;
            int index_x_ruch=g-65;
            int index_y_ruch=d-1;
            
            //ruchy figur i pionków
                    if (szachy[index_x_ruch][index_y_ruch]=='o'||szachy[index_x_ruch][index_y_ruch]=='x')
                    {
                        //ruch białym pionkiem
                        if (szachy[index_x][index_y]==pionek)
                        {
                            //ruch od wa pola z pozycji początkowej
                            if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=pionek;
                            }
                            if (index_x==index_x_ruch&&index_y_ruch==index_y+1)
                            {
                                if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }  
                                }
                                szachy[index_x][index_y_ruch]=pionek;
                            }
                        }
                        //ruch czarny pionkiem
                        if (szachy[index_x][index_y]==pionek_c)
                        {
                            //ruch o dwa pola z pozycji początkwoej
                            if (index_y==7&&index_y_ruch==index_y-2)
                            {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                }
                                szachy[index_x][index_y_ruch]=pionek;
                            }
                            
                           if (index_x==index_x_ruch&&index_y_ruch==index_y+1)
                            {
                                if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                }
                                szachy[index_x][index_y_ruch]=pionek_c;
                            }
                        } 
                           //ruch biała wieżą
                           if (szachy[index_x][index_y]==wieza)
                           
                           {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=wieza;
                               }
                               
                           }
                           //ruch czarna wieza
                           if (szachy[index_x][index_y]==wieza_c)
                           
                           {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=wieza;
                               }
                               
                           }
                           
                           //ruch bialym skoczkiem
                           if (szachy[index_x][index_y]==skoczek)
                           {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=skoczek;
                               }
                           }
                           
                           //ruch czarnym skoczkiem
                           if (szachy[index_x][index_y]==skoczek_c)
                           {
                               if ((((index_x==index_x_ruch-2)||(index_x==index_x_ruch+2))&&(index_y==index_y-1||index_y==index_y_ruch+1))||(((index_y==index_y_ruch+2)&&(index_y==index_y_ruch-2))&&(index_x==index_x-1||index_x==index_x_ruch+1)))
                               {
                                 if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=skoczek_c;
                               }
                           }
                           
                           //ruch bialym goncem
                           if (szachy[index_x][index_y]==goniec)
                           {
                               if ( (index_x==index_x_ruch+1)&&(index_y==index_y_ruch-1)||(index_x==index_x_ruch+1)&&(index_y==index_y_ruch+1)||(index_x==index_x_ruch-1)&&(index_y==index_y_ruch+1)||(index_x==index_x_ruch-1)&&(index_y==index_y_ruch-1)  )
                               {
                                  if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=goniec; 
                               }
                           }
                           
                           //ruch czarnym goncem
                           if (szachy[index_x][index_y]==goniec_c)
                           {
                               if ( (index_x==index_x_ruch+1)&&(index_y==index_y_ruch-1)||(index_x==index_x_ruch+1)&&(index_y==index_y_ruch+1)||(index_x==index_x_ruch-1)&&(index_y==index_y_ruch+1)||(index_x==index_x_ruch-1)&&(index_y==index_y_ruch-1)  )
                               {
                                 if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=goniec_c; 
                               }
                           }
                           
                           //ruchy bialego krola
                           if (szachy[index_x][index_y]==krol)
                           {
                              if ( ( (index_x==index_x_ruch+1)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1)||(index_y==index_y_ruch)) )||( (index_x==index_x_ruch-1)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1)||(index_y==index_y_ruch)) )||(index_y==index_y_ruch)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1))  )
                              {
                                if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=krol;  
                              }
                           }
                           
                           //ruch czarnego krola
                           if (szachy[index_x][index_y]==krol_c)
                           {
                              if ( ( (index_x==index_x_ruch+1)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1)||(index_y==index_y_ruch)) )||( (index_x==index_x_ruch-1)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1)||(index_y==index_y_ruch)) )||(index_y==index_y_ruch)&&((index_y==index_y_ruch-1)||(index_y==index_y_ruch+1))  )
                              {
                                if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=krol_c;  
                              }
                           }
                           
                           //ruch bialej krolowej
                           if (szachy[index_x][index_y]==krolowa)
                           {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=krolowa;  
                           }
                           
                           //ruch czarnej krolowej
                           if (szachy[index_x][index_y]==krolowa_c)
                           {
                               if (index_y==2&&index_y_ruch==index_y+2)
                            {
                                if ((index_x%2==0&&index_y%2==1)||(index_x%2==1&&index_y%2==0))
                                {
                                szachy[index_x][index_y]='o';
                                }
                                if ((index_x%2==1&&index_y%2==1)||(index_x%2==0&&index_y%2==0))
                                {
                                  szachy[index_x][index_y]='x';  
                                }
                                szachy[index_x][index_y_ruch]=krolowa_c;  
                           }
                        }
                        
                        
                           }  
                    }}}}}}}
        
        public szachownica (int w, int o, char p) {
            
                    szachy[w][o]=p;
        }
          
        public void ustawszachy(int w, int o, char p) 
        {
            szachy[w][o]=p;
        }
        
        public char [][] getSzachy() {
            return szachy;
        }
                
        
        public String innyToString()
        {
            String napis = "";
            for (int i=0;i<szachy.length;i++)
            {
                for (int j=0;j<szachy.length;j++)
                {
                    napis=napis+szachy[i][j];
                    napis=napis+" ";
                }
                napis=napis+"\n";
            }
            
            return napis;
        }   
                    
                
            
        }
    The problem is: when i'm trying to move any figure, i get:
    java.lang.ArrayIndexOutOfBoundsException: 50
    at javaapplication15.szachownica.<init>(szachownica.j ava:41)
    at javaapplication15.JavaApplication15.Ruszaj(JavaApp lication15.java:20)
    at javaapplication15.JavaApplication15.main(JavaAppli cation15.java:214)


    I have looked for any errors almost everywhere, i don't know what's wrong..

    Thanks for help!

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    What are you trying to access on that line? What index are you trying to access? How many indexes does it have?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    In line 41: It is the index (which is taken from user and given to constructor by parametrs) of pawn.
    index_x - index of axis X on the board of pawn we want to move
    index_y - index of axis Y on the board of pawn we want to move
    index_x_ruch - index of axis X on the board of place where we want to move the pawn
    index_y_ruch - index of axis Y on the board of place where we want to move the pawn

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    Right. But what are the actual values? You can find this out by stepping through your program with a debugger or by adding print statements.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    line 201 of main: There begins taking this values from a user.

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Chess in Java

    Your coding style makes it very hard to read and understand what the program is doing.
    The code will be easier to read and understand if you use spaces around operators:
    int index_x=y-65; // This is Too dense, hard to see what the statement is doing
    int index_x = y - 65;

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    Quote Originally Posted by altair69 View Post
    line 201 of main: There begins taking this values from a user.
    I'm not sure what this has to do with anything. What index are you trying to access when you get the error? How many indexes does the thing you're trying to access have?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    Ok, i will be using spaces, then : )

    int index_x=y-65; // This is Too dense, hard to see what the statement is doing
    int index_x = y - 65;
    Actually it is:
    index_x = y - 64 - 1; //user gives X position in interval A-H. So first, i translate this character to ASCII, and then subtract 64, because A is 65 in ASCII, so 65 - 64 = 1, then it its position 1 on the board in axis of X, and substract 1, because table begins from 0.


    @KevinWorkman:

    The error is when i give index_x, index_y, index_x_ruch, index_y_ruch
    Last edited by altair69; 01-24-2012 at 07:12 PM.

  9. #9
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    Quote Originally Posted by altair69 View Post
    @KevinWorkman:

    The error is when i give index_x, index_y, index_x_ruch, index_y_ruch
    Those are the variable names. What are their values when you see the error?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  10. #10
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    E.g. I want to move the knight from B1 to C3. Then index_x should be 1, index_y 0, index_x_ruch 2, index_y_ruch 2

  11. #11
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    Quote Originally Posted by altair69 View Post
    E.g. I want to move the knight from B1 to C3. Then index_x should be 1, index_y 0, index_x_ruch 2, index_y_ruch 2
    Right. And are those the exact values you're using when you get that Exception?

    I'm not asking you how the program theoretically works. I'm trying to talk you through the process of debugging your own program to figure out what's causing the crash.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #12
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    I believe yes. It doesn't matter what i put into the vairables, the exception is always the same.

  13. #13
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Chess in Java

    If you would print out the value of all the index variables you would see what the problem is.

  14. #14
    altair69 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Chess in Java

    Ok, i got it!
    In class szachownica, it should looks like that:
    Java Code:
    int index_y = b - 1;
            int y=(int)a;
            int index_x = y - 65;
            int g=(int)c;
            int index_x_ruch = g - 65;
            int index_y_ruch = Integer.parseInt(String.valueOf(d))-1;
    Now i have a problem with display a board from class. It's method InnytoString in the class, and method czytaj() in the main. It's not displaying anything, altough the file contains data.

  15. #15
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: Chess in Java

    Quote Originally Posted by altair69 View Post
    Now i have a problem with display a board from class. It's method InnytoString in the class, and method czytaj() in the main. It's not displaying anything, altough the file contains data.
    The debugging process is going to be the same. Add some print statements, or better yet, step through it with a debugger, to figure out what's going on.

    If that doesn't work, then you'll want to narrow the problem down to an SSCCE- that's a program that contains as few lines as possible while still exhibiting the behavior. You've posted waaaay too much code for anybody to wade through for you, so it's your job to get rid of all of that extra stuff that has nothing to do with your actual problem.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Java Chess piece Array
    By obious in forum New To Java
    Replies: 1
    Last Post: 05-04-2011, 01:20 PM
  2. Help with Chess GUI
    By Lord Voldemort in forum AWT / Swing
    Replies: 9
    Last Post: 01-24-2011, 05:38 PM
  3. a good java chess program
    By rico16135 in forum New To Java
    Replies: 10
    Last Post: 11-06-2010, 12:25 PM
  4. Java Game Expert Wanted to clone Chess.com
    By TOPSECRET in forum Jobs Offered
    Replies: 1
    Last Post: 04-28-2010, 03:20 AM
  5. I want play chess in Java
    By ganzorig in forum Advanced Java
    Replies: 6
    Last Post: 11-15-2009, 04:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •