<commit_before>import Screen from 'screen';
import Rect from 'rect';
import Brick from 'brick';
import ui from 'ui';

const canvas = document.querySelector('#screen');
const screen = Screen(canvas.getContext('2d'));

const colors = [
	'white',
	'orange',
	'cyan',
	'green',
	'red',
	'blue',
	'purple',
	'yellow',
	'gray',
	'gold'
]


screen.size = {
	width: 224*2,
	height: 256*2
};

function createBricks(cols, rows) {
	const bricks = [];
	for (let row = 0; row < rows; row++) {
		for (let col = 0; col < cols; col++) {
			bricks.push(Brick(colors[row], {x: col*2, y: row}, screen));
		}
	}
	return bricks;
}

ui.keyboard.on('direction-changed', direction => {
	console.log(`(${direction.x}, ${direction.y})`);
});

const bricks = createBricks(13, 7);

function draw() {
	screen.save();

	screen.brush = '#444';
	screen.clear();
	screen.translate({x: (screen.width/14)/2, y: 4*(screen.width/14)/2});

	for (let brick of bricks) {
		brick.draw();
	}
	screen.restore();
	// requestAnimationFrame(draw);
}
requestAnimationFrame(draw);
<commit_msg>try some functions<commit_after>import Screen from 'screen';
import Rect from 'rect';
import Brick from 'brick';
import ui from 'ui';

const canvas = document.querySelector('#screen');
const screen = Screen(canvas.getContext('2d'));

const colors = [
	'white',
	'orange',
	'cyan',
	'green',
	'red',
	'blue',
	'purple',
	'yellow',
	'gray',
	'gold'
]


screen.size = {
	width: 224*2,
	height: 256*2
};

function createBricks(cols, rows) {
	const bricks = [];
	for (let row = 0; row < rows; row++) {
		for (let col = 0; col < cols; col++) {
			bricks.push(Brick(colors[row], {x: col*2, y: row}, screen));
		}
	}
	return bricks;
}

ui.keyboard.on('direction-changed', direction => {
	console.log(`(${direction.x}, ${direction.y})`);
});
ui.keyboard.on('fire', engaged => {
	console.log(`fire ${engaged ? 'engaged' : 'disengaged'}`);
});

const bricks = createBricks(13, 7);

function draw() {
	screen.save();

	screen.brush = '#444';
	screen.clear();
	screen.translate({x: (screen.width/14)/2, y: 4*(screen.width/14)/2});

	for (let brick of bricks) {
		brick.draw();
	}
	screen.restore();
	// requestAnimationFrame(draw);
}
requestAnimationFrame(draw);

{'fraction_non_alphanumeric': 0.20637813211845102, 'fraction_numerical': 0.022779043280182234, 'mean_word_length': 4.49, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, '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': '1503330', 'n_tokens_mistral': 873, 'n_tokens_neox': 818, 'n_words': 194}