[ create a new paste ] login | about

Link: http://codepad.org/SLqvjLYF    [ raw code | output | fork ]

Lua, pasted on Aug 12:
--Halfed Assed Calender
math.randomseed(os.time())
math.randomseed(os.time())
math.randomseed(os.time())
local bh=os.date("%I")
local bm=os.date("%m")
local wdm=os.date("%d")
local cdw=os.date("%w")
local bsm=os.date("%M")
local hh=tonumber(os.date("%H"))
local function tp(t)
	for i=1,#t do
		for k= 1, #t[i] do
			io.write(t[i][k])
		end
		print()
	end
end

local function s2a(s)
	local ns = {}
	for i=1, #s do
		local nns={}
		for k = 1, string.len(s[i]) do
			table.insert(nns, string.sub(s[i],k,k))
		end
		table.insert(ns,nns)
	end
	return ns
end



function ca(bg, a, x,y)
	ntb={} lbg=#bg la=#a lax=#a[1] lbgx=#bg[1]
	if lbgx-((lax+y)-1)<0 then
	elseif lbg-((la+x)-1)<0 then
	else
		for i=1,la do
			for j = 1, lax do
				if " "==a[i][j] then
				else
					table.remove(bg[x+(i-1)],y+(j-1))
					table.insert(bg[x+(i-1)],y+(j-1), a[i][j])
				end
			end
		end
	end
	return bg
end
f=s2a({" ________________________________________________________________ ","|\\ ____________________________________________________________ /|","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |____________________________________________________________| |","|/______________________________________________________________\\|"})
boat=s2a({"    _    ","   /|\\     ","  / | \\   "," /__|__\\  ","____|____ ","\\_______/  "})
ccc=s2a({"   ___  "," _(   ) ","(___)__)"})
water=s2a({"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"})
tblock=s2a({"xxx","xxx","xxx"})
temp=ca(f,water,19-bh,4)
if hh<18 and hh>= 6 then
	n=bm sb = {{"-",".","-"}}
else
	n=3*bm sb={{"*"}}
end

for i = 1,n do
	r1=math.random(14 -bh)
	r2=math.random(59)
	temp=ca(temp,sb,r1+3,r2+3)
end
if cdw==0 then
else
	for i=1,cdw do
		r1=math.random(11-bh)
		r2=math.random(52)
		temp=ca(temp,ccc,r1+3,r2+3)
	end
end
temp=ca(temp,boat,14-bh, bsm)
tp(temp)


Output:
 ________________________________________________________________ 
|\ ____________________________________________________________ /|
| |                                                            | |
| |       -.-                                                  | |
| |                                                            | |
| |                                        ___                 | |
| |                                      _(   )                | |
| |                  -.-   -.-          (___)__)               | |
| |                                                            | |
| |                            -.-             _        ___    | |
| |          -.-                              /|\     _(   )   | |
| |              -.-                         / | \   (___)__)  | |
| |                                         /__|__\ -.-.-      | |
| |                                        ____|____           | |
| |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\_______/~~~~~~~~~~~| |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|


Create a new paste based on this one


Comments: