Обеспечение всемирной трансляции спортивных шахматных соревнований с применением разработанного в ходе проекта законченного программного продукта
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
integer
30"> t.column "debut_code", :string, :limit => 30
t.column "description", :text
30"> t.column "status", :string, :limit => 30
end
create_table "games", :force => true do |t|
t.column "game_info_id", :integer
t.column "begin", :datetime
t.column "end", :datetime
t.column "desciption", :text
end
create_table "last_moves", :force => true do |t|
t.column "move_id", :integer
t.column "move_time", :datetime
end
create_table "moves", :force => true do |t|
t.column "number", :integer
t.column "game_id", :integer
6"> t.column "white_move", :string, :limit => 6
6"> t.column "black_move", :string, :limit => 6
t.column "white_clock", :float
t.column "black_clock", :float
t.column "white_comment", :text
t.column "black_comment", :text
end
create_table "players", :force => true do |t|
30"> t.column "first_name", :string, :limit => 30
30"> t.column "second_name", :string, :limit => 30
t.column "country_id", :integer
t.column "burn_date", :datetime
t.column "fide_rating", :integer
t.column "photo", :binary
t.column "description", :text
end
create_table "tournament_views", :force => true do |t|
30"> t.column "name", :string, :limit => 30
30"> t.column "system", :string, :limit => 30
nil,:default=>false"> t.column "is_match", :boolean, :limit => nil, :default => false
nil,:default=>false"> t.column "is_command", :boolean, :limit => nil, :default => false
0"> t.column "total_games", :integer, :default => 0
0"> t.column "total_rounds", :integer, :default => 0
t.column "description", :text
end
create_table "tournaments", :force => true do |t|
30"> t.column "name", :string, :limit => 30
t.column "category", :integer
t.column "city_id", :integer
t.column "begin_date", :datetime
t.column "end_date", :datetime
t.column "tournament_view_id", :integer
30"> t.column "status", :string, :limit => 30
t.column "description", :text
end
create_table "users", :force => true do |t|
30"> t.column "login", :string, :limit => 30
50"> t.column "password", :string, :limit => 50
30"> t.column "name", :string, :limit => 30
nil,:default=>false"> t.column "is_admin", :boolean, :limit => nil, :default => false
30"> t.column "email", :string, :limit => 30
30"> t.column "webpage", :string, :limit => 30
t.column "desciption", :text
end
end
Javascript (javascript) осуществляют демонстрацию шахматной партии, при помощи технологии AJAX обращаясь за обновлениями позиции на rDGT сервер.
game.js
---
var images =
var moves_url = /main/game_moves/1;
// Фигура
function figure(id, color, type, current_field, last_field, alive, board) {
this.id = id;
this.color = color;
this.type = type;
this.current_field = current_field;
this.last_field = last_field;
this.alive = alive;
this.set_field = set_field;
this.do_move = do_move;
this.reload = reload;
this.img = document.createElement(img);
this.img.id = this.id;
this.board = board;
this.reload();
//trace(create figure [ + this.id + ]);
}
// Поле
function field(id, color, vertical, horizontal, figure, board) {
this.id = id;
this.color = color;
this.vertical = vertical;
this.horizontal = horizontal;
this.figure = figure;
this.board = board;
this.repaint = repaint;
//trace(create field [ + this.id + ]);
}
// Ход
function move(number, color, from_field, to_field, figure, alive_figure, is_short_castling, is_long_castling, prev_move, next_move, board, time) {
this.number = number;
this.color = color;
this.from_field = from_field;
this.to_field = to_field;
this.figure = figure;
this.alive_figure = alive_figure;
this.forward = forward;
this.backward = backward;
this.is_short_castling = is_short_castling;
this.is_long_castling = is_long_castling;
this.prev_move = prev_move;
this.next_move = next_move;
this.board = board;
this.white_time = white_time;
this.black_time = black_time;
}
// Коллекция ходов
function move_collection(board) {
this.board = board;
this.get_move = function(color, number) {
return color == white ? this.moves[(number * 2) - 1] : this.moves[number * 2];
}
this.exists_move = function(color, number) {
return get_move(color, number) != null;
}
this.get_current_move = function() {
return this.current_move;
}
this.add_move = function(move) {
trace(add move: + move.number + " " + moveBy.color);
if(current_move == null) {
this.first_move = move;
this.current_move = move;
} else {
move.prev_move = this.current_move;
this.current_move.next_move = move;
this.current_move = move;
}
this.moves.push(move);
}
this.first_move = null;
this.current_move = null;
this.moves = new Array();
}
// Коллекция фигур
function figure_collection(board) {
this.board = board;
this.wpA = new figure(wpA, white, pawn, null, null, true, board);
this.wpB = new figure(wpB, white, pawn, null, null, true, board);
this.wpC = new figure(wpC, white, pawn, null, null, true, board);
this.wpD = new figure(wpD, white, pawn, null, null, true, board);
this.wpE = new figure(wpE, white, pawn, null, null, true, board);
this.wpF = new figure(wpF, white, pawn, null, null, true, board);
this.wpG = new figure(wpG, white, pawn, null, null, true, board);
this.wpH = new figure(wpH, white, pawn, null, null, true, board);
this.wrA = new figure(wrA, white, rook, null, null, true, board);
this.wrH = new figure(wrH, white, rook, null, null, true, board);
this.whB = new figure(whB, white, horse, null, null, true, board);
this.whG = new figure(whG, white, horse, null, null, true, board);
this.wbC = new figure(wbC, white, bishop, null, null, true, board);
this.wbF = new figure(wbF, white, bishop, null, null, true, board);
this.wq = new figure(wq, white, queen, null, null, true, board);
this.wk = new figure(wk, white, king, null, null, true, board);
this.bpA = new figure(bpA, black, pawn, null, null, true, board);
this.bpB = new figure(bpB, black, pawn, null, null, true, board);
this.bpC = new figure(bpC, black, pawn, null, null, true, board);
this.bpD = new figure(bpD, black, pawn, null, null, true, board);
this.bpE = new figure(bpE, black, pawn, null, null, true, board);
this.bpF = new figure(bpF, black, pawn, null, null, true, board);
this.bpG = new figure(bpG, black, pawn, null, null, true, board);