47755 (588501), страница 19
Текст из файла (страница 19)
General: the message format is:
byte 1: message type byte (MSB = 1)
byte 2: message length MSB (from byte 1 to checksum) (D7=0)
byte 3: message length LSB (containing D0 to D6 of the length (D7 = 0)
byte 4: board address MSB (D7=0)
byte 5: board address LSB (D7=0)
last byte: checksum. This is the sum of all byte values from byte 1 to
the byte before this checksum. D7 is forced to 0
DGT_MSG_BUS_BRD_DUMP
the data area contains the piece codes from field 1 to field 64, in format
identical as the single board command
DGT_MSG_BUS_BWTIME
the data area contains the clock time information, in format identical as
the single board command
DGT_MSG_BUS_UPDATE
the data area contains a variable amount of change information, formatted
as described in the DGT_DUMP_EEMOVES message
DGT_MSG_BUS_FROM_START
the data area contains a variable amount of change information, formatted
as described in the DGT_DUMP_EEMOVES message
DGT_MSG_BUS_PING
the data area is empty: a message of 6 bytes is returned.
DGT_MSG_BUS_START_GAME_WRITTEN
The same format as for DGT_MSG_BUS_PING
DGT_MSG_BUS_VERSION
The two data bytes contain binary version number: first byte main number
second byte sub number.
Tips for usage of the bus mode:
A. On connection of power and starting of the communication process:
- Check communication with addressed DGT_BUS_PING commands to all expected
boards.
LOOP:
- Send DGT_BUS_IGNORE_NEXT_PING to all found boards
- Check eventually extra boards or unknown board busnumbers by using
a DGT_BUS_PING with address zero.
- Register the found boards, and go to LOOP:, until no more boards are found
B. At the start of an event: when all boards have pieces in starting
position, send DGT_BUS_SET_START_GAME commands to all boards.
- Read full clock times from all boards.
C. During a game: send DGT_BUS_SEND_CHANGES to all boards sequentially,
once every few seconds. The returned data should logically match
with the expected piece positions. When any mismatch occurs: ask full
position with DGT_BUS_SEND_BRD.
D. When previous data are lost: send a DGT_BUS_SEND_FROM_START command
which returns the full registered changes from the starting position.
On every sent message: The responce time at the board is within milliseconds
normally, except when the board is storing a measured change in the
internal EEPROM: Then the responce time can be up to 20 milliseconds.
So allow a time-out on sent messages of say 80 mS.
Checksum errors: when a received checksum does not match, resend the command
except on the DGT_BUS_SEND_CHANGES: then the command DGT_BUS_REPEAT_CHANGES
should be used, to avoid discarding of the changes sent by the board.
On clock data:
- reading data out of the clock and make them available
for communication causes a delay of up to 1 second between clock display
and received data.
*/
#endif
Приложение Ж
Общая структура транслятора шахматных партий
Приложение З
Общая структура регистратора шахматных партий
Приложение И
Анализ результатов тестовых испытаний
| № п/п | Показатель | Абсолютный количественный показатель | Относительный количественный показатель в % | Степень соответствия условиям соревновательного процесса (субъективная оценка главного арбитра соревнований) |
| 1 | Количество сбоев в работе СШПО в ходе всего сорев-новательного про-цесса | 0 | – | ПОЛНОСТЬЮ СООТВЕТСТВУЕТ |
| 2 | Количество вре-менных простоев в работе СШПО в ходе всего сорев-новательного про-цесса | 0 | – | ПОЛНОСТЬЮ СООТВЕТСТВУЕТ |
| 3 | Количество несоот-ветствий отобража-емого хода ходу, сделанному на ша-хматной доске | 5 | 0,48 | ПОЛНОСТЬЮ СООТВЕТСТВУЕТ |
| 4 | Количество вре-менных задержек в ходе отображения игрового процесса | 1 | 0,01 | ПОЛНОСТЬЮ СООТВЕТСТВУЕТ |
| 5 | Количество вре-менных задержек переноса шахмат-ных партий в элек-тронную форму | 1 | 0,01 | ПОЛНОСТЬЮ СООТВЕТСТВУЕТ |
Директор СП «ШК» Амзоров А.М.
Главный арбитр соревнований Федоров В.Н.
Приложение К
Листинг модуля вещания шахматных партий
// Фигура
var Figure = {
create: function(color, type, vertical) {
function figure() {}
var self = new figure();
self.id = color + type + vertical;
self.image = document.createElement('img');
self.image.src = get_image_path() + (color + type + '.gif').toLowerCase();
self.image.size = '8x8';
return self;
}
};
// Поле доски
var Field = {
create: function(vertical, horizontal) {
function field() {}
var self = new field();
// Идентификатор поля, соответствует ячейке в таблице, являющейся шахматной доской
self.id = "field" + vertical + horizontal;
self.horizontal = horizontal;
self.vertical = vertical;
self.cell = $(self.id);
//
function v(letter) {
letter = letter.toLowerCase();
if(letter == 'a') {
return 1;
}
if(letter == 'b') {
return 2;
}
if(letter == 'c') {
return 3;
}
if(letter == 'd') {
return 4;
}
if(letter == 'e') {
return 5;
}
if(letter == 'f') {
return 6;
}
if(letter == 'g') {
return 7;
}
if(letter == 'h') {
return 8;
}
return 0;
}
var vv = v(self.vertical);
var hh = parseInt(self.horizontal);
function isWhite(summa) {
var is_white = (summa / 2) - (Math.floor(summa / 2)) == 0;
//log(summa + ' - ' + is_white);
return !is_white;
}
self.cell.className = isWhite(vv + hh) ? 'board_white_field' : 'board_black_field';
self.set_figure = function(figure) {
if(figure == null) {
log('null in ' + self.id);
}
self.delete_figure();
self.cell.appendChild(figure.image);
self.current_figure = figure;
}
self.init_figure = function(figure) {
self.set_figure(figure);
self.first_figure = figure;
self.last_figure = figure;
}
self.delete_figure = function() {
this.cell.innerHTML = "";
}
self.first_figure = null;
self.current_figure = null;
self.last_figure = null;
return self;
}
};
// Ход шахматной партии
var Move = {
create: function() {
function move() {}
var self = new move();
self.color = '';
self.next = null;
self.prev = null;
self.number = 0;
self.field_from = null;
self.field_to = null;
self.figure = null;
self.figure_dead = null;
self.is_short_castling = false;
self.is_long_castling = false;
self.forward = function() {
if(self.is_short_castling || self.is_long_castling) {
self.field_from[0].delete_figure();
self.field_from[1].delete_figure();
self.field_to[0].set_figure(self.figure[0]);
self.field_to[1].set_figure(self.figure[1]);
} else {
self.field_from.delete_figure();
self.field_to.set_figure(self.figure);
}
}
return self;
}
};
var Chess = {
version: "2.0",
refresh_delay: 2, // интервал времени между обновлениями позиции в секундах
repaint_delay: 0.5, // интервал времени между перерисовками позиции в секундах
moves: '/main/game_moves/1',
createBoard: function() {
var board = Board.create();
board.init();
return board;
},
createField: function(vertical, horizontal) {
var self = Field.create(vertical, horizontal);
return self;
},
createFigure: function(color, type, vertical) {
var self = Figure.create(color, type, vertical);
return self;
},
createMove: function() {
var self = Move.create();
return self;
}
};
// Шахматная доска
var Board = {
create: function() {
function board() { }
var self = new board();
self.white_number = 0;
self.black_number = 0;
self.first_move = null;
self.current_move = null;
self.last_move = null;
// Могут быть состояния
// listen - следить за ходом партий, отображаются актуальные ходы
// custom - наблюдатель выбрал произвольную позицию в партии и навигирует по партии свободно
self.status = 'listen';
self.fields = new Array(64);
self.figures = new Array(32);
self.all_moves = '';
// Обновление позиции
self.refresh = function() {
function existsMove(color, annotation) {
var move = getMove(color, annotation);
var exists = move != "******" && move != "";
return exists;
}
function getMove(color, annotation) {
var m = annotation.substring(color == 'w' ? 0 : 6, color == 'w' ? 6 : 12);
return m;
}
function isCastling(color, type, annotation) {
var move = getMove(color, annotation);
var castling = (type == 'short' ? move.substring(0, 3) == 'O-O' : move.substring(0, 5) == 'O-O-O');
return castling;
}
function getField(is_short, is_long, target, color, annotation) {
if(is_short || is_long) {
if(color == 'w') {
if(is_short) {
return new Array(self.fields[target == 'from' ? 4 : 6], self.fields[target == 'from' ? 7 : 5]);
}
if(is_long) {
return new Array(self.fields[target == 'from' ? 4 : 2], self.fields[target == 'from' ? 0 : 3]);
}
}
if(color == 'b') {
if(is_short) {
return new Array(self.fields[target == 'from' ? 60 : 62], self.fields[target == 'from' ? 63 : 61]);
}
if(is_long) {
return new Array(self.fields[target == 'from' ? 60 : 58], self.fields[target == 'from' ? 56 : 59]);
}
}
}
var field = annotation.substring(color == 'w' ? (target == 'from' ? 1 : 4) : (target == 'from' ? 7 : 10), color == 'w' ? (target == 'from' ? 3 : 6) : (target == 'from' ? 9 : 12));
var v = field.substring(0, 1).toLowerCase();
var h = field.substring(1, 2).toLowerCase();
//log('getField: v ' + v + ' h: ' + h);
var iField = (parseInt(h) - 1) * 8;
//log('tmp ' + iField);
if(v == 'b') {
iField += 1;
}
if(v == 'c') {
iField += 2;
}
if(v == 'd') {
iField += 3;
}
if(v == 'e') {
iField += 4;
}
if(v == 'f') {
iField += 5;
}
if(v == 'g') {
iField += 6;
}
if(v == 'h') {
iField += 7;
}
//log('return ' + iField);
return self.fields[iField];
}
function getFigure(is_short, is_long, target, color, field) {
if(is_short || is_long) {
if(color == 'w') {
if(is_short) {
return new Array(self.figures[0], self.figures[7]);
}
if(is_long) {
return new Array(self.figures[0], self.figures[6]);
}
}
if(color == 'b') {
if(is_short) {
return new Array(self.figures[16], self.figures[23]);
}
if(is_long) {
return new Array(self.figures[16], self.figures[22]);
}
}
}
if(target == 'alive') {
return field.last_figure;















