<commit_before>
import libtcodpy as libtcod
import os

try:  #import NumPy
	from numpy import *
except ImportError:
	raise ImportError('----- NumPy must be installed. -----')


#size of the screen, in tiles
SCREEN_W = 80
SCREEN_H = 50
HALF_W = SCREEN_W / 2
HALF_H = SCREEN_H / 2


#initialize libtcod
libtcod.console_set_custom_font(os.path.join('arial10x10.png'),
	libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_W, SCREEN_H, 'libtcod sample', False)
 
 
#the coordinates of all tiles in the screen, as numpy arrays.
#NOTE: combining these with regular numbers will effectively transform all pixels
#based on their coordinates. they look like this with a 4x3 pixels screen:
#xg = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
#yg = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]
(x, y) = meshgrid(range(SCREEN_W), range(SCREEN_H))

lights = []
lights.append({'x': 40,'y': 20,'brightness': 4.0}) #MUST BE FLOATS
lights.append({'x': 20,'y': 20,'brightness': 3.0})

while not libtcod.console_is_window_closed():
	key = libtcod.console_check_for_keypress()
	if key.vk == libtcod.KEY_ESCAPE: break
	
	_R = zeros((SCREEN_H,SCREEN_W))
	_G = zeros((SCREEN_H,SCREEN_W))
	_B = zeros((SCREEN_H,SCREEN_W))
	#_R = add(_R,255)
	#_G = add(_G,255)
	#_B = add(_B,255)
	_render = zeros((SCREEN_H,SCREEN_W))
	
	for light in lights:
		if lights.index(light) == 0:
			light['x'] -= 0.01
		
		sqr_distance = (x - light['x'])**2 + (y - light['y'])**2
		
		brightness = light['brightness'] / sqr_distance
		brightness = clip(brightness * 255, 0, 255)
		
		_R = add(brightness,_R).clip(0,255)
		_G = add(brightness,_G).clip(0,255)
		_B = add(brightness,_B).clip(0,255)
	
	libtcod.console_fill_background(0, _R, _G, _B)	
	print libtcod.sys_get_fps()
	libtcod.console_flush()
<commit_msg>Still messing around. Saving for now<commit_after>
import libtcodpy as libtcod
import os

try:  #import NumPy
	from numpy import *
except ImportError:
	raise ImportError('----- NumPy must be installed. -----')


#size of the screen, in tiles
SCREEN_W = 80
SCREEN_H = 50
HALF_W = SCREEN_W / 2
HALF_H = SCREEN_H / 2


#initialize libtcod
libtcod.console_set_custom_font(os.path.join('arial10x10.png'),
	libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD)
libtcod.console_init_root(SCREEN_W, SCREEN_H, 'libtcod sample', False)
 
 
#the coordinates of all tiles in the screen, as numpy arrays.
#NOTE: combining these with regular numbers will effectively transform all pixels
#based on their coordinates. they look like this with a 4x3 pixels screen:
#xg = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
#yg = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]
(x, y) = meshgrid(range(SCREEN_W), range(SCREEN_H))

lights = []
lights.append({'x': 40,'y': 20,'brightness': 4.0}) #MUST BE FLOATS
lights.append({'x': 20,'y': 20,'brightness': 3.0})

while not libtcod.console_is_window_closed():
	key = libtcod.console_check_for_keypress()
	if key.vk == libtcod.KEY_ESCAPE: break
	
	_R = zeros((SCREEN_H,SCREEN_W))
	_G = zeros((SCREEN_H,SCREEN_W))
	_B = zeros((SCREEN_H,SCREEN_W))
	#_R = add(_R,255)
	#_G = add(_G,255)
	#_B = add(_B,255)
	render = zeros((SCREEN_H,SCREEN_W))
	
	for light in lights:
		if lights.index(light) == 0:
			light['x'] -= 0.01
		
		sqr_distance = (x - light['x'])**2 + (y - light['y'])**2
		
		brightness = light['brightness'] / sqr_distance
		brightness = clip(brightness * 255, 0, 255)
		
		render = add(brightness,render).clip(0,255)
	
		_R = add(brightness,_R).clip(0,255)
	#_G = add(brightness,_G).clip(0,255)
	#_B = add(brightness,_B).clip(0,255)
	
	libtcod.console_fill_background(0, _R, render, render)	
	print libtcod.sys_get_fps()
	libtcod.console_flush()

{'fraction_non_alphanumeric': 0.15885558583106266, 'fraction_numerical': 0.04632152588555858, 'mean_word_length': 4.604580152671756, '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': '3799759', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1511, 'n_words': 371}