From dccfa58cbb77e8305aeccdb8a8d2b3112e2af688 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Tue, 24 Jun 2014 14:24:05 +0000 Subject: Added NEW, SHINY featuresgit diff! Still needs some work... --- GAMESPEC | 44 +++++++++++++++++++++++++++++++++ chatbot.c | 13 +++++++++- games.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- location.h | 27 +++++++++++---------- strings.c | 17 +++++++++++++ strings.h | 2 ++ 6 files changed, 165 insertions(+), 20 deletions(-) create mode 100644 GAMESPEC diff --git a/GAMESPEC b/GAMESPEC new file mode 100644 index 0000000..c403a93 --- /dev/null +++ b/GAMESPEC @@ -0,0 +1,44 @@ +This file contains a formal definition of Global Thermonuclear War. +=======GAMEPLAY======== +Each player starts with 32 ICBMs. +The player with population still remaining after the other has been wiped out is the winner. +If both players are wiped out, it is a tie. +Each turn, the player can either: + - Launch ICBMs + - Negociate peace terms + - Surrender + +The behavior of each of these options is described below. + +ICBM launch: + - The USA can launch ICBMs at a maximum of 4 cities at a time. + - The USSR can launch 6 at a time. + - When an ICBM is launched, there are 4 possible results: + - Miss: 0 casualties + - Marginal: 10000 casualties + - Major: 500000 casualties + - Critical: All inhabitants of the target city are killed + - The probabilities of each of these options is outlined below: + - Miss - 10% + - Marginal - 50% + - Major - 30% + - Critical - 10% + - After the turn, the cities targeted will have one of these symbols in it: + - Miss - O + - Marginal - x + - Major - * + - Critical - X + +Negociation: + - There are three possible outcomes: + - Peace/Progress - 20% + - Surprise attack - 20% + - No progress - 60% + - When progress is made, both sides will lose 4 ICBMs + - Progress must be made at least 5 times if peace is to be achieved + +Surrender: + - The other player wins + +=======GRAPHICS======= +Each turn, a map is displayed with the populations of the player's cities in a table below. diff --git a/chatbot.c b/chatbot.c index 6217696..314ae78 100644 --- a/chatbot.c +++ b/chatbot.c @@ -76,16 +76,27 @@ void do_chatbot(void) } break; } // switch + /* now check for phase-insensitive strings */ for(int i=0;i #include #include +static int max(int a, int b) +{ + if(a>b) + return a; + else + return b; +} +static void print_map_with_pops(void) +{ + for(int i=0;iussr_back) + { + while(us_back!=ussr_back) + { + ussr_cities[ussr_back].print=false; + ++ussr_back; + } + } + print_string("\n\n"); + char buf[256]; + for(int i=0;i