<commit_before>#!/usr/bin/env ruby

require 'RUDL'; include RUDL; include Constant

display=DisplaySurface.new [400, 400]

bitmap1=Surface.new [20,20]
bitmap2=Surface.new [40,40]

bitmap1.line [0,0], [20,20], [255,255,255]
bitmap1.line [10,10], [0,15], [255,255,255]
bitmap1.set_colorkey [0,0,0]
bitmap1.collision_map=CollisionMap.new(bitmap1)

bitmap2.ellipse [20,20], 19, 19, [255,255,255]
bitmap2.ellipse [20,20], 18, 19, [255,255,255]
bitmap2.ellipse [20,20], 19, 18, [255,255,255]
bitmap2.ellipse [20,20], 18, 18, [255,255,255]
bitmap2.set_colorkey [0,0,0]
bitmap2.collision_map=CollisionMap.new(bitmap2)

keys=nil

x,y=70,70

begin
	EventQueue.pump
	keys=Key.pressed?
	x-=1 if keys[K_LEFT]
	x+=1 if keys[K_RIGHT]
	y-=1 if keys[K_UP]
	y+=1 if keys[K_DOWN]
	display.fill [0,0,0]
	display.blit bitmap1, [x,y]
	display.blit bitmap2, [100,100]
	if bitmap1.collision_map.collides_with([x,y], bitmap2.collision_map, [100,100])
		display.print [0,0], 'collision!', 0xffffffff
	end
	display.flip
end until keys[K_ESCAPE]<commit_msg>Added a delay to avoid busy looping and limit speed<commit_after>#!/usr/bin/env ruby

require 'RUDL'; include RUDL; include Constant

display=DisplaySurface.new [400, 250]

bitmap1=Surface.new [20,20]
bitmap2=Surface.new [40,40]

bitmap1.line [0,0], [20,20], [255,255,255]
bitmap1.line [10,10], [0,15], [255,255,255]
bitmap1.set_colorkey [0,0,0]
bitmap1.collision_map=CollisionMap.new(bitmap1)

bitmap2.ellipse [20,20], 19, 19, [255,255,255]
bitmap2.ellipse [20,20], 18, 19, [255,255,255]
bitmap2.ellipse [20,20], 19, 18, [255,255,255]
bitmap2.ellipse [20,20], 18, 18, [255,255,255]
bitmap2.set_colorkey [0,0,0]
bitmap2.collision_map=CollisionMap.new(bitmap2)

keys=nil

x,y=70,70

while true
    ev=EventQueue.poll
    exit if ev.is_a? QuitEvent

    Timer.delay(5)

    keys=Key.pressed?
    exit if keys[K_ESCAPE]
    x-=1 if keys[K_LEFT]
    x+=1 if keys[K_RIGHT]
    y-=1 if keys[K_UP]
    y+=1 if keys[K_DOWN]

    display.fill [0,0,0]
    display.blit bitmap1, [x,y]
    display.blit bitmap2, [100,100]

    if bitmap1.collision_map.collides_with([x,y], bitmap2.collision_map, [100,100])
        display.print [10,10], 'collision!', 0xffffffff
    end

    display.flip
end
{'fraction_non_alphanumeric': 0.16659121774558625, 'fraction_numerical': 0.14893617021276595, 'mean_word_length': 5.242937853107344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '5792835', 'n_tokens_mistral': 1153, 'n_tokens_neox': 987, 'n_words': 189}