付费 3 个毛爷爷把一段 javascript( 30 多 行,作用是解析一段字符串为对象) 代码转成 C# 版本

2016-11-28 16:11:23 +08:00
 pyengwoei
var a = "8606454o056985060p072405880643074o0p2546098m4o0p4o0707074o0p06a74n078n471oc046434o4893084p090p0p9o1p45170p0n064p464o26260p446p46804p0p09060p0607560o06184848454646";
//var b= parseInt(a, 10);
G = function(a, b) {
var c = function(a) {
for (var b, c = [], d = 3, e = function(a) {
return a >= "0" && "9" >= a ? parseInt(a, 10) : a.charCodeAt(0) - "a".charCodeAt(0) + 10
}, f = function(a, b) {
var c, d, f, g, h;
//c =e 函数
return c = e(a[b]), d = e(a[b + 1]), d = 15 & d, f = (12 & c) >> 2, g = (2 & c) > 0, h = (1 & c) > 0, {
value: d, //d=e 函数
winner: f, // f = (12 & c)
playerPair: g, //g=(2&c)
bankerPair: h // h = (1 & c) > 0
}
},
g = 0; g < a.length - 1; g += 2)
b = f(a, g), b.winner !== d ? c.push(b) : c = [];
return c
};
if (!a || void 0 === b) return [];
switch (a) {
case "7bal":
case "bal":
return c(b);
case "rol":
case "rofl":
return b.split(";").map(function(a) {
return {
result: a
}
});
default:
return b
}
}

document.write(G("bal", a));

可以的联系我 Q 1069689491
1223 次点击
所在节点    JavaScript
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/323858

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX