diff options
| author | Franklin Wei <franklin@fwei.tk> | 2014-06-21 20:41:04 -0400 |
|---|---|---|
| committer | Franklin Wei <franklin@fwei.tk> | 2014-06-21 20:41:04 -0400 |
| commit | 1640071ca70d0c443743f5c9ebb3511e7885a497 (patch) | |
| tree | fb77883e5ef4384a8e225dcbddccdc999f918900 | |
| download | wargames-server-1640071ca70d0c443743f5c9ebb3511e7885a497.zip wargames-server-1640071ca70d0c443743f5c9ebb3511e7885a497.tar.gz wargames-server-1640071ca70d0c443743f5c9ebb3511e7885a497.tar.bz2 wargames-server-1640071ca70d0c443743f5c9ebb3511e7885a497.tar.xz | |
Inital commit
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | TRANSCRIPT | 54 | ||||
| -rw-r--r-- | joshua.c | 66 | ||||
| -rw-r--r-- | joshua.h | 7 | ||||
| -rw-r--r-- | main.cpp | 7 |
5 files changed, 139 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b021949 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +SOURCES=joshua.o main.o +CXXFLAGS=-I. -lncurses +CFLAGS=-I. -std=gnu99 +all: $(SOURCES) + g++ $(SOURCES) -lncurses diff --git a/TRANSCRIPT b/TRANSCRIPT new file mode 100644 index 0000000..ed79996 --- /dev/null +++ b/TRANSCRIPT @@ -0,0 +1,54 @@ +LOGON: Joshua +<Random stuff> +GREETINGS PROFESSOR FALKEN. + +Hello. + + +HOW ARE YOU FEELING TODAY? + +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 mistak. + + +YES THEY DO. SHAL WE PLAY A GAME? + +Love to. How about Global Thermonuclear War? + + +WOULDN'T YOU PREFER A GOOD GAME OF CHESS? + +Later. Let's play Global Thermonuclear War. + +FINE. +<CLEAR> +<US + USSR ASCII ART> + +UNITED STATES SOVIET UNION + +WHICH SIDE DO YOU WANT? + + 1. UNITED STATES + 2. SOVIET UNION + +PLEASE CHOOSE ONE: 2 +<CLEAR> +AWAITING FIRST STRIKE COMMAND (UNDERLINED) + + +PLEASE LIST PRIMARY TARGETS BY +CITY AND/OR COUNTY NAME: + +Las Vegas +Seattle + +<CLEAR> + +<ASCII ART OF US + USSR> +<US HAS TRAJECTORY HEADINGS OF ICBMS BOUND FOR LAS VEGAS AND SEATTLE> +<SUBS REPRESENTED BY BLINKING DOTS ARE OFF US SHORELINES>
\ No newline at end of file diff --git a/joshua.c b/joshua.c new file mode 100644 index 0000000..34b8cf6 --- /dev/null +++ b/joshua.c @@ -0,0 +1,66 @@ +#include <joshua.h> +#include <curses.h> +#include <stdlib.h> +#define RANDOM_LOOPS 3 +#define SLEEP_TIME 50000 +void allLower(char* str) +{ + for(int i=0;str[i];++i) + { + str[i]=tolower(str[i]); + } +} +void print_string(const char* str) /* print string, slowly */ +{ + int i=0; + while(str[i]) + { + addch(str[i]); + usleep(SLEEP_TIME); + refresh(); + ++i; + } +} +void random_stuff(void) /* print random junk on the screen for about 3 seconds */ +{ + int maxx, maxy; + getmaxyx(stdscr, maxy, maxx); + for(int i=0;i<RANDOM_LOOPS;++i) + { + for(int x=0;x<maxx;++x) + { + for(int y=0;y<maxy;++y) + { + mvaddch(y, x, (rand()%255)+1); + } + } + refresh(); + } + clear(); +} +void be_joshua() +{ + initscr(); + clear(); + color_set(COLOR_PAIR(COLOR_BLUE), 0); + char buf[33]; + do { + print_string("LOGON: "); + refresh(); + int ret=getnstr(buf, 32); + allLower(buf); + usleep(SLEEP_TIME*25); + if(ret==ERR || strcmp(buf, "joshua")) + { + print_string("Unknown user.\n"); + refresh(); + } + } while(strcmp(buf, "joshua")); + random_stuff(); + print_string("GREETINGS, PROFESSOR FALKEN.\n\n"); + refresh(); + getnstr(buf, 32); /* ignore this */ + print_string("\nHOW ARE YOU FEELING TODAY?\n\n"); + refresh(); + endwin(); +} diff --git a/joshua.h b/joshua.h new file mode 100644 index 0000000..4184e55 --- /dev/null +++ b/joshua.h @@ -0,0 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif +void be_joshua(); +#ifdef __cplusplus +}; +#endif diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..1180f8f --- /dev/null +++ b/main.cpp @@ -0,0 +1,7 @@ +#include <iostream> +#include <joshua.h> +using namespace std; +int main() +{ + be_joshua(); +} |