QQ围棋棋谱

腾讯围棋分享出来的链接:

https://huanle.qq.com/act/a20170110wq/index-photo.html?type=1&chess=0200002200110000000202002022112100000000220202212211220000220000022211110200020002002022221120002202020221111120000012222221101012000001111121012022120000012221111200012000200011102200201200002112001002000100000000201211001220000002200022110011000002111002000200020000200001001120112000011000002020012000000000102202201200000000012211121000000000000000001000000

其实棋谱就在这一串书数字里,懒得去解析,可以直接分析网页源代码。

通过源代码就能看出每颗棋子的位置。

用Tampermonkey写一个脚本,就可以得到对应的棋谱了。

// ==UserScript==
// @name         腾讯围棋转谱
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://huanle.qq.com/act/*
// @grant        none
// @require    http://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(function () { load(); }, 2000);
    $(".comment_title1").append("<textarea id='qp' style='width:100%;height:100px'>棋谱生成中...</textarea>");
    function load() {
        var arr = "ABCEDFGHIJKLMNOPQRS";
        var res = "(";
        $("#gameView div").each(function () {
            var left = $(this).css("left").replace("px", "") - 19;
            var top = $(this).css("top").replace("px", "") - 19;
            var x = arr[left / 38].toLowerCase();
            var y = arr[top / 38].toLowerCase();
            var c = $(this).attr("class") == "chessBlack" ? "B" : "W";
            res += (c + "[" + x + y + "]") + ";"
        });
        res = res.substring(0, res.length - 1) + ")";
        $("#qp").val( res);
    }
})();

执行效果

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值