UFA's here! (User-Free Applications)
Moderators: Shine, Insert_witty_name
UFA's here! (User-Free Applications)
You know you've made them... random text creator, pixel mover... it's just fun! Well, if you're proud of any of your UFA's, go ahead and link us to them, and if you can, provide a screenshot so we're not downloading the same thing we just made! XD
Here's mine -
[Coral Draw - download]
Description -
Draws in random directions from random beginning with only limits to the screen size. Includes timer, and automatically screenshots every minute. Might wanna get a file manager, since after 30 minutes, the pictures take up more than a megabyte. [EDIT] Screenshot was taken when it was in "beta," now has a battery bar, and a display of seconds/minutes/hours passed since the program began.
Here's mine -
[Coral Draw - download]
Description -
Draws in random directions from random beginning with only limits to the screen size. Includes timer, and automatically screenshots every minute. Might wanna get a file manager, since after 30 minutes, the pictures take up more than a megabyte. [EDIT] Screenshot was taken when it was in "beta," now has a battery bar, and a display of seconds/minutes/hours passed since the program began.
Re: UFA's here! (User-Free Applications)
You might be interested in my cellular automata: http://www.frank-buss.de/automaton/ especially Arabasek, Game Of Life and the tetracaidecahedron idea. Should be really easy to convert it to Lua.
Another fascinating concept is Langtons Ant: http://www.frank-buss.de/tmp/ameise.html
Another fascinating concept is Langtons Ant: http://www.frank-buss.de/tmp/ameise.html
After going through some specifications, I have finally made a good Langton's Ant program! :)
Langton's Ant
[Download Here]
Description - Ant begins at a random place on the screen. If the square it is on is black, it turns right, moves forward, and makes the square he was on white. It is the opposite with a white square. After about 10000 iterations, the ant will begin to make what is called a "highway," which is a pattern in which he makes a path in a up-right, down-right, up-left, or down-left direction. Each segment of the path takes 104 iterations.
Controls:
Triangle - Screenshot
Select - Inverts colors
R + L - Clears screen (only to black)
Start - Exits
Note: I will be taking suggestions, such as incrementing screenshots, etc. Also, if you want to optimize my code, please do, I haven't really had the time.
Langton's Ant
[Download Here]
Description - Ant begins at a random place on the screen. If the square it is on is black, it turns right, moves forward, and makes the square he was on white. It is the opposite with a white square. After about 10000 iterations, the ant will begin to make what is called a "highway," which is a pattern in which he makes a path in a up-right, down-right, up-left, or down-left direction. Each segment of the path takes 104 iterations.
Controls:
Triangle - Screenshot
Select - Inverts colors
R + L - Clears screen (only to black)
Start - Exits
Note: I will be taking suggestions, such as incrementing screenshots, etc. Also, if you want to optimize my code, please do, I haven't really had the time.
Nice. What about more than one ant?Kameku wrote:After going through some specifications, I have finally made a good Langton's Ant program! :)
Langton's Ant
Code: Select all
function even(num)
return num - math.mod(num, 2)
end
math.randomseed(os.time())
black = Color.new(0,0,0)
white = Color.new(255,255,255)
blue = Color.new(0,0,255)
red = Color.new(255,0,0)
green = Color.new(0,255,0)
ants = {}
colors = { red, green, blue }
for i = 1, 3 do
ants[i] = {
x = even((math.random(480) + 240) / 2),
y = even((math.random(272) + 136)) / 2,
dir = 0,
color = colors[i]
}
end
canvas = Image.createEmpty(482, 274)
canvas:clear(black)
iter = 1
screenNumber = 0
function shadow(x, y, text, c1, c2)
screen:print(x - 1, y, text, c2)
screen:print(x, y - 1, text, c2)
screen:print(x + 1, y, text, c2)
screen:print(x + 1, y + 1, text, c2)
screen:print(x + 1, y - 1, text, c2)
screen:print(x + 2, y, text, c2)
screen:print(x, y + 1, text, c2)
screen:print(x, y, text, c1)
screen:print(x + 1, y, text, c1)
end
while true do
pad = Controls.read()
if pad:start() then break end
if pad:triangle() then
screen:blit(-1, -1, canvas)
screen.flip()
screen:save("screenshot.png")
end
if pad:r() and pad:l() then
canvas:clear(black)
iter = 1
end
oldpad = pad
for i = 1, 3 do
ant = ants[i]
if canvas:pixel(ant.x,ant.y) == black then
ant.dir = ant.dir + 1
if ant.dir == 4 then ant.dir = 0 end
else
ant.dir = ant.dir - 1
if ant.dir == -1 then ant.dir = 3 end
end
ant.oldx = ant.x
ant.oldy = ant.y
if ant.dir == 0 then ant.x = ant.x + 2 end
if ant.dir == 2 then ant.x = ant.x - 2 end
if ant.dir == 1 then ant.y = ant.y + 2 end
if ant.dir == 3 then ant.y = ant.y - 2 end
if ant.x > 480 then ant.x = 0 end
if ant.x < 0 then ant.x = 480 end
if ant.y > 272 then ant.y = 0 end
if ant.y < 0 then ant.y = 272 end
if canvas:pixel(ant.oldx, ant.oldy) == black and
canvas:pixel(ant.oldx + 1, ant.oldy) == black and
canvas:pixel(ant.oldx, ant.oldy + 1) == black and
canvas:pixel(ant.oldx + 1, ant.oldy + 1) == black then
canvas:fillRect(ant.oldx, ant.oldy, 2, 2, ant.color)
else
canvas:fillRect(ant.oldx, ant.oldy, 2, 2, black)
end
end
screen:clear()
screen:blit(-1, -1, canvas)
for i = 1, 3 do
ant = ants[i]
screen:fillRect(ant.x-1, ant.y-1, 3, 3, white)
end
shadow(2, 262, "Step: " .. iter, black, white)
screen.flip()
--screen.waitVblankStart()
iter = iter + 1
-- if math.mod(iter, 200) == 0 then
-- screen:save("screenshot" .. screenNumber .. ".png")
-- screenNumber = screenNumber + 1
-- end
end
-
- Posts: 13
- Joined: Sat Apr 15, 2006 11:19 am
buwahaha my first LUA project... yes i ganked some code for screenshots, iteration count, and that nice little shadow function...
luckily i cleaned it up alot, and reduced the size to nothing, i intend to add functionality to dynamically change the number of "organisms" with up/down arrow functionality... we'll see...
luckily i cleaned it up alot, and reduced the size to nothing, i intend to add functionality to dynamically change the number of "organisms" with up/down arrow functionality... we'll see...
Code: Select all
-- Demonstration No-User-App
-- Author: RanDom_ErrOr
-- Copyright 2006
-- No liscense with this product what so ever. Use at your own risk. I will accept no liability or responsibility if you **** something up.
System.usbDiskModeActivate()
screenwidth = 480
screenheight = 272
organisms =150 -- set this to what ever value you want...
letter = "o"
black = Color.new(0,0,0)
screennum = 0
math.random(1,272) }
organism = { }
color = { }
iter = 1
function shadow(x, y, text, c1, c2)
screen:print(x - 1, y, text, c2)
screen:print(x, y - 1, text, c2)
screen:print(x + 1, y, text, c2)
screen:print(x + 1, y + 1, text, c2)
screen:print(x + 1, y - 1, text, c2)
screen:print(x + 2, y, text, c2)
screen:print(x, y + 1, text, c2)
screen:print(x, y, text, c1)
screen:print(x + 1, y, text, c1)
end
white = Color.new(255,255,255)
math.randomseed(os.time() )
for i=1,organisms do
color[i] = {color = Color.new(math.random(0,255), math.random(0,255), math.random(0,255)) }
organism[i] = {posx = math.random(1,480), posy = math.random(1,272) }
end
while true do
pad = Controls.read()
if pad:start() then break end
if pad:triangle() then
screen.flip()
screen:save("screenshot".. screennum..".png")
screennum = screennum + 1
end
if pad:r() and pad:l() then
screen:clear(black)
iter = 1
end
for i=1,organisms do
x = organism[i].posx
y = organism[i].posy
screen:print(x,y,letter,color[i].color)
organism[i].posx = organism[i].posx + math.random(-1,1)
organism[i].posy = organism[i].posy + math.random(-1,1)
if organism[i].posx >= screenwidth or organism[i].posx <= 0 then
organism[i].posx = math.random(1,480)
end
if organism[i].posy >= screenheight or organism[i].posy <= 0 then
organism[i].posy = math.random(1,272)
end
end
shadow(2, 262, "Step: " .. iter, black, white)
screen.flip()
iter = iter + 1
end
while true do
screen.waitVblankStart()
end
-
- Posts: 13
- Joined: Sat Apr 15, 2006 11:19 am
i want to figure out a way to do some blurring after the text has been added... but yet have seen any code or any reference on how to do it... i dont know, i just want to have some fun and use this as a tool on how to learn more of LUA.... With my (very very) limited programming experience (mainly PHP CSS and HTML) its not too hard to figure out things like syntax etc...
my only issues with LUA at this point in time are the things i just dont know... but i'm learning as i go, so it cant be all that bad.... >_>;
btw, im trying to figure out FPS (or iterations persecond...)
and my current code for it is as such
clock = Timer.new(0)
currenttime = clock:time()
fpscurrent = iter (iterations) / currenttime * 100
now im getting ~ 6FPS using waitforVsync within the same loop as screen:flip() but if i remove it, i boost my FPS to about 15FPS... (depending of course on number of organisms...) at 1500 organisms im getting 6.5-6.6~ FPS with the waitforVsync outside the loop... also runs very smooth...
I notice i dont get over ~ 15.5 FPS even with a single organism...
who knows...
btw revised code follows...
too bad this method is flawed... /cry anyone have a slightly more accurate way of counting iterations per second in real time? w/o having slight clock inaccuracies...? (i.e if you reset the display with L and R it displays crazy numbers... /cry)
oh an interesting use for this application... stuck pixel unsticker... theoretically it should work >>; anyone want to give it a whirl and see if it works? hehe, at very least, its more pleasing on the eyes than a RGB flasher is... :x
my only issues with LUA at this point in time are the things i just dont know... but i'm learning as i go, so it cant be all that bad.... >_>;
btw, im trying to figure out FPS (or iterations persecond...)
and my current code for it is as such
clock = Timer.new(0)
currenttime = clock:time()
fpscurrent = iter (iterations) / currenttime * 100
now im getting ~ 6FPS using waitforVsync within the same loop as screen:flip() but if i remove it, i boost my FPS to about 15FPS... (depending of course on number of organisms...) at 1500 organisms im getting 6.5-6.6~ FPS with the waitforVsync outside the loop... also runs very smooth...
I notice i dont get over ~ 15.5 FPS even with a single organism...
who knows...
btw revised code follows...
Code: Select all
-- Demonstration No-User-App
-- Author: RanDom_ErrOr
-- Copyright 2006
-- No liscense with this product what so ever. Use at your own risk. I will accept no liability or responsibility if you **** something up.
System.usbDiskModeActivate()
clock = {}
clock = Timer.new(0)
screenwidth = 482
screenheight = 274
organisms =1500
letter = "o"
black = Color.new(0,0,0)
red = Color.new (255,0,0)
white = Color.new(255,255,255)
canvas = Image.createEmpty(480,272)
canvas:clear(black)
screennum = 0
organism = { }
color = { }
iter = 1
fpscurrent = 1
speed = 5
function shadow(x, y, text, c1, c2)
screen:print(x - 1, y, text, c2)
screen:print(x, y - 1, text, c2)
screen:print(x + 1, y, text, c2)
screen:print(x + 1, y + 1, text, c2)
screen:print(x + 1, y - 1, text, c2)
screen:print(x + 2, y, text, c2)
screen:print(x, y + 1, text, c2)
screen:print(x, y, text, c1)
screen:print(x + 1, y, text, c1)
end
white = Color.new(255,255,255)
math.randomseed(os.time() )
for i=1,organisms do
color[i] = {color = Color.new(math.random(0,255), math.random(0,255), math.random(0,255)) }
organism[i] = {posx = math.random(1,480), posy = math.random(1,272) }
end
while true do
pad = Controls.read()
if pad:up() then
speed = speed + 1
if speed >= 15 then
speed = 15
end
end
if pad:down() then
speed = speed - 1
if speed <= 1 then
speed = 1
end
end
if pad:start() then
break
end
if pad:triangle() then
screen:blit(-1,-1,canvas)
screen.flip()
screen:save("screenshot".. screennum..".png")
screennum = screennum + 1
end
if pad:r() and pad:l() then
canvas:clear(black)
iter = 1
end
for i=1,organisms do
x = organism[i].posx
y = organism[i].posy
canvas:print(x,y,letter,color[i].color)
organism[i].posx = organism[i].posx + math.random(-speed,speed)
organism[i].posy = organism[i].posy + math.random(-speed,speed)
if organism[i].posx >= screenwidth or organism[i].posx <= 0 then
organism[i].posx = math.random(1,480)
end
if organism[i].posy >= screenheight or organism[i].posy <= 0 then
organism[i].posy = math.random(1,272)
end
end
screen:clear()
screen:blit(-1,-1,canvas)
shadow(2, 262, "Step: " .. iter, black, white)
currenttime = clock:time()
fpscurrent = iter / currenttime * 100
shadow(2,2,"Frames Per Second: " .. fpscurrent,red, white)
shadow(2,11, "Speed: " .. speed, red, white)
shadow(2,20, "Organisms: " .. organisms, red,white)
screen.flip()
iter = iter + 1
end
while true do
screen.waitVblankStart()
end
oh an interesting use for this application... stuck pixel unsticker... theoretically it should work >>; anyone want to give it a whirl and see if it works? hehe, at very least, its more pleasing on the eyes than a RGB flasher is... :x
-
- Posts: 13
- Joined: Sat Apr 15, 2006 11:19 am
i tried that, but both iteration and timer are the same so it just does 1/1*100 and it just keeps going more and more... im just going to ignore it, and say FSCK it... i was just curious how many loops per second it was doing...
considering 6~7 * 1500 = 9000-11500 characters displayed per second... thats not too bad... (well, its not great, but still, not too bad for how this has been coded...)
considering 6~7 * 1500 = 9000-11500 characters displayed per second... thats not too bad... (well, its not great, but still, not too bad for how this has been coded...)