<commit_before>var canvas, ctx, w, h;

var colorful = true;

var colordef = {
		sky: "#4d79ff",
		ground: "#00b300",
		body: "#ed00ed",
		stick: "#ff66ff"
}

var color = {
		sky: "#4d79ff",
		ground: "#00b300",
		body: "#ed00ed",
		stick: "#ff66ff"
}

// Animation loop

speed = 60*5
//speed = 1/speed
var lastTime;
var maxSubSteps = 5; // Max physics ticks per render frame
var fixedDeltaTime = 1 / speed; // Physics "tick" delta time
function animate(time) {
	if(!pause) {
		requestAnimationFrame(animate);
	}
	// Get the elapsed time since last frame, in seconds
	var deltaTime = lastTime ? (time - lastTime) / 1000 : 0;
	lastTime = time;
	// Make sure the time delta is not too big (can happen if user switches
	// browser tab)
	deltaTime = Math.min(1 / 10, deltaTime);
	// Move physics bodies forward in time
	world.step(fixedDeltaTime, deltaTime, maxSubSteps);
	// Render scene
	if(!tutorialm) {
		render();
	} else {
		rendertut()
	}
}

var xscroll = 0
var yscroll = 0

var endscore = 0

function render() {
	var px = pogo.frame.body.position[0]
	if(px>secwidth) {
//		console.log("Sec #2")
	}
	
	if(px-w/50/2>secwidth) {
		removeSection(sectionA)
		removeSection(sectionB)
		sectionA=changenum(sectionB, 0, 1)
		sectionB=changenum(generateSection(), 1, 0);
//		console.log(pogo.frame.body.position[0]/secwidth)
		pogo.frame.body.position[0]-=secwidth
		pogo.stick.body.position[0]-=secwidth
//		console.log(pogo.frame.body.position[0]/secwidth)
//		console.log("Sec #1")
		addSection(sectionA)
		addSection(sectionB)
		score+=secwidth
	}
	
	if(pogo.frame.body.position[0]<0) {
		gameOver = true;
		leftplay = false;
		pogo.frame.body.position[0]=Math.max(pogo.frame.body.position[0], -2)
		pogo.frame.body.position[1]=Math.max(pogo.frame.body.position[1], -5)
	}
	// Clear the canvas
	ctx.clearRect(0, 0, w, h);
	
	if(colorful) {
		ctx.fillStyle = color.sky;
	} else {
		ctx.fillStyle = "#FFFFFF"
	}
	
	ctx.fillRect(0,0,w,h);
	ctx.fill()
	
	
	// Transform the canvas
	// Note that we need to flip the y axis since Canvas pixel coordinates
	// goes from top to bottom, while physics does the opposite.
	
	
	ctx.save();
	if(px>=w/50/2) {
		xscroll = -pogo.frame.body.position[0]
	}
	v = pogo.frame.body.position[1]-yscroll
	
	if (Math.abs(v)>0.35) {
		lerpval = 0.015
	} else {
		lerpval = 0.01
	}
	
	if (v<-0.2) {
		lerpval = 0.0325
	}
	yscroll = v*lerpval+yscroll
//	yscroll = Math.max(yscroll, 0)
//	yscroll = Math.min(yscroll, 1)
	
//	ctx.translate(xscroll, 0)
	
	ctx.translate(w / 2, h / 2); // Translate to the center
	ctx.scale(50, -50); // Zoom in and flip y axis
	
	ctx.translate(xscroll, -yscroll)
	// Draw all bodies
	// drawbox(pogo.frame);
	ctx.strokeStyle = "#000000";
	drawpogo();
	
	// drawBox(pogo.frame)
	// drawPlane();
//	var y = heightfield.body.position[1]
//	// y = -1
//	var x = heightfield.body.position[0]
	
	
//	x+=xscroll
	// x = 0
	
//	var x = sectionA.h.body.position[0]
//	var y = sectionA.h.body.position[1]
	var x = -1;
	var y = -1;
	
	ctx.beginPath();
	ctx.moveTo(x, -h/50);
	
	var px = pogo.frame.body.position[0]
	
	var cdata = sectionA.d.slice(0, -1).concat(sectionB.d)
	
	for (var i = 0; i < cdata.length; i++) {
		var x1 = i * 2//sectionA.h.shape.elementWidth
		if(x1>=px-w/50/2-1) {
			ctx.lineTo(x + x1, y + cdata[i]);
		}
		
//		if(i==sectionA.d.length-1){
//			ctx.lineTo(x+x1, -h/50)
//		}
		if(x1>px+w/50/2+2) {
			break;
		}<commit_msg>part of previous 2 commits<commit_after>var canvas, ctx, w, h;

var colorful = true;

var colordef = {
		sky: "#4d79ff",
		ground: "#00b300",
		body: "#ed00ed",
		stick: "#ff66ff"
}

var color = {
		sky: "#4d79ff",
		ground: "#00b300",
		body: "#ed00ed",
		stick: "#ff66ff"
}

// Animation loop

speed = 60*5
//speed = 1/speed
var lastTime;
var maxSubSteps = 5; // Max physics ticks per render frame
var fixedDeltaTime = 1 / speed; // Physics "tick" delta time
function animate(time) {
	if(!pause) {
		requestAnimationFrame(animate);
	}
	// Get the elapsed time since last frame, in seconds
	var deltaTime = lastTime ? (time - lastTime) / 1000 : 0;
	lastTime = time;
	// Make sure the time delta is not too big (can happen if user switches
	// browser tab)
	deltaTime = Math.min(1 / 10, deltaTime);
	// Move physics bodies forward in time
	world.step(fixedDeltaTime, deltaTime, maxSubSteps);
	// Render scene
	if(!tutorialm) {
		render();
	} else {
		rendertut()
	}
}

var xscroll = 0
var yscroll = 0

var endscore = 0

function render() {
	var px = pogo.frame.body.position[0]
	if(px>secwidth) {
//		console.log("Sec #2")
	}
	
	if(px-w/50/2>secwidth) {
		removeSection(sectionA)
		removeSection(sectionB)
		sectionA=changenum(sectionB, 0, 1)
		sectionB=changenum(generateSection(), 1, 0);
//		console.log(pogo.frame.body.position[0]/secwidth)
		pogo.frame.body.position[0]-=secwidth
		pogo.stick.body.position[0]-=secwidth
//		console.log(pogo.frame.body.position[0]/secwidth)
//		console.log("Sec #1")
		addSection(sectionA)
		addSection(sectionB)
		score+=secwidth
	}
	
	if(pogo.frame.body.position[0]<0) {
		gameOver = true;
		leftplay = false;
		pogo.frame.body.position[0]=Math.max(pogo.frame.body.position[0], -2)
		pogo.frame.body.position[1]=Math.max(pogo.frame.body.position[1], -5)
	}
	// Clear the canvas
	ctx.clearRect(0, 0, w, h);
	
	if(colorful) {
		ctx.fillStyle = color.sky;
	} else {
		ctx.fillStyle = "#FFFFFF"
	}
	
	ctx.fillRect(0,0,w,h);
	ctx.fill()
	
	
	// Transform the canvas
	// Note that we need to flip the y axis since Canvas pixel coordinates
	// goes from top to bottom, while physics does the opposite.
	
	
	ctx.save();
	if(px>=w/50/2) {
		xscroll = -pogo.frame.body.position[0]
	}
	v = pogo.frame.body.position[1]-yscroll
	
	if (Math.abs(v)>0.35) {
		lerpval = 0.015
	} else {
		lerpval = 0.01
	}
	
	if (v<-0.2) {
		lerpval = 0.0325
	}
	yscroll = v*lerpval+yscroll
//	yscroll = Math.max(yscroll, 0)
//	yscroll = Math.min(yscroll, 1)
	
//	ctx.translate(xscroll, 0)
	
	ctx.translate(w / 2, h / 2); // Translate to the center
	ctx.scale(50, -50); // Zoom in and flip y axis
	
	ctx.translate(xscroll, -yscroll)
	// Draw all bodies
	// drawbox(pogo.frame);
	ctx.strokeStyle = "#000000";
	drawpogo();
	
	// drawBox(pogo.frame)
	// drawPlane();
//	var y = heightfield.body.position[1]
//	// y = -1
//	var x = heightfield.body.position[0]
	
	
//	x+=xscroll
	// x = 0
	
//	var x = sectionA.h.body.position[0]
//	var y = sectionA.h.body.position[1]
	var x = -1;
	var y = -1;
	
	ctx.beginPath();
	ctx.moveTo(x, -h/50);
	
	var px = -xscroll//pogo.frame.body.position[0]
	
	var cdata = sectionA.d.slice(0, -1).concat(sectionB.d)
	
	for (var i = 0; i < cdata.length; i++) {
		var x1 = i * 2//sectionA.h.shape.elementWidth
		if(x1>=px-w/50/2-1) {
			ctx.lineTo(x + x1, y + cdata[i]);
		}
		
//		if(i==sectionA.d.length-1){
//			ctx.lineTo(x+x1, -h/50)
//		}
		if(x1>px+w/50/2+2) {
			break;
		}
{'fraction_non_alphanumeric': 0.1734078540961906, 'fraction_numerical': 0.039858802765112514, 'mean_word_length': 3.0816326530612246, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7181757', 'n_tokens_mistral': 3099, 'n_tokens_neox': 2809, 'n_words': 610}