Guess the correlation [crack]

It a good game~

http://guessthecorrelation.com/

guessthecorrelation_result

this is how I play the game.

// Game: http://guessthecorrelation.com/
//https://www.mathsisfun.com/data/correlation.html
//http://www.dummies.com/how-to/content/how-to-calculate-a-correlation.html
var m_ScoreToAchieve = 3000;

function correlation()
{
	var points = $(".nv-point");
	var tx = 0, ty = 0, cnt = 0;
	points.each(function(k,v){
		var coord = $(this).attr("transform").replace("translate(","").replace(")","").split(",");
		tx+=parseFloat(coord[0]);
		ty+=parseFloat(coord[1]);
		cnt++;
	});
	var meanX = tx/cnt, meanY = ty/cnt;
	var saxb = 0, sa = 0 , sb = 0;
	points.each(function(k,v){
		var coord = $(this).attr("transform").replace("translate(","").replace(")","").split(",");
		var
			x = parseFloat(coord[0]),
			y = parseFloat(coord[1]),
			a = x - meanX,
			b = y- meanY,
			axb = a * b;
		saxb += axb;
		sa += a * a;
		sb += b * b;
	});
	return Math.abs(saxb / Math.sqrt(sa * sb));
}

function Init()
{
	var hack = function()
	{
		setTimeout(function(){ $("#guess-input").val(correlation())}, 200);
		setTimeout(function(){ $("#submit-btn").click(); }, 210);
		setTimeout(function(){
			if($(".heart-full").length > 1 && parseInt($(".ncoins").text()) < m_ScoreToAchieve )
				$("#next-btn").click();
			else
				$("#next-btn").unbind("click", hack);
		}, 220);
	};
	$("#next-btn").unbind("click", hack).bind("click", hack);
	hack();
}
Init();

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

*

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料