Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 08/12/2015
- --Last update: 22/05/2016
- --[[ Notes:
- Does:
- Mostra quantos % de anjo e de vagabundo você tem de acordo com a data de nascimento.
- Args:
- day --> Caso seja número, deverá ser DD do dia de nascimento, caso seja string, deverá ser "DD/MM/AAAA"
- month --> Caso day seja número, deverá ser MM do mês de nascimento.
- year --> Caso day seja número, deverá ser AAAA do ano de nascimento.
- Desafio:
- http://s2.glbimg.com/Hm5CL7z8G9WyqANaJnCDGeC88LI=/s.glbimg.com/jo/g1/f/original/2015/12/07/safadao_questao_materia.jpg
- ]]--
- somatorio=function(x)
- if x == 0 then return 0 end
- return x + somatorio(x-1)
- end
- wesley_safadao=function(day,month,year)
- if type(day) == "string" then
- day,month,year = day:match("(%d+)/(%d+)/(%d+)")
- if not day or not month or not year then error("Data inválida") end
- if #year > 2 then year=year:sub(3) end
- end
- day,month,year = tonumber(day),tonumber(month),#tostring(year) > 2 and tonumber(tostring(year):sub(3)) or tonumber(year)
- local anjo,vagabundo = 0,0
- if day == 6 and month == 9 and year == 96 then
- anjo,vagabundo = 99,1
- else
- vagabundo = somatorio(month)+(year/100)*(50-day)
- anjo = 100-vagabundo
- end
- if vagabundo+anjo == 100 and vagabundo>0 and vagabundo<100 and anjo>0 and anjo<100 then
- print("\nAnjo: "..anjo.."%\nVagabundo: "..vagabundo.."%\n\n\"[...] Tô namorando todo mundo, "..anjo.."% anjo, perfeito\nMas aquele "..vagabundo.."% é vagabundo\nMas aquele "..vagabundo.."% é vagabundo\nSafado e elas gostam.. [...]\"")
- else
- error("Erro de calculo")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement