home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-03 | 1.2 KB | 43 lines |
- package borland.samples.apps.chess.client.board;
-
- public class MoveTuple
- {
- public int newpieceValue;
- public int pieceValue;
- public int pieceColor;
- public int fromRank;
- public int fromFile;
- public int toRank;
- public int toFile;
-
- public MoveTuple() {
- newpieceValue = 0;
- pieceValue = 0;
- pieceColor = 0;
- fromRank = 0;
- fromFile = 0;
- toRank = 0;
- toFile = 0;
- }
-
- public MoveTuple(String x) {
- try {
- newpieceValue = Integer.parseInt(x.substring(6));
- pieceValue = Integer.parseInt(x.substring(0,1));
- pieceColor = Integer.parseInt(x.substring(1,2));
- fromRank = Integer.parseInt(x.substring(2,3));
- fromFile = Integer.parseInt(x.substring(3,4));
- toRank = Integer.parseInt(x.substring(4,5));
- toFile = Integer.parseInt(x.substring(5,6));
- }
- catch (Exception e) {
- System.out.println("Failed to parse tokenmsg " + e);
- }
- }
-
- public String toString() {
- //override this java.lang.Object method
- return String.valueOf(pieceValue) + pieceColor + fromRank + fromFile + toRank + toFile + newpieceValue;
- }
- }
-