From 6992c1f5cde1b74f8f6d50a54a5ac8b7fd09fbaf Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 22 Jun 2014 20:49:59 -0400 Subject: Added Global Themonuclear War GAME! WHEEgit status --- chatbot.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) (limited to 'chatbot.c') diff --git a/chatbot.c b/chatbot.c index 89e5cc5..049b667 100644 --- a/chatbot.c +++ b/chatbot.c @@ -1,8 +1,28 @@ #include #include -#include +#include "strings.h" +#include +#include +void remove_punct(char* buf) +{ + for(int i=0;buf[i];++i) + { + for(int j=0;j + stage 1: people sometimes make mistakes -> + stage 2: love to. how about global thermonuclear war? -> + stage 3: no lets play global thermonuclear war -> + stage 4: GLOBAL THERMONUCLEAR WAR!!! */ while(1) { char buf[513]; @@ -10,8 +30,54 @@ void do_chatbot(void) if(ret==ERR) { print_string("\n\n"); - print_string(cantUnderstand_respond[sizeof(cantUnderstand_respond)/sizeof(const char*)]); + print_string("Sorry?"); print_string("\n\n"); } + else + { + allLower(buf); + remove_punct(buf); + usleep(SLEEP_TIME*25); + switch(stage) + { + case 0: + for(int i=0;i