<commit_before><html>
<head>
<title>heart.js test</title>
<script src="../heart.js"></script>
<script>
/* Command a raging red heart, straight from the depths of the dragon's lair! What could be more fun? Perhaps 10 tons of fun,
   but you take what you can get, right? */

var player = {x: 200, y: 200, speed: 50, img: null};

heart.preload = function() {
	heart.graphics.newImage("heart.png", function(r) { player.img = r; });
}

heart.load = function() {
	heart.attach("cnv");
}

heart.update = function(dt) {
	if(heart.keyboard.isDown("left"))
		player.x -= player.speed * dt;
	else if(heart.keyboard.isDown("right"))
		player.x += player.speed * dt;

	if(heart.keyboard.isDown("up"))
		player.y -= player.speed * dt;
	else if(heart.keyboard.isDown("down"))
		player.y += player.speed * dt;
}

heart.draw = function() {
	heart.graphics.draw(player.img, player.x, player.y);

	heart.graphics.setColor(255, 255, 0);
	heart.graphics.print("fps: " + heart.timer.getFPS(), 10, 10);
}

</script>
</head>
<body>

<canvas id="cnv" width="800" height="600">your browser doesn't support &lt;canvas&gt;</canvas>

</body>
</html><commit_msg>add color changing to the keyboard demo<commit_after><html>
<head>
<title>heart.js test</title>
<script src="../heart.js"></script>
<script>
/* Command a raging red heart, straight from the depths of the dragon's lair! What could be more fun? Perhaps 10 tons of fun,
   but you take what you can get, right? */

var player = {x: 200, y: 200, speed: 50, img: null};
var lastTime = new Date().getTime();
var COLOR_DELAY = 0.5 /* seconds */;

heart.preload = function() {
	heart.graphics.newImage("heart.png", function(r) { player.img = r; });
}

heart.load = function() {
	heart.attach("cnv");
}

heart.update = function(dt) {
	if(heart.keyboard.isDown("left"))
		player.x -= player.speed * dt;
	else if(heart.keyboard.isDown("right"))
		player.x += player.speed * dt;

	if(heart.keyboard.isDown("up"))
		player.y -= player.speed * dt;
	else if(heart.keyboard.isDown("down"))
		player.y += player.speed * dt;

	if(heart.keyboard.isDown(" ")) {
		if((new Date().getTime() - lastTime) >= 1000*COLOR_DELAY) {
			var r = Math.round(Math.random()*255);
			var g = Math.round(Math.random()*255);
			var b = Math.round(Math.random()*255);
			heart.graphics.setBackgroundColor(r, g, b);
			lastTime = new Date().getTime();
		}
	}
}

heart.draw = function() {
	heart.graphics.draw(player.img, player.x, player.y);

	heart.graphics.setColor(255, 255, 0);
	heart.graphics.print("fps: " + heart.timer.getFPS(), 10, 10);
}

</script>
</head>
<body>

<canvas id="cnv" width="800" height="600">your browser doesn't support &lt;canvas&gt;</canvas>

</body>
</html>
{'fraction_non_alphanumeric': 0.19111608809257186, 'fraction_numerical': 0.025755879059350503, 'mean_word_length': 4.244618395303327, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, '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': '1421741', 'n_tokens_mistral': 1055, 'n_tokens_neox': 962, 'n_words': 237}