Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = 0
- local c = 0
- local memo = {}
- local memois = {}
- local num = 1
- function memory(one,two,three)
- if one=="learn" then
- memo[num] = two
- memois[num] = three
- print("AI> I learn: when you say '"..memo[num].."' I say "..memois[num])
- num= num+1
- end
- if one=="remember" then
- for i=1, num do
- if memo[i]==two then
- return memois[i]
- end
- end
- end
- if one=="know" then
- for i=1, num do
- if memo[i]==two then
- return true
- end
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- function complain()
- if c > 4 then
- c = 0
- end
- if c == 0 then
- print("AI> What aren't you talking to me?")
- end
- if c == 1 then
- print("AI> Stop it!")
- end
- if c == 2 then
- print("AI> You're being a jerk!")
- end
- if c == 3 then
- print("AI> Alright fine. I won't talk to you either!")
- end
- if c == 4 then
- print("AI> That's it! Bye!")
- error("ragequit")
- end
- end
- function thanks()
- if t > 4 then
- t = 0
- end
- if t == 0 then
- print("AI> Okay. Thanks.")
- end
- if t == 1 then
- print("AI> Oh cool.")
- end
- if t == 2 then
- print("AI> Thanks!")
- end
- if t == 3 then
- print("AI> Alright.")
- end
- if t == 4 then
- print("AI> Never mind...")
- end
- c = 0
- end
- print("AI> Hello!")
- while true do
- write("ME> ")
- message = read()
- if message == "" then
- complain()
- c = c + 1
- else
- if not memory("know", message, "nil") then
- local ma = message
- print("AI> What i shoud say when you say '"..message.."'?")
- write("ME> ")
- message = read()
- if message == "" then
- complain()
- c = c + 1
- else
- local mb = message
- thanks()
- t = t + 1
- c = 0
- memory("learn",ma,mb)
- end
- else
- print("AI> "..memory("remember", message, "nil"))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment