<commit_before>vector = require "colon" --change this line for other previews
local vlen = #vector
local llen = 0
for i=1,vlen do
	llen = llen + #vector[i]
end
vlen = 'Lines: ' .. vlen
llen = 'Line pieces: ' .. llen

function drawlines(lines, x, y, s, ax, ay)
	love.graphics.setLineWidth(lines.width)
	for i=1,#lines-3,2 do
		love.graphics.line(lines[i]*s*ax - lines[i+1]*s*ay + x,
		                   lines[i]*s*ay + lines[i+1]*s*ax + y,
		                   lines[i+2]*s*ax - lines[i+3]*s*ay + x,
		                   lines[i+2]*s*ay + lines[i+3]*s*ax + y)
	end
	if lines.closed then 
		local i = #lines-1
		love.graphics.line(lines[i]*s*ax - lines[i+1]*s*ay + x,
		                   lines[i]*s*ay + lines[i+1]*s*ax + y,
		                   lines[1]*s*ax - lines[2]*s*ay + x,
		                   lines[1]*s*ay + lines[2]*s*ax + y)
		if lines.fill then
		end
	end
end

local hp = .5*math.pi
function drawshape(shape, x, y, s, a)
	a = a - hp
	local ax, ay = math.cos(a), math.sin(a)
	for i,lines in ipairs(shape) do
		drawlines(lines, x, y, s, ax, ay)
	end
end

totaltime = 0
D = love.keyboard.isDown
function love.update(dt)
	totaltime = totaltime + (D' ' and 4*dt or dt)
	love.timer.sleep(22)
end

local w, h = love.graphics.getWidth()/2, love.graphics.getHeight()/2
function love.draw()
	love.graphics.print(love.timer.getFPS(), 20, 10)
	love.graphics.print(vlen, 20, 30)
	love.graphics.print(llen, 20, 50)
	love.graphics.push()
	love.graphics.translate(w, h)
	love.graphics.scale(1, -1)
	love.graphics.setColor(100, 100, 100)
	love.graphics.circle('line', 0, 0, 290, 60)
	love.graphics.setColor(255, 255, 255)
	drawshape(vector, 0 , 0, 290, totaltime*.5)
	love.graphics.pop()
end<commit_msg>Added preview support for collisions<commit_after>vector = require "light_bomber" --change this line for other previews
local vlen = #vector
local llen = 0
for i=1,vlen do
	llen = llen + #vector[i]
end
vlen = 'Lines: ' .. vlen
llen = 'Line pieces: ' .. llen

function drawlines(lines, x, y, s, ax, ay)
	love.graphics.setLineWidth(lines.width)
	for i=1,#lines-3,2 do
		love.graphics.line(lines[i]*s*ax - lines[i+1]*s*ay + x,
		                   lines[i]*s*ay + lines[i+1]*s*ax + y,
		                   lines[i+2]*s*ax - lines[i+3]*s*ay + x,
		                   lines[i+2]*s*ay + lines[i+3]*s*ax + y)
	end
	if lines.closed then 
		local i = #lines-1
		love.graphics.line(lines[i]*s*ax - lines[i+1]*s*ay + x,
		                   lines[i]*s*ay + lines[i+1]*s*ax + y,
		                   lines[1]*s*ax - lines[2]*s*ay + x,
		                   lines[1]*s*ay + lines[2]*s*ax + y)
		if lines.fill then
		end
	end
end

local hp = .5*math.pi
function drawshape(shape, x, y, s, a)
	a = a - hp
	local ax, ay = math.cos(a), math.sin(a)
	for i,lines in ipairs(shape) do
		drawlines(lines, x, y, s, ax, ay)
	end
end

totaltime = 0
D = love.keyboard.isDown
function love.update(dt)
	totaltime = totaltime + (D' ' and 4*dt or dt)
	love.timer.sleep(22)
end

local w, h = love.graphics.getWidth()/2, love.graphics.getHeight()/2
function love.draw()
	love.graphics.print(love.timer.getFPS(), 20, 10)
	love.graphics.print(vlen, 20, 30)
	love.graphics.print(llen, 20, 50)
	love.graphics.push()
	love.graphics.translate(w, h)
	love.graphics.scale(1, -1)
	love.graphics.setColor(100, 100, 100)
	love.graphics.circle('line', 0, 0, 290, 60)
	love.graphics.setColor(255, 255, 255)
	drawshape(vector, 0 , 0, 290, totaltime*.5)
	if vector.collision then
		love.graphics.setColor(0, 0, 255)
		love.graphics.polygon('line', unpack(vector.collision))
	end
	love.graphics.pop()
end
{'fraction_non_alphanumeric': 0.16802701942020828, 'fraction_numerical': 0.040810582606248244, 'mean_word_length': 3.0386363636363636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1305934', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1420, 'n_words': 334}