From 719be73360ebf8a65038a90ea82ea4e290759df1 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Mon, 23 Jun 2014 11:47:32 -0400 Subject: Fixed GTN --- MAP | 2 +- Makefile | 2 +- TRANSCRIPT | 7 +++++-- chatbot.c | 13 ------------ games.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- joshua.c | 17 ++++++++++++---- map.h | 32 ++++++++++++++--------------- strings.c | 31 ++++++++++++++++++++++++++++ strings.h | 38 ++++++++--------------------------- util.c | 14 +++++++++++++ util.h | 3 ++- 11 files changed, 158 insertions(+), 69 deletions(-) create mode 100644 strings.c diff --git a/MAP b/MAP index b1af6f5..0053ed3 100644 --- a/MAP +++ b/MAP @@ -3,7 +3,7 @@ |\/. \__. ___/ || ___/ _/._-_ . | \. /. /. __ __/ /__/ \/^^\___-__. | L-^-/. /. \.\_-- \. -| / _/ /\/. +| / _/ _/\/. |. | _/. __ __/ \. /. / ___/.// \__ / | / \/. diff --git a/Makefile b/Makefile index 1f60ed0..14bd0b8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SOURCES=joshua.o main.o util.o chatbot.o games.o +SOURCES=joshua.o main.o util.o chatbot.o games.o strings.o CXXFLAGS=-I. -lncurses CFLAGS=-I. -std=gnu99 all: $(SOURCES) diff --git a/TRANSCRIPT b/TRANSCRIPT index 5e4890c..9a6d843 100644 --- a/TRANSCRIPT +++ b/TRANSCRIPT @@ -1,5 +1,8 @@ +<<<<< This is my transcript of the scene in WarGames (1983) where David has dialed into the WOPR and started playing Global Thermonuclear War. >>>>> +<<<<< All spaces, newlines, punctuation, etc. and made to be as accurate as possible >>>>> LOGON: Joshua + GREETINGS PROFESSOR FALKEN. Hello. @@ -13,7 +16,7 @@ I'm fine. How are you? EXCELLENT. IT'S BEEN A LONG TIME. CAN YOU EXPLAIN THE REMOVAL OF YOUR USER ACCOUNT ON 6/23/73? -People sometimes make mistakes. +People sometimes make mistakes. (NOTE: in one scene, it appears that he typed "mistak" instead of "mistakes.") YES THEY DO. SHALL WE PLAY A GAME? @@ -36,7 +39,7 @@ WHICH SIDE DO YOU WANT? 1. UNITED STATES 2. SOVIET UNION -PLEASE CHOOSE ONE: 2 +PLEASE CHOOSE ONE: 2 AWAITING FIRST STRIKE COMMAND (UNDERLINED) diff --git a/chatbot.c b/chatbot.c index 3cb5c36..7ef3b69 100644 --- a/chatbot.c +++ b/chatbot.c @@ -3,19 +3,6 @@ #include "strings.h" #include #include -void remove_punct(char* buf) -{ - for(int i=0;buf[i];++i) - { - for(int j=0;j diff --git a/games.c b/games.c index 2b81ad7..94d2190 100644 --- a/games.c +++ b/games.c @@ -2,6 +2,7 @@ #include #include #include +#include void global_thermonuclear_war(void) { clear(); @@ -10,5 +11,70 @@ void global_thermonuclear_war(void) print_string(map[i]); print_string("\n"); } - print_string("\nWHICH SIDE DO YOU WANT?\n\n 1. UNITED STATES\n 2. SOVIET UNION\n\nPLEASE CHOOSE ONE: "); + print_string("\nWHICH SIDE DO YOU WANT?\n\n 1. UNITED STATES\n 2. SOVIET UNION\n\n"); + bool good=false; + unsigned int side=0; + while(!good) + { + print_string("PLEASE CHOOSE ONE: "); + scanw("%u", &side); + if(side==1 || side==2) + good=true; + } + clear(); + attr_on(WA_UNDERLINE, 0); + print_string("AWAITING FIRST STRIKE COMMAND"); + attr_off(WA_UNDERLINE, 0); + print_string("\n\n\nPLEASE LIST PRIMARY TARGETS BY\nCITY AND/OR COUNTY NAME:\n\n"); + char target_names[32][129]; + good=true; + int num_targets=0; + for(int i=0;i<32 && good;++i) + { + getnstr(target_names[i], 128); + if(strcmp(target_names[i],"")==0) + { + good=false; + } + else + ++num_targets; + } + struct location_t targets[32]; + int num_targets_found=0; + print_string("point 1"); + for(int i=0;i #include +#include "strings.h" void allLower(char* str) { for(int i=0;str[i];++i) @@ -18,3 +19,16 @@ void print_string(const char* str) /* print string, slowly */ ++i; } } +void remove_punct(char* buf) +{ + for(int i=0;buf[i];++i) + { + for(int j=0;j