From 645a27fa9d7c7d8a4f9131c032da468386fed116 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 28 Jun 2014 10:24:09 -0400 Subject: Licensed code under GPL3, map under CC-BY-SA-4.0 --- COPYING | 2 ++ MAP | 7 +++++++ chatbot.c | 20 ++++++++++++++++++++ chatbot.h | 20 ++++++++++++++++++++ gtnw.c | 25 +++++++++++++++++++++++-- gtnw.h | 22 ++++++++++++++++++++-- joshua.c | 21 +++++++++++++++++++++ joshua.h | 20 ++++++++++++++++++++ location.h | 20 ++++++++++++++++++++ main.cpp | 22 +++++++++++++++++++++- map.h | 6 ++++++ strings.c | 20 ++++++++++++++++++++ strings.h | 20 ++++++++++++++++++++ util.c | 20 ++++++++++++++++++++ util.h | 20 ++++++++++++++++++++ 15 files changed, 260 insertions(+), 5 deletions(-) create mode 100644 COPYING diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5d2b5cd --- /dev/null +++ b/COPYING @@ -0,0 +1,2 @@ +Most of the files are licensed under the GNU GPL version 3 or (at your option), any later version: +MAP and map.h are licensed under the Creative Commons Attribution-Sharealike 4.0 International License: \ No newline at end of file diff --git a/MAP b/MAP index d0beda8..888a98d 100644 --- a/MAP +++ b/MAP @@ -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. + */ + . __________--^-^-\. ____ __----/^\. |\/. \__. ___/ || ___/ _/._-_ . diff --git a/chatbot.c b/chatbot.c index 81ede03..b2909f5 100644 --- a/chatbot.c +++ b/chatbot.c @@ -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 . + * + * Contact the author at contact@fwei.tk + */ + #include "gtnw.h" #include "strings.h" #include "util.h" diff --git a/chatbot.h b/chatbot.h index c3c1db0..9b435d5 100644 --- a/chatbot.h +++ b/chatbot.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 . + * + * Contact the author at contact@fwei.tk + */ + void do_chatbot(void); diff --git a/gtnw.c b/gtnw.c index 1be73a0..f86766c 100644 --- a/gtnw.c +++ b/gtnw.c @@ -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 . + * + * Contact the author at contact@fwei.tk + */ + #include "gtnw.h" #include "location.h" #include "map.h" @@ -7,12 +27,15 @@ #include #include #include + 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) } } } - - diff --git a/gtnw.h b/gtnw.h index a0909d0..1c49e93 100644 --- a/gtnw.h +++ b/gtnw.h @@ -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 . + * + * 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 diff --git a/joshua.c b/joshua.c index 1183586..675f70b 100644 --- a/joshua.c +++ b/joshua.c @@ -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 . + * + * Contact the author at contact@fwei.tk + */ + #include "chatbot.h" #include "joshua.h" #include "strings.h" /* predefined strings */ #include "util.h" + #include #include #include diff --git a/joshua.h b/joshua.h index 4184e55..ba0c861 100644 --- a/joshua.h +++ b/joshua.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 . + * + * Contact the author at contact@fwei.tk + */ + #ifdef __cplusplus extern "C" { #endif diff --git a/location.h b/location.h index c772e06..3a85ada 100644 --- a/location.h +++ b/location.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 . + * + * Contact the author at contact@fwei.tk + */ + #include /* provide the GTNW with some geographical data to draw the missiles with */ enum player_t { USA=1, USSR }; diff --git a/main.cpp b/main.cpp index 169131c..4c102a2 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,24 @@ -#include +/* + * 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 . + * + * Contact the author at contact@fwei.tk + */ + +#include "joshua.h" #include #include diff --git a/map.h b/map.h index 4208788..5b80c67 100644 --- a/map.h +++ b/map.h @@ -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[]){" __________--^-^-\\. ____ __----/^\\."}, diff --git a/strings.c b/strings.c index 8109fa4..48dc194 100644 --- a/strings.c +++ b/strings.c @@ -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 . + * + * Contact the author at contact@fwei.tk + */ + #include "strings.h" const char* stage1_triggers[] = { diff --git a/strings.h b/strings.h index 7de1214..543b1b1 100644 --- a/strings.h +++ b/strings.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 . + * + * Contact the author at contact@fwei.tk + */ + #ifndef WOPR_STRINGS #define WOPR_STRINGS const char* stage1_triggers[5]; diff --git a/util.c b/util.c index 5e22489..c93055c 100644 --- a/util.c +++ b/util.c @@ -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 . + * + * Contact the author at contact@fwei.tk + */ + #include "strings.h" #include "util.h" #include diff --git a/util.h b/util.h index 63409fa..8b23979 100644 --- a/util.h +++ b/util.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 . + * + * Contact the author at contact@fwei.tk + */ + #define SLEEP_TIME 0 void allLower(char*); void print_string(const char*); -- cgit v1.1