Question : chess java little help

hi at all,
I have to write a hit method in chess game how I can do it?

following requirement is there:
If it is in valid move than I can hit something, please only solutions with list collection.

I have coded the flowing code :
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
public interface Chessman {

    /*
     * Liefert ein einzelnes Zeichen, um die figur Textuelldarzustellen.
     *
    */
    public char toChar();
    /*
     *überprüft ob  zwei figuren gleiche Schachfiguren also der selbe Object sind
     * @return true dann wennes sich um dieselbe Figur / Object handelt
     *
    */

    public Position getStartPosition();
    public Position getPosition();
    public void draw (Position p);
    public void hit (Position p);

    public List <Position> getValidDraws();
    public List <Position> getValidHits();

}
----------------------------------------------------------------------------------------
public abstract class AbstractChessman implements Chessman {

    /*
     * Zeichen zur Darstellung der figur
     */
    private char description;
    private boolean isBlack;

    /**Konstruktor
     *
     * @param description figur als Zeichen
     * @param isBlack true genau dann wenn die Figur schwarz ist
     */
    public AbstractChessman(char description, boolean isBlack) {
        this.description = description;
        this.isBlack = isBlack;
    }

    /*
     * boolesche wert besagt ob es sich um eine schwarze figur
     * handelt bzw. um die figur auf weiss oder schwarz zu setzen
     * @param true
     * @param isBlack
     */
    public boolean isIsBlack() {
        return isBlack;
    }

    public void setIsBlack(boolean isBlack) {
        this.isBlack = isBlack;
    }

    /*
     * Im Falle weiss liefern wir den Inhalt der Variablen
     * Im falle Schwarz wandeln wir den übergebenen Buchstaben von Gross 
    nach Kleinschreibung
     * return @char einzelnes Zeichen 
     * @param toChar wenn schwarz A -> a
     */
    public char toChar() {
        return (char) (description + ((isBlack) ? ('a' - 'A') : 0));
    }

    public void hit(Position p) {
        
    }
}

--------------------------------------------------------------
public class ChessPosition implements  Position {
    final static public int BLANK = 0;
    final static public int HUMAN = 1;
    final static public int PROGRAM = -1;
    final static public int PAWN = 1;
    final static public int KNIGHT = 2;
    final static public int BISHOP = 3;
    final static public int ROOK = 4;
    final static public int QUEEN = 5;
    final static public int KING = 6;
    int [] board = new int[120];
    public String toString() {
        StringBuffer sb = new StringBuffer("[");
        for (int i=22; i<100; i++) {
            sb.append(""+board[i]+",");
        }
        sb.append("]");
        return sb.toString();
    }

}

Answer : chess java little help

DB2 does support IN.  However, it would appear from the error that your query is returning an empty string for the "INT(REPLACE(LOWES.T572_SHP_LCT_GRP.T162_CGY_SHT_NME,'DC','')".  (In fact, if you copied the query into your question exactly as it appears, then you are missing a closing ')'.  So that would mean you are trying to check a string against a list of integers, because the INT function is not completing.  Please confirm this.)  You should probably add:
  REPLACE(LOWES.T572_SHP_LCT_GRP.T162_CGY_SHT_NME,'DC','') <> '' AND
ahead of the "INT(...) IN (...)" part of the WHERE clause.  This would make sure no empty strings are not being used with IN.
Random Solutions  
 
programming4us programming4us