diff options
| -rw-r--r-- | COPYING | 2 | ||||
| -rw-r--r-- | MAP | 7 | ||||
| -rw-r--r-- | chatbot.c | 20 | ||||
| -rw-r--r-- | chatbot.h | 20 | ||||
| -rw-r--r-- | gtnw.c | 25 | ||||
| -rw-r--r-- | gtnw.h | 22 | ||||
| -rw-r--r-- | joshua.c | 21 | ||||
| -rw-r--r-- | joshua.h | 20 | ||||
| -rw-r--r-- | location.h | 20 | ||||
| -rw-r--r-- | main.cpp | 22 | ||||
| -rw-r--r-- | map.h | 6 | ||||
| -rw-r--r-- | strings.c | 20 | ||||
| -rw-r--r-- | strings.h | 20 | ||||
| -rw-r--r-- | util.c | 20 | ||||
| -rw-r--r-- | util.h | 20 |
15 files changed, 260 insertions, 5 deletions
@@ -0,0 +1,2 @@ +Most of the files are licensed under the GNU GPL version 3 or (at your option), any later version: <http://www.gnu.org/licenses/gpl.html> +MAP and map.h are licensed under the Creative Commons Attribution-Sharealike 4.0 International License: <http://creativecommons.org/licenses/by-sa/4.0/>
\ No newline at end of file @@ -1,3 +1,10 @@ +/* + * This file is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/. + * + * Attribution should be given to Franklin Wei. + */ + . __________--^-^-\. ____ __----/^\. |\/. \__. ___/ || ___/ _/._-_ . @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include "gtnw.h" #include "strings.h" #include "util.h" @@ -1 +1,21 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + void do_chatbot(void); @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include "gtnw.h" #include "location.h" #include "map.h" @@ -7,12 +27,15 @@ #include <string.h> #include <time.h> #include <unistd.h> + static bool surrender=false; static int winner=0; /* on surrender */ + static unsigned int max(long long a, long long b) { return a>b?a:b; } + /* simulate a missile launch */ static void fire_missile(struct location_t* city) { @@ -395,5 +418,3 @@ void global_thermonuclear_war(void) } } } - - @@ -1,3 +1,21 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + void global_thermonuclear_war(void); -#define GTN_USSR_MISSILES_PER_TURN 8 -#define GTN_USA_MISSILES_PER_TURN 4 @@ -1,7 +1,28 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include "chatbot.h" #include "joshua.h" #include "strings.h" /* predefined strings */ #include "util.h" + #include <curses.h> #include <signal.h> #include <stdlib.h> @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #ifdef __cplusplus extern "C" { #endif @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include <stdbool.h> /* provide the GTNW with some geographical data to draw the missiles with */ enum player_t { USA=1, USSR }; @@ -1,4 +1,24 @@ -#include <joshua.h> +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + +#include "joshua.h" #include <curses.h> #include <iostream> @@ -1,3 +1,9 @@ +/* + * This file is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/. + * + * Attribution should be given to Franklin Wei. + */ char *map[] = { /* 0 */ (char[]){" ."}, /* 1 */ (char[]){" __________--^-^-\\. ____ __----/^\\."}, @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include "strings.h" const char* stage1_triggers[] = { @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #ifndef WOPR_STRINGS #define WOPR_STRINGS const char* stage1_triggers[5]; @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #include "strings.h" #include "util.h" #include <ctype.h> @@ -1,3 +1,23 @@ +/* + * WarGames - a WOPR emulator written in C + * Copyright (C) 2014 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Contact the author at contact@fwei.tk + */ + #define SLEEP_TIME 0 void allLower(char*); void print_string(const char*); |