aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--MAP7
-rw-r--r--chatbot.c20
-rw-r--r--chatbot.h20
-rw-r--r--gtnw.c25
-rw-r--r--gtnw.h22
-rw-r--r--joshua.c21
-rw-r--r--joshua.h20
-rw-r--r--location.h20
-rw-r--r--main.cpp22
-rw-r--r--map.h6
-rw-r--r--strings.c20
-rw-r--r--strings.h20
-rw-r--r--util.c20
-rw-r--r--util.h20
15 files changed, 260 insertions, 5 deletions
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: <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
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 <http://www.gnu.org/licenses/>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * 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 <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)
}
}
}
-
-
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 <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
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 <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>
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 <http://www.gnu.org/licenses/>.
+ *
+ * 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 <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 };
diff --git a/main.cpp b/main.cpp
index 169131c..4c102a2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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>
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 <http://www.gnu.org/licenses/>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Contact the author at contact@fwei.tk
+ */
+
#include "strings.h"
#include "util.h"
#include <ctype.h>
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 <http://www.gnu.org/licenses/>.
+ *
+ * Contact the author at contact@fwei.tk
+ */
+
#define SLEEP_TIME 0
void allLower(char*);
void print_string(const char*);