diff --git a/source/ttrts/main.cpp b/source/ttrts/main.cpp index ccf47a0..cacc29f 100644 --- a/source/ttrts/main.cpp +++ b/source/ttrts/main.cpp @@ -7,60 +7,8 @@ #include "game.h" static const char* sk_usage = -"NAME\n" -"\tttrts - Tiny Terminal RTS\n" -"\n" -"SYNOPSYS\n" -"\tttrts [OPTIONS...] MAPFILE\n" -"\n" -"DESCRIPTION\n" -"\tttrts is a tiny terminal based RTS where that uses text\n" -"\tfiles as order lists to control it's units.\n" -"\n" -"\tThis means that any user, program or cat that can read\n" -"\tand write to text files can play the game.\n" -"\n" -"USAGE\n" -"\tWhen invoked, ttrts will set up a full game and output a\n" -"\tsingle file representing the current gamestate into a \n" -"\tlocal directory called ttrts_{GAME_NAME}.\n" -"\n" -"\tThis file can be read in and interpretted by human, robot\n" -"\tor cat. ttrts will wait for orders files to be placed in \n" -"\tit's current working directory.\n" -"\n" -"\tOnce orders have been set for each player taking part \n" -"\tttrts will calculate the new game state and output a new \n" -"\tgamestate file for the next turn.\n" -"\n" -"\tThis process repeats until a winner is chosen!\n" -"\n" -"OPTIONS\n" -"\tMAPFILE:\n" -"\t\tFile to read in the initial game state from\n" -"\n" -"GAMESTATE FILE FORMAT\n" -"\tName\n" -"\t Turn_{TURN_NUMBER}.txt\n" -"\tContents\n" -"\t ===== {GAME_NAME} =====\n" -"\t SIZE:[{X},{Y}]\n" -"\t TURN:{TURN_NUMBER}\n" -"\t ~~~~\n" -"\t UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}]\n" -"\t ...\n" -"\n" -"ORDER FILE FORMAT\n" -"\tName\n" -"\t Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt\n" -"\tContents\n" -"\t ORDER:{ORDER_CHAR} id:{UNIT_ID}\n" -"\t ...\n" -"\n" -"ORDERS\n" -"\tF - Move unit forward one space\n" -"\tL/R - Rotate unit left or right\n" -"\tA - Attack space in front of unit\n"; +#include "usage.h" +; // time for waiting between file stats static const std::chrono::milliseconds sk_waitTime = std::chrono::milliseconds(100); diff --git a/source/ttrts/usage.h b/source/ttrts/usage.h new file mode 100644 index 0000000..3a94c8d --- /dev/null +++ b/source/ttrts/usage.h @@ -0,0 +1,56 @@ +"NAME\n" +"\tttrts - Tiny Terminal RTS\n" +"\n" +"SYNOPSYS\n" +"\tttrts [OPTIONS...] MAPFILE\n" +"\n" +"DESCRIPTION\n" +"\tttrts is a tiny terminal based RTS where that uses text\n" +"\tfiles as order lists to control it's units.\n" +"\n" +"\tThis means that any user, program or cat that can read\n" +"\tand write to text files can play the game.\n" +"\n" +"USAGE\n" +"\tWhen invoked, ttrts will set up a full game and output a\n" +"\tsingle file representing the current gamestate into a \n" +"\tlocal directory called `ttrts_{GAME_NAME}`.\n" +"\n" +"\tThis file can be read in and interpretted by human, robot\n" +"\tor cat. ttrts will wait for orders files to be placed in \n" +"\tit's current working directory.\n" +"\n" +"\tOnce orders have been set for each player taking part \n" +"\tttrts will calculate the new game state and output a new \n" +"\tgamestate file for the next turn.\n" +"\n" +"\tThis process repeats until a winner is chosen!\n" +"\n" +"OPTIONS\n" +"\tMAPFILE - File to read in the initial game state from\n" +"\n" +"-------------------------------------------------------------------------------\n" +"\n" +"GAMESTATE FILE FORMAT\n" +"Name\n" +"\tTurn_{TURN_NUMBER}.txt\n" +"Contents\n" +"\t===== {GAME_NAME} =====\n" +"\tSIZE:[{X},{Y}]\n" +"\tTURN:{TURN_NUMBER}\n" +"\t~~~~\n" +"\tUNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}]\n" +"\t...\n" +"\n" +"ORDER FILE FORMAT\n" +"Name\n" +"\tTurn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt\n" +"Contents\n" +"\tORDER:{ORDER_CHAR} id:{UNIT_ID}\n" +"\t...\n" +"\n" +"Orders\n" +"\tF - Move unit forward one space\n" +"\tL/R - Rotate unit left or right\n" +"\tA - Attack row in front of unit\n" +"\t\n" diff --git a/USAGE.txt b/source/ttrts/usage.md similarity index 50% rename from USAGE.txt rename to source/ttrts/usage.md index c3bd574..007cac2 100644 --- a/USAGE.txt +++ b/source/ttrts/usage.md @@ -1,23 +1,20 @@ -To convert this file to c++ syntax use -$ cat USAGE.txt | sed 's/\t/\\t/g' | sed ':a;N;$!ba;s/\n/\\n\n/g' | sed 's/^/"/' | sed 's/$/"/' - -NAME +## NAME ttrts - Tiny Terminal RTS -SYNOPSYS +## SYNOPSYS ttrts [OPTIONS...] MAPFILE -DESCRIPTION +## DESCRIPTION ttrts is a tiny terminal based RTS where that uses text files as order lists to control it's units. This means that any user, program or cat that can read and write to text files can play the game. -USAGE +## USAGE When invoked, ttrts will set up a full game and output a single file representing the current gamestate into a - local directory called ttrts_{GAME_NAME}. + local directory called `ttrts_{GAME_NAME}`. This file can be read in and interpretted by human, robot or cat. ttrts will wait for orders files to be placed in @@ -29,30 +26,32 @@ USAGE This process repeats until a winner is chosen! -OPTIONS - MAPFILE: - File to read in the initial game state from +## OPTIONS + MAPFILE - File to read in the initial game state from -GAMESTATE FILE FORMAT - Name - Turn_{TURN_NUMBER}.txt - Contents - ===== {GAME_NAME} ===== - SIZE:[{X},{Y}] - TURN:{TURN_NUMBER} - ~~~~ - UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}] - ... +------------------------------------------------------------------------------- -ORDER FILE FORMAT - Name - Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt - Contents - ORDER:{ORDER_CHAR} id:{UNIT_ID} - ... +## GAMESTATE FILE FORMAT +### Name + Turn_{TURN_NUMBER}.txt +### Contents + ===== {GAME_NAME} ===== + SIZE:[{X},{Y}] + TURN:{TURN_NUMBER} + ~~~~ + UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}] + ... -ORDERS +## ORDER FILE FORMAT +### Name + Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt +### Contents + ORDER:{ORDER_CHAR} id:{UNIT_ID} + ... + +### Orders F - Move unit forward one space L/R - Rotate unit left or right - A - Attack space in front of unit - + A - Attack row in front of unit + +`$ cat usage.md | sed 's/^#* //g' | sed 's/\t/\\t/g' | sed ':a;N;$!ba;s/\n/\\n\n/g' | sed 's/^/"/' | sed 's/$/"/' | sed '$ d' > usage.h # To convert this file to c++` \ No newline at end of file