阅读 1721

人生重开模拟器--自动重开模拟器

最近痴迷人生重开模拟器,玩儿了很久也没开出像样的人生,所以灵光一现决定做个自动人生重开,看看,即使重开了,我们的人生大概会过的怎么样。

不废话直接上教程!

Life Restart (syaro.io)

进入项目地址,直接F12,粘贴以下代码即可开始自动重开。

const log = console.log;
const sleep = (timeout) => {
	return new Promise((resolve) => {
		setTimeout(() => {
			resolve();
		}, timeout)
	})
}

const main = async (times) => {
	function shuffle(arr) {
		var result = [],
			random;
		while (arr.length > 0) {
			random = Math.floor(Math.random() * arr.length);
			result.push(arr[random])
			arr.splice(random, 1)
		}
		return result;
	}

	let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
	let result = [];
	arr = shuffle(arr);

	for (let i = 0; i < times; i++) {
		let life = {};
		life.start = {};
		life.end = {};
		arr = shuffle(arr);
		$(".mainbtn").click();
		await sleep(100);
		$("#random").click();
		$(".selectlist li")[arr[0]].click();
		$(".selectlist li")[arr[1]].click();
		$(".selectlist li")[arr[2]].click();
		$("#next").click();
		$("#random").click();
		life.start.yanzhi = $("#propertyAllocation li input")[0].value;
		life.start.zhili = $("#propertyAllocation li input")[1].value;
		life.start.tizhi = $("#propertyAllocation li input")[2].value;
		life.start.jiajin = $("#propertyAllocation li input")[3].value;
		$("#start").click();
		while ($("#summary").css("display") === 'none') {
			$("#lifeTrajectory").click();
		}
		$("#summary").click();
		life.end.yanzhi = $(".judge li")[0].innerText.split(" ")[0].split("\n")[1];
		life.end.zhili = $(".judge li")[1].innerText.split(" ")[0].split("\n")[1];
		life.end.tizhi = $(".judge li")[2].innerText.split(" ")[0].split("\n")[1];
		life.end.jiajin = $(".judge li")[3].innerText.split(" ")[0].split("\n")[1];
		life.end.kuaile = $(".judge li")[4].innerText.split(" ")[0].split("\n")[1];

		life.age = $(".judge li")[5].innerText.split(" ")[0].split("\n")[1];
		life.total = $(".judge li")[6].innerText.split(" ")[0].split("\n")[1];

		$("#again").click();
		result.push(life);
		await sleep(100);
	}
	console.clear();
	log("自动重开完成!");
	log("结果如下");
	let tableArr = result.map(life => {
		return {
			"出生颜值": life.start.yanzhi,
			"出生智力": life.start.zhili,
			"出生体质": life.start.tizhi,
			"出生家境": life.start.jiajin,
			"死亡颜值": life.end.yanzhi,
			"死亡智力": life.end.zhili,
			"死亡体质": life.end.tizhi,
			"死亡家境": life.end.jiajin,
			"快乐指数":life.end.kuaile,
			"享年":life.age,
			"评分":life.total,
		}
	})
	console.table(tableArr, ["出生颜值", "出生智力", "出生体质", "出生家境", "死亡颜值", "死亡智力", "死亡体质", "死亡家境","快乐指数","享年","评分"]);
	
	log("按照评分排序后");
	result.sort((a, b) => b.total - a.total);
	tableArr = result.map(life => {
		return {
			"出生颜值": life.start.yanzhi,
			"出生智力": life.start.zhili,
			"出生体质": life.start.tizhi,
			"出生家境": life.start.jiajin,
			"死亡颜值": life.end.yanzhi,
			"死亡智力": life.end.zhili,
			"死亡体质": life.end.tizhi,
			"死亡家境": life.end.jiajin,
			"快乐指数":life.end.kuaile,
			"享年":life.age,
			"评分":life.total,
		}
	})
	console.table(tableArr, ["出生颜值", "出生智力", "出生体质", "出生家境", "死亡颜值", "死亡智力", "死亡体质", "死亡家境","快乐指数","享年","评分"]);
	
	

}


main(100);
复制代码

 修改main函数指定次数,我们尝试重开100次看看~

很快啊,我们的结果出来了~

整整100次~

往下看有排序的结果,这么干看数据多不舒服,所以可以进行可视化,复制数据到excel

简简单单做个图表

从统计来看你大概率还是能活到60以上的~

文章分类
前端
文章标签