-
-
Save MacLeek/b2066f097071eea6399d0092b0aa80f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var names = $(".cell strong a").map(function () { | |
return (this.text) | |
}).toArray(); | |
var distinctNames = new Set(names); | |
if (distinctNames.length < 80 || names.length < 100) { | |
console.log('重复数超过20,或者总回复不到100,本页不抽取'); | |
} else { | |
var sum = 0; | |
distinctNames.forEach(function (name) { | |
for (var i in name) { | |
sum += name[i].charCodeAt() | |
} | |
}); | |
var prizeNum = sum % 100 + 1; | |
while (1) { | |
console.log('中奖号:' + (prizeNum)); | |
if (names.indexOf(names[prizeNum - 1]) === prizeNum - 1) { | |
console.log(names[prizeNum - 1]); | |
break; | |
} else { | |
console.log('中奖号非第一次回复的楼号,顺延'); | |
if (prizeNum === 100) { | |
prizeNum = 1 | |
} else { | |
prizeNum += 1 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment