Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - linuxgeek96

Pages: [1]
1
From the article:

"You usually wouldn't be suspicious of your teen keeping his or her graphing calculator close," the DEA explains. "But if you suspect them of drug addiction you may have to be." As with alarm clocks, drugs can evidently be stashed in calculator battery compartments.

https://www.washingtonpost.com/news/wonk/wp/2017/04/28/devious-teens-are-stashing-drugs-in-graphing-calculators-dea-warns/

3
Lua / HN Repost: Lua IDE
« on: August 10, 2012, 09:08:16 am »

4
TI Z80 / Intel CPU Emus
« on: July 24, 2012, 10:25:08 am »
Attached is the alpha source code of an Axe program for emulating the 4004 microprocessor by Intel. Enjoy! EDIT: The program has a bug: please remove the Pic2-6 sotred to Str1 so it works :P

5
TI-Nspire / GOLua
« on: April 09, 2012, 08:58:48 am »
Hi,

Since some people wanted my GOL code, here it is!
Code: [Select]
function on.paint(gc)
gc:setColorRGB(0,0,64)
gc:fillRect(0,0,318,212)
if j==nil then
j=8
create("bla")
end
if c=="5" then
create("bla")
c=""
elseif c=="u" then
elseif c=="p" then
pause=1
elseif c=="c" then
pause=0
elseif c=="+" then
j=j-1
c="5"
elseif c=="-" then
j=j+1
c="5"
else
for x=1,xlen do
local xs={}
if x==1 then
xs={xlen,1,2}
elseif x==xlen then
xs={xlen-1,xlen,1}
else
xs={x-1,x,x+1}
end
for y=1,ylen do
local ys={}
local n=0
if y==1 then
ys={ylen,1,2}
elseif y==ylen then
ys={ylen-1,ylen,1}
else
ys={y-1,y,y+1}
end
n=color[xs[1]][ys[1]]+color[xs[1]][ys[2]]+color[xs[1]][ys[3]]+color[xs[2]][ys[1]]+color[xs[2]][ys[3]]+color[xs[3]][ys[1]]+color[xs[3]][ys[2]]+color[xs[3]][ys[3]]
if n==3 then
buffer[x][y]=1
elseif n < 2 or n > 3 then
buffer[x][y]=0
end
end
end
end
for x=1,xlen do
for y=1,ylen do
local cell=buffer[x][y]
local lell=cell-color[x][y]
color[x][y]=cell
if lell==1 then
gc:setColorRGB(0,255,0)
elseif cell==1 and lell==0 then
gc:setColorRGB(0,128,0)
elseif lell==-1 then
gc:setColorRGB(96,32,16)
elseif cell==0 and lell==0 then
gc:setColorRGB(0,0,0)
end
gc:fillArc(x*j-0.5*j,y*j-0.5*j,0.75*j,0.75*j,0,360)
end
end
if pause==1 then
c="p"
end
--gc:drawString(debugStr,1,1,"top")
end
function on.charIn(ch)
c=ch
platform.window:invalidate()
end
function on.timer()
platform.window:invalidate()
end
function on.mouseDown(x,y)
--j=math.floor(x/318*11)
--c="5"
changePixel(x,y)
end
function on.mouseMove(x,y)
if pause==1 then
changePixel(x,y)
end
end
function changePixel(x,y)
if math.floor(x/j)>0 and math.floor(y/j)>0 then
if buffer[math.floor(x/j)][math.floor(y/j)]==1 then
buffer[math.floor(x/j)][math.floor(y/j)]=0
else
buffer[math.floor(x/j)][math.floor(y/j)]=1
end
platform.window:invalidate()
end
end
function on.save()
data = {buffer, color, j, data}
return data
end
function on.restore(data)
buffer = data[1]
color = data[2]
j = data[3]
menu = data[4]
timer.start(1)
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
toolpalette.register(menu)
--create("reset")
end
function create(mode)
t=1
timer.start(t)
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
buffer={}
color={}
for x=1,xlen do
buffer[x]={}
color[x]={}
for y=1,ylen do
if mode=="clear" then
color[x][y]=0
buffer[x][y]=0
elseif math.random()>0.5 then
color[x][y]=1
buffer[x][y]=1
else
color[x][y]=0
buffer[x][y]=0
end
end
end
reloadMenu()
debugStr=mode
end
function decTick()
t=t+0.02
timer.stop()
timer.start(t)
reloadMenu()
end
function incTick()
t=t-0.02
timer.stop()
timer.start(t)
reloadMenu()
if t<=1/15 then
t=1/15
end
end
function reset()
create("reset")
end
function reloadMenu()
menu={{"Functions",{"Reset",reset},{"Clear",clear},"-",{"t="..t,clear},{"Increase tick speed",incTick},{"Decrease tick speed",decTick}}}
toolpalette.register(menu)
end
function clear()
create("clear")
end
README:
Press p to pause and draw using mouseover (buggy), after which c will set it in mouse click draw mode, and o will resume. Press + or - to increase or decrease matrix size. Some functions are on the menu. Enjoy!
Questions and comments are welcome!

6
TI-Nspire / Minicraft / Terraria clone
« on: April 08, 2012, 05:37:51 pm »
Hi guys,

I recently began work on a minicraft like game in Lua, but I realized it was missing something (I'll give you a hint -- another dimension). I decided to make a minicraft with TERRARIA view! What do y'all think?

EDIT: here are some planning notes.
Blocks
stage1
0/nil → air (maybe vaccum?), rgb(254,254,255)
1 → dirt, rgb(150,100,50)
stage2
2 → stone, rgb(200,200,200)
3 → cobble, rgb(150,150,150)
4 → wood, rgb(150,100,50)
5 → leaf/air, rgb(100,200,100)
stage3
6 → coal (ore)
7 → coal (drop)
8 → iron (ore)
9 → iron (ingot)
10 → crafting table
11 → furnace

Ideas
store last key (instabreak to start)
sparse matrix of fixed size (to start)
UPDATE 2:
Check daily for Updates!!!
Code: [Select]
function create(mode)
t=1/2
timer.start(t)
sprites={image.new("\008\000\000\000\008\000\000\000\000\000\000\000\016\000\000\000\016\000\001\000\000\000\000\000\000\000)\165)\165\000\000\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000)\165)\165\000\000\000\000)\165\000\000)\165\000\000\000\000\000\000\000\000)\165\000\000\000\000\000\000)\165)\165)\165)\165\000\000\000\000\000\000\000\000\000\000)\165)\165\000\000\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000\000\000\000\000)\165\000\000\000\000)\165\000\000\000\000"),image.new("\008\000\000\000\008\000\000\000\000\000\000\000\016\000\000\000\016\000\001\000\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128\000\128\140\177\000\128\140\177\000\128\140\177\000\128\140\177\140\177\000\128\140\177\000\128\140\177\000\128\140\177\000\128")}
inventory={current=0,select=1,{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0},{type=0,number=0}}
i=0
view=0
position={1,1,1}
pause=0
w=316
h=210
xlen=math.floor(w/j)
ylen=math.floor(h/j)
color={}
for x=1,xlen do
color[x]={}
for y=1,xlen do
color[x][y]={}
for z=1,xlen do
color[x][y][z]={visited=false,type=0}
if y==xlen then
color[x][y][z].type=-1
elseif y<=8 then
color[x][y][z].visited=true
elseif mode=="clear" then
elseif math.random()>(y-4)/ylen then
color[x][y][z].type=1
elseif math.random()>1-y/ylen then
if math.random()>1-(y*0.25-8)/ylen then
color[x][y][z].type=4
else
color[x][y][z].type=2
end
end
end
end
end
reloadMenu()
end
function reloadMenu()
menu={{"Functions",{"Reset",reset},{"Clear",clear}}}
toolpalette.register(menu)
end
function clear()
create("clear")
end
function reset()
create("reset")
end
function on.arrowLeft()
c="4"
end
function left()
if (position[1]~=1 and view~=1) then
position[1]=position[1]-1
elseif (position[2]~=1 and view==1) then
position[2]=position[2]-1
end
end
function on.arrowRight()
c="6"
end
function right()
if (position[1]~=xlen and view~=1) then
position[1]=position[1]+1
elseif (position[2]~=xlen and view==1) then
position[2]=position[2]+1
end
end
function on.arrowDown()
c="2"
end
function down()
if (position[3]~=ylen and view~=2) then
position[3]=position[3]+1
elseif (position[2]~=ylen and view==2) then
position[2]=position[2]+1
end
end
function on.arrowUp()
c="8"
end
function up()
if (position[3]~=1 and view~=2) then
position[3]=position[3]-1
elseif (position[2]~=1 and view==2) then
position[2]=position[2]-1
end
end
function pickColor(top,d)
local t = {255,0,0}
if top==0 then
t = {255*d,255*d,255*d}
elseif top==1 then
t = {150*d,100*d,50*d}
elseif top==2 then
t = {150*d,150*d,150*d}
elseif top==3 then
t = {200*d,200*d,200*d}
elseif top==4 then
t ={175*d,100*d,0}
end
return t
end
function calcFog(x,y,z,position)
local d
if not color[x][y][z].visited then
d = math.sqrt((x-position[1])*(x-position[1])+(y-position[2])*(y-position[2])*4+(z-position[3])*(z-position[3]))
d=1-(d/xlen*4)
if d<0 then
d=0
elseif d>1 then
d=1
end
else
d=1
end
return d
end
function on.charIn(ch)
c=ch
end
function on.timer()
platform.window:invalidate()
end
function on.mouseDown(x,y)
local coords={position[1],position[2],position[3]}
if view==0 then
coords[1]=math.ceil(x/j)
coords[3]=math.ceil(y/j)
elseif view==1 then
coords[2]=math.ceil(x/j)
coords[3]=math.ceil(y/j)
elseif view==2 then
coords[1]=math.ceil(x/j)
coords[2]=math.ceil(y/j)
end
if color[coords[1]][coords[2]][coords[3]].type==0 and inventory[inventory.select].number>0 then
color[coords[1]][coords[2]][coords[3]].type=inventory[inventory.select].type
inventory[inventory.select].number=inventory[inventory.select].number-1
end
end
function on.paint(gc)
gc:setColorRGB(0,0,64)
gc:fillRect(0,0,316,210)
if j==nil then
j=8
create("clear")
end
--Keypresses and d-pad
if c=="." then
if view==2 then
view = 0
else
view=view+1
end
elseif c=="1" then
down()
left()
elseif c=="2" then
down()
elseif c=="3" then
down()
right()
elseif c=="4" then
left()
elseif c=="6" then
right()
elseif c=="7" then
up()
left()
elseif c=="8" then
up()
elseif c=="9" then
up()
right()
elseif c=="a" then
inventory.select=1
elseif c=="b" then
inventory.select=2
elseif c=="c" then
inventory.select=3
elseif c=="d" then
inventory.select=4
elseif c=="e" then
inventory.select=5
elseif c=="f" then
inventory.select=6
elseif c=="g" then
inventory.select=7
end
if c then
c=""
end

--Gravity
i=1-i
if i==1 and  color[position[1]][position[2]+1][position[3]] .type==0 then
position[2]=position[2]+1
end

--Lighting / shroud
for x=-1,1 do
for y=-1,1 do
for z=-1,1 do
if not ((x==-1 and position[1]==1) or (y==-1 and position[2]==1) or (z==-1 and position[3]==1) or (x==1 and position[1]==xlen) or (y==1 and position[2]==xlen) or (z==1 and position[3]==xlen)) then
color[position[1]+x][position[2]+y][position[3]+z].visited=true
end
end
end
end

--Inventory/mining
if color[position[1]][position[2]][position[3]].type>0 then
local slot=inventory.current+1
for i=1,inventory.current do
if inventory[i].type==color[position[1]][position[2]][position[3]].type then
slot=i
end
end
if not inventory[slot].type or
inventory[slot].type==0 then
inventory.current=inventory.current+1
inventory[slot].type=color[position[1]][position[2]][position[3]].type
inventory[slot].number=1
else inventory[slot].number=inventory[slot].number+1
end
color[position[1]][position[2]][position[3]].type=0
end

--Draw tiles
if view==0 then
for x=1,xlen do
for z=1,ylen do
local top=1
for y=position[2],xlen do
if top==1 and color[x][y][z].type~=0 then
top=y
end
end
local type=color[x][top][z].type
if type>0 then
local triple=pickColor(type,calcFog(x,top,z,position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(x*j-j*0.5,z*j-j*0.5,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],x*j-j*0.5,z*j-j*0.5)
end
if x==position[1] and z==position[3] then
gc:drawImage(sprites[1],x*j-j*0.5,z*j-j*0.5)
end
end
end
elseif view==1 then
for y=1,xlen do
for z=1,ylen do
local type=color[position[1]][y][z].type
if type>0 then
local triple = pickColor( color[position[1]][y][z].type, calcFog(position[1],y,z,position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(y*j-j*0.5,z*j-j*0.5,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],y*j-j*0.5,z*j-j*0.5)
end
if y==position[2] and z==position[3] then
gc:drawImage(sprites[1],y*j-j*0.5,z*j-j*0.5)
end
end
end
elseif view==2 then
for x=1,xlen do
for y=1,ylen do
local type=color[x][y][position[3]].type
if type>0 then
local triple=pickColor(type,calcFog(x,y,position[3],position))
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(x*j-0.5*j,y*j-0.5*j,j,j)
elseif type==-1 then
gc:drawImage(sprites[2],x*j-j*0.5,y*j-j*0.5)
end
if x==position[1] and y==position[2] then
gc:drawImage(sprites[1],x*j-j*0.5,y*j-j*0.5)
end
end
end
end
--Inventory overlay
for x=1,7 do
local triple=pickColor(inventory[x].type,1)
gc:setColorRGB(triple[1],triple[2],triple[3])
gc:fillRect(118+x*10,195,10,10)
gc:setColorRGB(0,0,0)
gc:drawString(inventory[x].number,120+x*10,189,"top")
end
gc:setColorRGB(255,255,255)
gc:drawString("("..position[1]..","..position[2]..","..position[3]..")",0,0,"top")
end

Pages: [1]