Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --spring + summer
- forecast = {
- 'sunny',
- 'partly cloudy',
- 'mostly cloudy',
- 'overcast',
- 'sunny',
- 'light rain',
- 'rain',
- 'heavy rain with a chance of lightning'
- }
- while true do
- clouds = math.random(4)
- precip = math.random(2)
- temp = math.random(70,90)
- cmd = io.read()
- if cmd == 'exit' then
- break
- end
- local v = clouds*precip
- temp = temp + ((v-4<0) and math.random((v-4)*3,0) or math.random(0,(v-4)*3))
- print(
- "Today's weather will be " ..
- forecast[v] ..
- " with a temperature of " ..
- temp ..
- "."
- )
- end
Advertisement
Add Comment
Please, Sign In to add comment