Обеспечение всемирной трансляции спортивных шахматных соревнований с применением разработанного в ходе проекта законченного программного продукта
this.D5 = new field('fieldD5', 'white', 'D', '5', null, board);
this.E5 = new field('fieldE5', 'black', 'E', '5', null, board);
this.F5 = new field('fieldF5', 'white', 'F', '5', null, board);
this.G5 = new field('fieldG5', 'black', 'G', '5', null, board);
this.H5 = new field('fieldH5', 'white', 'H', '5', null, board);
this.A6 = new field('fieldA6', 'white', 'A', '6', null, board);
this.B6 = new field('fieldB6', 'black', 'B', '6', null, board);
this.C6 = new field('fieldC6', 'white', 'C', '6', null, board);
this.D6 = new field('fieldD6', 'black', 'D', '6', null, board);
this.E6 = new field('fieldE6', 'white', 'E', '6', null, board);
this.F6 = new field('fieldF6', 'black', 'F', '6', null, board);
this.G6 = new field('fieldG6', 'white', 'G', '6', null, board);
this.H6 = new field('fieldH6', 'black', 'H', '6', null, board);
this.A7 = new field('fieldA7', 'black', 'A', '7', null, board);
this.B7 = new field('fieldB7', 'white', 'B', '7', null, board);
this.C7 = new field('fieldC7', 'black', 'C', '7', null, board);
this.D7 = new field('fieldD7', 'white', 'D', '7', null, board);
this.E7 = new field('fieldE7', 'black', 'E', '7', null, board);
this.F7 = new field('fieldF7', 'white', 'F', '7', null, board);
this.G7 = new field('fieldG7', 'black', 'G', '7', null, board);
this.H7 = new field('fieldH7', 'white', 'H', '7', null, board);
this.A8 = new field('fieldA8', 'white', 'A', '8', null, board);
this.B8 = new field('fieldB8', 'black', 'B', '8', null, board);
this.C8 = new field('fieldC8', 'white', 'C', '8', null, board);
this.D8 = new field('fieldD8', 'black', 'D', '8', null, board);
this.E8 = new field('fieldE8', 'white', 'E', '8', null, board);
this.F8 = new field('fieldF8', 'black', 'F', '8', null, board);
this.G8 = new field('fieldG8', 'white', 'G', '8', null, board);
this.H8 = new field('fieldH8', 'black', 'H', '8', null, board);
}
function board() {
this.moves = new move_collection(this);
this.figures = new figure_collection(this);
this.fields = new field_collection(this);
this.init = init;
this.last_move = null;
// Обновляет позицию
this.refresh_moves = function() {
// Ajax запрос к серверу
new Ajax.Request(moves_url, {
method: 'get',
onSuccess: function(transport) {
all_moves = transport.responseText;
trace('ajax: ' + all_moves);
}
});
trace('call => parse_moves(' + all_moves + ')')
function existsWhite(move) {
return getWhiteMove(move) != "******";
}
function existsBlack(move) {
return getBlackMove(move) != "******";
}
function getWhiteMove(move) {
return move.substring(0,6);
}
function getWhiteTime(move) {
return move.substring(13, 19);
}
function getBlackMove(move) {
return move.substring(6,12);
}
function getBlackTime(move) {
return move.substring(20, 26);
}
function getFrom(color, move) {
}
function getTo(color, move) {
}
function isShortCastling(color, move) {
}
function isLongCastling(color, move) {
}
moves_split = all_moves.split('|');
moves_strip = new Array();
for(i = 0; i < moves_split.length; i++) {
if(moves_split[i] != "") {
moves_strip.push(moves_split[i]);
trace('split: ' + moves_split[i]);
}
}
var number = moves_strip.length;
trace('number = ' + number);
var current_move = this.moves.get_current_move();
trace('current_move = ' + current_move);
var current_number = current_move != null ? current_move.number : 0;
trace('current_number = ' + current_number);
if(number == current_number) {
if((current_move.color == 'white') && existsBlack(moves_strip[number - 1])) {
var move_annotation = getBlackMove(moves_strip[number - 1]);
var move_time = getBlackTime(moves_strip[number - 1]);
var fieldFrom = getFrom('black', move_annotation);
var fieldTo = getTo('black', move_annotation);
var move = new move(number, 'black', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('black', move_annotation), isLongCastling('black', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
}
if(number > current_number){
for(iMove = current_move; iMove < number; iMove++) {
var move_annotation = getWhiteMove(moves_strip[number - 1]);
if(existsWhite(move_annotation)) {
var move_time = getWhiteTime(moves_strip[number - 1]);
var fieldFrom = getFrom('white', move_annotation);
var fieldTo = getTo('white', move_annotation);
var move = new move(iMove + 1, 'white', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('white', move_annotation), isLongCastling('white', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
move_annotation = getBlackMove(moves_strip[number - 1]);
if(existsBlack(move_annotation)) {
var move_time = getBlackTime(moves_strip[number - 1]);
var fieldFrom = getFrom('black', move_annotation);
var fieldTo = getTo('black', move_annotation);
var move = new move(iMove + 1, 'black', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('black', move_annotation), isLongCastling('black', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
}
}
}
this.refresh_figures = refresh_figures;
this.go_begin = go_begin;
this.go_end = go_end;
this.go_next = go_next;
this.go_preview = go_preview;
this.go_custom = go_custom;
this.repaint = function() {
}
// Парсит данные пришедшие от сервера
this.parse_moves = function() {
var moves = this.all_moves;
trace('call => parse_moves(' + moves + ')')
function existsWhite(move) {
return getWhiteMove(move) != "******";
}
function existsBlack(move) {
return getBlackMove(move) != "******";
}
function getWhiteMove(move) {
return move.substring(0,6);
}
function getWhiteTime(move) {
return move.substring(13, 19);
}
function getBlackMove(move) {
return move.substring(6,12);
}
function getBlackTime(move) {
return move.substring(20, 26);
}
function getFrom(color, move) {
}
function getTo(color, move) {
}
function isShortCastling(color, move) {
}
function isLongCastling(color, move) {
}
moves_split = moves.split('|');
moves_strip = new Array();
for(i = 0; i < moves_split.length; i++) {
if(moves_split[i] != null) {
moves_strip.push(moves_split[i]);
}
}
var number = moves_strip.length;
var current_move = this.moves.get_current_move;
var current_number = current_move != null ? current_move.number : 0;
if(number == current_number) {
if((current_move.color == 'white') && existsBlack(moves_strip[number - 1])) {
var move_annotation = getBlackMove(moves_strip[number - 1]);
var move_time = getBlackTime(moves_strip[number - 1]);
var fieldFrom = getFrom('black', move_annotation);
var fieldTo = getTo('black', move_annotation);
var move = new move(number, 'black', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('black', move_annotation), isLongCastling('black', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
}
if(number > current_number){
for(iMove = current_move; iMove < number; iMove++) {
var move_annotation = getWhiteMove(moves_strip[number - 1]);
if(existsWhite(move_annotation)) {
var move_time = getWhiteTime(moves_strip[number - 1]);
var fieldFrom = getFrom('white', move_annotation);
var fieldTo = getTo('white', move_annotation);
var move = new move(iMove + 1, 'white', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('white', move_annotation), isLongCastling('white', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
move_annotation = getBlackMove(moves_strip[number - 1]);
if(existsBlack(move_annotation)) {
var move_time = getBlackTime(moves_strip[number - 1]);
var fieldFrom = getFrom('black', move_annotation);
var fieldTo = getTo('black', move_annotation);
var move = new move(iMove + 1, 'black', fieldFrom, fieldTo, fieldFrom.figure, fieldTo.figure, isShortCastling('black', move_annotation), isLongCastling('black', move_annotation), current_move, null, this, move_time);
this.moves.add_move(move);
}
}
}
}
// Настройки
this.all_moves = "";
this.moves_delay = 3;
this.moves_url = '/main/game_moves/1';
this.figures_delay = 2;
}
// Инициализация доски
function init() {
trace('call => init()');
// Расставляем шахматы в начальную позицию
// белые пешки
this.figures.wpA.set_field(this.fields.A2);
this.figures.wpB.set_field(this.fields.B2);
this.figures.wpC.set_field(this.fields.C2);
this.figures.wpD.set_field(this.fields.D2);
this.figures.wpE.set_field(this.fields.E2);
this.figures.wpF.set_field(this.fields.F2);
this.figures.wpG.set_field(this.fields.G2);
this.figures.wpH.set_field(this.fields.H2);
// белые фигуры
this.figures.wrA.set_field(this.fields.A1);
this.figures.wrH.set_field(this.fields.H1);
this.figures.whB.set_field(this.fields.B1);
this.figures.whG.set_field(this.fields.G1);
this.figures.wbC.set_field(this.fields.C1);
this.figures.wbF.set_field(this.fields.F1);
this.figures.wq.set_field(this.fields.D1);
this.figures.wk.set_field(this.fields.E1);
// черные пешки
this.figures.bpA.set_field(this.fields.A7);
this.figures.bpB.set_field(this.fields.B7);
this.figures.bpC.set_field(this.fields.C7);
this.figures.bpD.set_field(this.fields.D7);
this.figures.bpE.set_field(this.fields.E7);
this.figures.bpF.set_field(this.fields.F7);
this.figures.bpG.set_field(this.fields.G7);
this.figures.bpH.set_field(this.fields.H7);
// черные фигуры
this.figures.brA.set_field(this.fields.A8);
this.figures.brH.set_field(this.fields.H8);
this.figures.bhB.set_field(this.fields.B8);
this.figures.bhG.set_field(this.fields.G8);
this.figures.bbC.set_field(this.fields.C8);
this.figures.bbF.set_field(this.fields.F8);
this.figures.bq.set_field(this.fields.D8);
this.figures.bk.set_field(this.fields.E8);
// Создаем Ajax опрашиватель сервера
new PeriodicalExecuter(this.refresh_moves, this.moves_delay);
new PeriodicalExecuter(this.refresh_figures, this.figures_delay);
}
// Перерисовка позиции (делает один ход)
function refresh_figures() {
//trace('call => refresh_figures');
if(this.exists_move) {
this.current_move = this.moves.get_current_move();
this.current_move.forward();
}
}
// Перейти к началу
function go_begin() {
}
// Перейти к концу
function go_end() {
}
// Следующий ход
function go_next() {
}
// Предыдущий ход
function go_preview() {
}
// Перейти к произвольному ходу
function go_custom(number, color) {
}
// сделать ход
function do_move(from_field, to_field) {
}
// Возвращает поле
function get_field(vertical, horizontal) {
}
// Установить фигуру на поле
function set_field(field_to_set) {
this.last_field = field_to_set;
field_to_set.figure = this;
field_to_set.repaint();
}
// Возвращает ход по номеру и цвету
function get_move(number, color) {
}
// Возвращает текуший ход
function get_current_move() {
return this.current_move;
}
// Возвращает true если есть ход который нужно совершить
function exists_move() {
}
function repaint() {
$(this.id).innerHTML = '';
if(this.figure != null) {
$(this.id).appendChild(this.figure.img);
}
}
function reload() {
this.img.src = images + this.color[0] + this.type[0] + '.gif';
//trace('reload figure [' + this.id + '].src = "' + this.img.src + '"');
}
// Ход вперед !! предыдущую фигуру удалить
function forward(){
if(this.to_field.figure != null) {
}
this.figure.do_move(this.from_field, this.to_field);
}
// Ход назад
function backward() {
this.figure.do_move(this.to_field, this.from_field);
this.alive_figure.set_field(this.to_field);
}
function trace(message) {
$("debug").innerHTML += message + '<br />';
}
window.onload=function() {
// Запуск
var main_board = new board();
main_board.init();
// setBeginingPosition();
// refreshGame();
// new PeriodicalExecuter(refreshGame, periodicalDelay);
// new PeriodicalExecuter(refreshBoard, 1);
}
Приложение Г
Листинг программы-регистратора шахматных партий
rdgtChess.java
---
public class rdgtChess implements Runnable
static boolean debug = false;
String comport = "COM1";
public static void main(String[] args) {
rdgtChess t;
if(args.length > 0)
t = new rdgtChess(args[0]);
else
t = new rdgtChess();
}
public rdgtChess() {
(new Thread(this)).start();
}
public rdgtChess(String comport) {
thisport = comport;
(new Thread(this)).start();
}
// Destructor
public void finalize()
{
rdgtMysql.disconnect();
}
// This is the main loop. It samples all boards and tries at regular intervals
// to find new boards and to mark non-answering boards as, well, non-answering.
Это головная часть. Она опрашивает все доски с регулярным интервалом времени,
чтобы найти новые доски и отметить неотвечающие доски как неотвечающие
public void run() {
rdgtController c = new rdgtController();
if (c.connect(comport) == false) return;
System.out.println(rdgtMysql.connect());
int i = 0;
while (true) {
if ((i==0) || (c.db.count_alive()==0)) {
while (c.find_all_boards()==0) {} c.dump_all_active_boards();
i = 15;
} else {
try {Thread.sleep(1000);} catch(Throwable t) {}}
c.poll_all_active_boards();
i--;
}
}
}
rdgtChessboard.java
---
class rdgtChessboard {
Integer address;
rdgtHistory history = new rdgtHistory(this);
rdgtSnapshot snapshot = new rdgtSnapshot(this);
rdgtFenhax myFenhax = new rdgtFenhax();
boolean alive;
boolean dumped;
boolean updated;
rdgtDatabase db;
rdgtChessBoardForm board = null;
public rdgtChessboard(Integer _address, rdgtDatabase _db) {
address = _address;
db = _db;
alive = true;
dumped = false;
updated = false;
update_html();
board = new rdgtChessBoardForm();
new Thread(new Runnable() {
public void run() {
board.setVisible(true);
}
}).start();
}
rdgtSnapshot get_snapshot() {
return snapshot;
}
int get_address() {
return address.intValue();
}
public void print_position() {
board.printPosition(snapshot.debugprint());
board.printClock(snapshot.debugprint_clock());
}
String print_figure(int figure) {
if(figure == rdgtProtocol.EMPTY) {
return " ";
} else if (figure == rdgtProtocol.WPAWN) {
return "P";
} else if(figure == rdgtProtocol.WROOK) {
return "R";
} else if(figure == rdgtProtocol.WKNIGHT) {
return "N";
} else if(figure == rdgtProtocol.WBISHOP) {
return "B";
} else if(figure == rdgtProtocol.WQUEEN) {
return "Q";
} else if(figure == rdgtProtocol.WKING) {
return "K";
} else if (figure == rdgtProtocol.BPAWN) {
return "p";
} else if(figure == rdgtProtocol.BROOK) {
return "r";
} else if(figure == rdgtProtocol.BKNIGHT) {
return "n";
} else if(figure == rdgtProtocol.BBISHOP) {
return "b";
} else if(figure == rdgtProtocol.BQUEEN) {
return "q";
} else if(figure == rdgtProtocol.BKING) {
return "k";
} else {
return " ";
}
}
void set_alive(boolean x) {
alive = x;
update_html();
}
void set_dumped(boolean x) {
dumped = x;
}
void set_updated(boolean x) {
updated = x;
history.append(snapshot);
}
boolean get_alive() {
return alive;
}
boolean get_dumped() {
return dumped;
}
boolean get_updated() {
return updated;
}
void set_clockdata(boolean running, boolean batteryLow, boolean frontViewLeftSideHigh, boolean blacksTurn, boolean whitesTurn, int secW, int secB) {
snapshot.set_clockdata(running, batteryLow, frontViewLeftSideHigh, blacksTurn, whitesTurn, secW, secB);
snapshot.debugprint_clock();
}
void update_html() {
rdgtMysql.update_snapshot(snapshot);
String fen = rdgtMysql.snapshot2fen(snapshot);
myFenhax.add(fen);
rdgtMysql.update_moves(rdgtFenhax.getMoves(true, false), rdgtFenhax.getMoves(true, true), address.intValue());
}
void set_emptyboard() {
snapshot.set_emptyboard();
history.append(snapshot);
}
void set_boarddump(int[] all64, int startpos) {
snapshot.set_boarddump(all64, startpos);
dumped = true;
history.append(snapshot);
}
void set_fieldupdate(int piece, int pos) {
snapshot.set_fieldupdate(piece, pos);
updated = true;
history.append(snapshot);
}
}
rdgtConfig.java
---
class rdgtConfig {
String getDbServer() { return server; }
String getDbUser() { return user; }
String getDbPass() { return pass; }
String getDbBase() { return dbase; }
boolean useDbServer() { return mysql; }
boolean usePgnWriter() { return pgn; }
String getPgnFileName() { return pgnfile; }
String server= "localhost";
String user= "root";
String pass= "zar1562";
String dbase= "rdgt_development";
boolean mysql = true;
boolean pgn = false;
String pgnfile = "default.pgn";
}
rdgtController.java
---
class rdgtController extends rdgtProtocol {
rdgtDatabase db;
rdgtInterpreter ipr;
rdgtReceiver rec;
rdgtSerialport ser;
rdgtSender snd;
public rdgtController() {
db = new rdgtDatabase();
ipr = new rdgtInterpreter(db);
rec = new rdgtReceiver(ipr);
ser = new rdgtSerialport(rec);
snd = new rdgtSender(ser);
}
boolean connect(String comport) {
if (ser.open(comport)==false) {
System.out.println("Could not open "+comport);
return false;
}
System.out.println("COM port opened: "+comport);
return true;
}
int find_all_boards() {
System.out.println("Scanning for boards...");
db.unalive_all();
int alive = 0;
while (true) {
try {Thread.sleep(300);} catch(Throwable t) {}
snd.send(DGT_BUS_PING, 0);
try {Thread.sleep(1100);} catch(Throwable t) {}
int alivenow = db.count_alive();
if (alivenow == alive) break;
alive = alivenow;
for (Enumeration e = db.get_boards() ; e.hasMoreElements() ;) {
rdgtChessboard b = (rdgtChessboard)(e.nextElement());
if (b.get_alive()==true) {
snd.send(DGT_BUS_IGNORE_NEXT_BUS_PING, b.get_address());
}
}
}
System.out.println("Scanning completed, found "+Integer.toString(alive)+" boards.n");
return alive;
}
void dump_all_active_boards() {
for (Enumeration e = db.get_boards() ; e.hasMoreElements() ;) {
rdgtChessboard b = (rdgtChessboard)(e.nextElement());
if (b.get_alive()==true) {
b.set_dumped(false);
for (int i=0; i<3; i++) { if (b.get_dumped()==true) break;
snd.send(DGT_BUS_SEND_BRD, b.get_address());
try {Thread.sleep(200);} catch(Throwable t) {}
}
if (b.get_dumped()==false) {
System.out.println("Board "+Integer.toString(b.get_address())+" does not reply to dump_board.");
b.set_alive(false);
}
}
}
}
void poll_all_active_boards() {
int TIMEOUT = 100;
for (Enumeration e = db.get_boards() ; e.hasMoreElements() ;) {
rdgtChessboard b = (rdgtChessboard)(e.nextElement());
if (b.get_alive()==true) {
snd.send(DGT_BUS_SEND_CLK, b.get_address());
try {Thread.sleep(TIMEOUT);} catch(Throwable t) {}
b.set_updated(false);
snd.send(DGT_BUS_SEND_CHANGES, b.get_address());
try {Thread.sleep(TIMEOUT);} catch(Throwable t) {}
for (int i=0; i<2; i=i+1) {
if (b.get_updated()==true) break;
snd.send(DGT_BUS_REPEAT_CHANGES, b.get_address());
try {Thread.sleep(TIMEOUT);} catch(Throwable t) {}}
if (b.get_updated()==false) {
System.out.println("Board "+Integer.toString(b.get_address())+" does not reply anymore.");
b.set_alive(false);
} else {
b.print_position();
}
}
}
}
}
rdgtDatabase.java
---
class rdgtDatabase {
Hashtable boards;
public rdgtDatabase() {
boards = new Hashtable();
}
rdgtChessboard get_board(int address) {
Integer _address = new Integer(address);
rdgtChessboard b = (rdgtChessboard)(boards.get(_address));
if (b==null) {
System.out.println("New board found: ID="+_address.toString());
b = new rdgtChessboard(_address, this);
boards.put(_address, b);
}
return b;
}
int get_boardcount() {
return boards.size();
}
Enumeration get_boards() {
return boards.elements();
}
void unalive_all() {
for (Enumeration e = boards.elements() ; e.hasMoreElements() ;) {
((rdgtChessboard)(e.nextElement())).set_alive(false);
}
}
int count_alive() {
int x = 0;
for (Enumeration e = boards.elements() ; e.hasMoreElements() ;) {
if (((rdgtChessboard)(e.nextElement())).get_alive()==true) x++;
}
return x;
}
}
rdgtFenboard.java
---
class rdgtFenboard {
int[] itsBoard;
String itsFen;
public rdgtFenboard(){
itsBoard = new int[64];
for(int i=0;i<64;i++)
itsBoard[i]='.';
itsFen="";
}
public rdgtFenboard(String fen){ setBoard(fen); }
public rdgtFenboard(int[] board) { setBoard(board); }
public boolean setBoard(String fen){
if(!validateFen(fen))
return false;
itsBoard=fen2board(fen);
itsFen=fen;
return true;
}
public int getPieceAt(int x, int y){
if(x<0 || x>7 || y<0 || y>7) return 0;
return itsBoard[y*8+x];
}
public boolean setBoard(int[] board){
if(board.length != 64)
return false;
itsBoard=board;
return true;
}
public void print(){
printBoard(itsBoard);
}
public int[] getBoard() { return itsBoard; }
public rdgtFenboard mask(rdgtFenboard b){
rdgtFenboard output;
output=new rdgtFenboard(mask(getBoard(),b.getBoard()));
return output;
}
public int diffCount(rdgtFenboard b){
rdgtFenboard m = mask(b);
int[] table=m.getBoard();
int output=0;
for(int i=0;i<64;i++){
if(table[i]!='.')
output++;
}
return output;
}
int[] fen2board(String aFen){
int[] board = new int[64];
int square=0;
int chr=0;
while(square<64){
char c = aFen.charAt(chr);
if(c=='r'||c=='R'||c=='n'||c=='N'||c=='b'||c=='B'||c=='q'||c=='Q'||c=='k'||c=='K'||c=='p'||c=='P'){
board[square]=c;
square++;
}
if(c>='1' && c<='8'){
for(int i=0;i<c-'1'+1;i++){
board[square]='.';
square++;
}
}
chr++;
}
return board;
}
String[] outputBoard(int[] board){
String s="";
String[] out = new String[8];
for(int chr=0;chr<64;chr++){
if(board[chr]<0)
s += "-" + (char)(Math.abs(board[chr]));
else if(board[chr]==0)
s += ", ";
else
s += (char)board[chr] + " ";
if((chr+1)%8==0){
out[chr/8]=s;
s="";
}
}
return out;
}
void printBoard(int[] board){
String[] out = outputBoard(board);
for(int i=0;i<8;i++){
System.out.println(out[i]);
}
System.out.println();
}
int[] mask(int[] b1, int[] b2){
int[] output=new int[64];
for(int i=0;i<64;i++){
if(b2[i]!=b1[i]){
if(b2[i]=='.')
output[i]=-b1[i];
else
output[i]=b2[i];
}
else
output[i] = '.';//b2[i]-b1[i];
}
return output;
}
boolean validateFen(String aFen){
/* Only check board part of FEN */
if(aFen.indexOf(' ')>0){
aFen = aFen.substring(0,aFen.indexOf(' '));
}
int s=0;
for(int c=0;c<aFen.length();c++){
if(aFen.charAt(c) == '/') s++;
}
if(s!=7) return false;
int x=0;
for(int c=0;c<aFen.length();c++){
if(aFen.charAt(c) == '/'){
if(x!=8) return false;
else x=0;
}
else
{
if(aFen.charAt(c) >= '1' && aFen.charAt(c)<= '8')
x+= aFen.charAt(c)-'1' ;
x++;
}
}
if(x!=8) return false;
return true;
}
}
rdgtFendiff.java
---
class rdgtFendiff {
char piece;
boolean added;
int square;
rdgtFenboard before;
rdgtFenboard after;
public rdgtFenboard getBefore() { return before; }
public rdgtFenboard getAfter() { return after; }
public char getPiece() { return piece; }
public boolean isAdded() { return added; }
public int getSquare() { return square; }
public boolean isWhite(){
if(piece>'A' && piece < 'Z')
return true;
else
return false;
}
public boolean equals(rdgtFendiff other){
if(getPiece() != other.getPiece()) return false;
if(getSquare() != other.getSquare()) return false;
if(isAdded() != other.isAdded()) return false;
return true;
}
public rdgtFendiff() {
secured=false;
}
public rdgtFendiff(char piece, boolean added,