Posted 18 August 2012 - 04:39 PM
This is something I hadn't intended to post, it's just a little thing but it's quite nice so why not.
Stick this on a computer, best when attached to a monitor and run it- it will display a little analogue clock. The longer hand refers to each of the 24 minutes that make up a minecraft "day", while the smaller hand for 12 days, because well I guess that's how a usual clock works. Would probably make more sense to have this correspond to the lunar cycle in minecraft… well if you want to do that just change the various 12's with however many phases the moon goes through. Edit: have made this change.
What makes it a bit cool is the graphics are entirely dynamic- trig is used to determine the display for the clock round and the hands so it will fit any size or screen ratio, which is kind of cool. It was designed for 6x6 and slightly off screen ratios look a bit squashy but I was quite partial to 1x2- makes me think of those really expensive watches girls sometimes wear.
The smallest and least impressive of apps but hey, nice little thing to stick on an empty monitor to keep track of time. It also demonstrates that you really can solve problems with math- I guess you really did have the last laugh Mr. Whiffen.
local w,h = term.getSize()
local ttfl = (os.time()/24) * 2 * math.pi
local day = ttfl/8
function printFrame()
for i=0,math.pi*2,math.pi/128 do
local xco = math.cos(i) * w/2 + w/2 + 1
local yco = math.sin(i) * h/2 + h/2 + 1
term.setCursorPos(xco,yco)
term.write("*")
end
end
function printHands()
local ttf = (os.time()/24) * math.pi * 2
local inc = ttf - ttfl
if ttf < ttfl then inc = 1 + ttf - ttfl end
day = day + inc/8
day = day % (math.pi * 2)
ttfl = ttf
for i=0,0.9,0.05 do
local xco = math.cos(ttf-math.pi/2) * w/2 * i + w/2 + 1
local yco = math.sin(ttf-math.pi/2) * h/2 * i + h/2 + 1
term.setCursorPos(xco,yco)
term.write("&")
end
for i=0,0.5,0.05 do
local xco = math.cos(day-math.pi/2) * w/2 * i + w/2 + 1
local yco = math.sin(day-math.pi/2) * h/2 * i + h/2 + 1
term.setCursorPos(xco,yco)
term.write("#")
end
end
while true do
term.clear()
printFrame()
printHands()
sleep(1)
end
Stick this on a computer, best when attached to a monitor and run it- it will display a little analogue clock. The longer hand refers to each of the 24 minutes that make up a minecraft "day", while the smaller hand for 12 days, because well I guess that's how a usual clock works. Would probably make more sense to have this correspond to the lunar cycle in minecraft… well if you want to do that just change the various 12's with however many phases the moon goes through. Edit: have made this change.
What makes it a bit cool is the graphics are entirely dynamic- trig is used to determine the display for the clock round and the hands so it will fit any size or screen ratio, which is kind of cool. It was designed for 6x6 and slightly off screen ratios look a bit squashy but I was quite partial to 1x2- makes me think of those really expensive watches girls sometimes wear.
The smallest and least impressive of apps but hey, nice little thing to stick on an empty monitor to keep track of time. It also demonstrates that you really can solve problems with math- I guess you really did have the last laugh Mr. Whiffen.