Skip to content

Commit 70ee81b

Browse files
Merge pull request #2 from rforzachamp821/Ryan_WorkingBranch
Ryan working branch v0.7.0 PR (v0.7.0 files!)
2 parents 5d85b61 + 4f1da39 commit 70ee81b

24 files changed

+1088
-73
lines changed

CommandFiles/CalculationAlgorithm/CalculationAlgorithm.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,6 @@ bool CalculationAlgorithm::UseEuropeanNotation(bool bToggleValue) {
10201020
cDecimalPoint = cDefaultDecimalPoint;
10211021
cThousandsSeparator = cDefaultThousandsSeparator;
10221022
break;
1023-
default:
1024-
VerbosityDisplay("In CalculationAlgorithm::UseEuropeanNotation(): ERROR - Unknown value recieved from bToggleValue, therefore setting notation failed. Not true/false (1/0).\n", nObjectID);
1025-
return false;
10261023
}
10271024

10281025
return true;

CommandFiles/CommandFileAssets.cpp

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,36 @@ void help(bool bFromTutorial) {
220220
sneHelp.nSizeOfScreens = 4;
221221
std::string sScreens[] =
222222
{
223-
"___LIST OF COMMANDS___\n\nTo see more about a command, type in \"<command> -h\". This will work for all commands, except: echo and title.\n\n[1] Help\n[2] Exit\n[3] Tutorial\n[4] Echo\n[5] CLS\n[6] DevTools\n[7] CPUStress\n[8] Colour\n[9] Settings\n[10] Title\n[11] Date\n[12] ColourNumbers\n[13] MediaPlayer\n[14] AudioPlayer\n[15] TTS\n[16] Stopwatch\n[17] Read\n[18] Timer\n[19] Beep\n[20] MessageBox\n[21] Copy\n[22] CopyFile\n[23] TextInfo\n[24] ConfigAction\n[25] BeepSounds\n[26] RickRoll\n[27] ShellExecute\n[28] Hacker\n[29] Calculator\n[30] Logoff\n[31] Shutdown\n[32] Reboot (or Restart)\n[33] Hibernate\n[34] ResetExpl\n[35] MemTest\n[36] RandCol\n[37] Pause\n[38] CommandNum\n[39] SlowChar\n[40] ReverseText\n[41] Notes\n[42] FileParse\n[43] Disp\n[44] SysInfo\n[45] Einstein\n[46] Edison\n[47] Tesla\n[48] Cow\n[49] Cat\n[50] Bunny\n[51] Game\n[52] FileCryptor\n[53] Delete\n\nMore will be added soon!\n",
223+
"___LIST OF COMMANDS___\n\nTo see more info about a command, type in \"<command> -h\". This will work for all commands, except: echo and title.\n\n"
224+
"[1] Help\t\t[16] Stopwatch\t\t[31] Shutdown\t\t[46] Edison\n"
225+
"[2] Exit\t\t[17] Read\t\t[32] Reboot\t\t[47] Tesla\n"
226+
"[3] Tutorial\t\t[18] Timer\t\t[33] Hibernate\t\t[48] Cow\n"
227+
"[4] Echo\t\t[19] Beep\t\t[34] ResetExpl\t\t[49] Cat\n"
228+
"[5] CLS\t\t\t[20] MessageBox\t\t[35] MemTest\t\t[50] Bunny\n"
229+
"[6] DevTools\t\t[21] Copy\t\t[36] RandCol\t\t[51] Game\n"
230+
"[7] CPUStress\t\t[22] CopyFile\t\t[37] Pause\t\t[52] FileCryptor\n"
231+
"[8] Colour\t\t[23] TextInfo\t\t[38] CommandNum\t\t[53] Delete\n"
232+
"[9] Settings\t\t[24] ConfigAction\t[39] SlowChar\t\t[54] Factorial\n"
233+
"[10] Title\t\t[25] BeepSounds\t\t[40] ReverseText\t[55] CalcQuadratic\n"
234+
"[11] Date\t\t[26] RickRoll\t\t[41] Notes\t\t[56] Y2038\n"
235+
"[12] ColourNumbers\t[27] ShellExecute\t[42] FileParse\n"
236+
"[13] MediaPlayer\t[28] Hacker\t\t[43] Disp\n"
237+
"[14] AudioPlayer\t[29] Calculator\t\t[44] SysInfo\n"
238+
"[15] TTS\t\t[30] Logoff\t\t[45] Einstein\n"
239+
240+
"\nMore will be added soon!\n",
224241

225242
"___FREQUENTLY ASKED QUESTIONS___\n\n"
226243
"1) I can't see the terminal text. How can I zoom in?\n 1a) You can zoom in, of course. Press and hold the Ctrl button and scroll with the mouse to your desired text size.\n"
227244
"\n\n2) The error messages shown aren't detailed enough. How do I get better-quality error messages?\n 2a) To get better quality error messages, just enable the Verbosity Messages setting in the Settings command.\n"
228245
"\n\n3) I'm using the Windows 7 terminal. How do I scroll up and down in the terminal without using the mouse?\n 3a) To scroll up and down without the mouse, press Alt + Space and then the keys 'E' and 'L', and then scroll with the up/down arrow keys. Use the PageUp/PageDown keys to scroll full pages in the terminal.\n"
229246
"\n\n4) What is the difference between the 'old' and 'new' OptionSelect Session styles?\n 4a) The 'old' style is an inspiration from the TerminalAppGen2, the previous iteration of this program. It is very robust, simple and works by associating a number with each option, which you type in and press ENTER to select.\nThe 'new' style isn't exactly new, and has been in ZeeTerminal since v0.1.0. However, it is newer than the 'old' style, hence it's referred to as 'new'. It relies on using the arrow/WS keys to move a highlight up and down, to select an option.\n",
230247

231-
"___ABOUT THIS PROGRAM___\n\nThis is the ZeeTerminal Commandline Program, Build " + std::string(ZT_VERSION) + ".\n" +
232-
"This is an early alpha build of ZeeTerminal, with an entirely new engine and components.\nThis program is made in C++, with a few very small parts of C." +
233-
"\n\nThis program uses the DirectShow API in the MediaPlayer command, which is licensed by Microsoft Corporation. (c) Microsoft Corporation.\n\n" +
234-
"This program uses the BASS API in the AudioPlayer command, which is licensed by Un4Seen Developments. (c) Un4Seen Developments.\n\n" +
235-
"This program uses a slightly modified version of the CarDodge game v0.5.1, accessible in the Game command. CarDodge is licensed under Ryan Zorkot with the MIT License. For more information, visit the repository: https://github.com/rforzachamp821/CarDodge\n\n"
248+
"___ABOUT THIS PROGRAM___\n\nThis is the ZeeTerminal Commandline Program, Build v" + std::string(ZT_VERSION) + ".\n" +
249+
"This is a beta build of ZeeTerminal, with an entirely new engine and components.\nThis program is made in C++, with a few very small parts of C." +
250+
"\n\nThis program uses the DirectShow API in the MediaPlayer command, licensed by Microsoft Corp. (c) Microsoft Corp.\n\n" +
251+
"This program uses the BASS API in the AudioPlayer command, licensed by Un4Seen Developments. (c) Un4Seen Developments.\n\n" +
252+
"This program uses the CarDodge game v0.6.0, accessible in the Game command. CarDodge is licensed under Ryan Zorkot with the MIT License. For more information, visit the archived repo: https://github.com/rforzachamp821/CarDodge\n\n"
236253
"\nZeeTerminal is licensed under the MIT License. The license and credits can be viewed on Page 4.\n\n"
237254
" _____ _____ _ _ \n"
238255
" |__ /___ __|_ _|__ _ __ _ __ ___ (_)_ __ __ _| |\n"
@@ -2682,6 +2699,59 @@ std::string FormatValueForEuropeanNotation(long double dValue) {
26822699
return sFormatBuffer;
26832700
}
26842701

2702+
// GetNumPrimeFactorsAsString - Get the prime factors of a specified integer argument and return them as a string in this format: "<n>, <n>, <n>"...
2703+
// Parameters: nNumToUse - The number to calculate the prime factors of.
2704+
// Return Values: std::string containing the prime factors of nNumToUse, as a string.
2705+
//
2706+
std::string GetNumPrimeFactorsAsString(uint64_t nNumToUse) {
2707+
std::string sPrimeFactorStr = "";
2708+
2709+
// Repeat until square root of nNumToUse
2710+
for (uint64_t i = 2; i * i <= nNumToUse; ++i) {
2711+
2712+
// Check if divisible by i
2713+
while (nNumToUse % i == 0) {
2714+
// Add prime factor to string with space
2715+
sPrimeFactorStr += std::to_string(i) + ", ";
2716+
// Divide by i to move on to next prime factor
2717+
nNumToUse /= i;
2718+
}
2719+
}
2720+
2721+
// nNumToUse has been divided all the way, do not forget about it
2722+
if (nNumToUse > 1) {
2723+
// Add prime factor to string with space
2724+
sPrimeFactorStr += std::to_string(nNumToUse) + ", ";
2725+
}
2726+
2727+
// There should be an unnecessary extra ", " at the end of the string - remove it
2728+
sPrimeFactorStr.erase(sPrimeFactorStr.length() - 2, 2);
2729+
2730+
// Return string
2731+
return sPrimeFactorStr;
2732+
}
2733+
2734+
// GetNumFactorsAsString - Get the factors of a specified integer argument and return it as a string in this format: "<n>, <n>, <n>"...
2735+
// Parameters: nNumToUse - The number to calculate the factors of.
2736+
// Return Values: std::string containing the factors of nNumToUse, as a string.
2737+
//
2738+
std::string GetNumFactorsAsString(uint64_t nNumToUse) {
2739+
std::string sFactorsStr = "";
2740+
2741+
// Iterate until number with increment of 1 (brute-force technique)
2742+
for (uint64_t i = 1; i <= nNumToUse; i++) {
2743+
if (nNumToUse % i == 0) {
2744+
// Add number to string
2745+
sFactorsStr += std::to_string(i) + ", ";
2746+
}
2747+
}
2748+
2749+
// There should be an unnecessary extra ", " at the end of the string - remove it
2750+
sFactorsStr.erase(sFactorsStr.length() - 2, 2);
2751+
2752+
return sFactorsStr;
2753+
}
2754+
26852755
/* MessageBox Codes */
26862756
//////////////////////
26872757
/* Message box codes are the following for icons:

CommandFiles/CommandHelpMessages.cpp

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ namespace helpmsgs
178178
<< wordWrap("\n --newoptionselect <toggle>\tUse the new OptionSelect Engine style. Set either true/t or false/f in place of <toggle>.")
179179
<< wordWrap("\n --cdcarturnspeed <speed>\tSet the car turning speed in the CarDodge game. Cannot be >10 and <1. Put the speed in place of <speed>.")
180180
<< wordWrap("\n --cdstartupcar <car>\t\tToggle the type of car auto-selected on startup in the CarDodge game. Put the car style in place of <style>.")
181-
<< wordWrap("\n --cdforeground <num>\tSet the foreground colour in the CarDodge game. Put the colour number in place of <num>.")
182-
<< wordWrap("\n --cdbackground <num>\tSet the background colour in the CarDodge game. Put the colour number in place of <num>.")
181+
<< wordWrap("\n --cdforeground <num>\t\tSet the foreground colour in the CarDodge game. Put the colour number in place of <num>.")
182+
<< wordWrap("\n --cdbackground <num>\t\tSet the background colour in the CarDodge game. Put the colour number in place of <num>.")
183+
<< wordWrap("\n --gtnforeground <num>\t\tSet the foreground colour in the Guess The Number game. Put the colour number in place of <num>.")
184+
<< wordWrap("\n --gtnbackground <num>\t\tSet the background colour in the Guess The Number game. Put the colour number in place of <num>.")
183185
<< wordWrap("\n\nExample: settings --titlefore 1")
184186
<< wordWrap("\n\nNote: You can get colour numbers by executing the \"ColourNumbers\" command.") << "\n\n";
185187

@@ -394,6 +396,7 @@ namespace helpmsgs
394396
std::cout << "Possible arguments for this command:" << NOULINE_STR;
395397
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
396398
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n <source>\tThe original file to be copied to another file. Put the file directory in place of <source>.\n <dest>\t\tThe file directory of the new/existing file. Put the file directory in place of <dest>.")
399+
<< wordWrap("\n\nSyntax: copyfile <source> <dest> (in this exact order).")
397400
<< wordWrap("\n\nExample: copyfile \"C:\\test\\a file.txt\" C:\\Users\\newfile.txt")
398401
<< wordWrap("\n\nNOTE: For any directory with spaces, use quotes like in the example.\nNOTE: You must have both the source and the destination directories when using them as arguments.\nNOTE: Read this article for information on the different forms of filepaths: ");
399402

@@ -422,6 +425,7 @@ namespace helpmsgs
422425
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n -o\t\tEnable overwrite mode. Any existing file with the same filename as the file to copy will be overwritten when specified."
423426
"\n -d\t\tEnable folder copy mode. When a folder is specified as a source, the contents of that folder will be recursively copied to the destination."
424427
"\n <source>\tThe file to copy. Put the file directory in place of <source>.\n <dest>\t\tThe destination location/directory. Put the directory path in place of <dest>.\n\n"
428+
"Syntax: copy <source <dest> (in this exact order).\n\n"
425429
"Example: copy \"C:\\test\\a file.txt\" C:\\Users\n\n"
426430
"NOTE: For any directory with spaces, use quotes like in the example.\nNOTE: You must have both the source and the destination directories when using them as arguments.\nNOTE: Read this article for information on the different forms of filepaths: ");
427431

@@ -549,7 +553,7 @@ namespace helpmsgs
549553
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
550554
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n -i\t\tStart immediately, with default settings when no argument is given.\n --display\tStarts the hacking text part of this command.\n --type\t\tStarts the hacker typing part of this command.\n --typecustom\tStarts the hacker typing part of this command, with custom file output abilities.\n <speed>\tSpeed of output characters for 'type' and 'typecustom' arguments. Must be a number.\n <filepath>\tCustom filepath argument for 'typecustom' argument. Must be a valid filepath.")
551555
<< wordWrap("\n\nSyntax for '--type' argument:\t\t --type <speed>\nSyntax for '--typecustom' argument:\t --typecustom <filepath> <speed> (In order)")
552-
<< wordWrap("\n\nExample: hacker --type\n\n");
556+
<< wordWrap("\n\nExample: hacker --type\n\nNOTE: When using the --typecustom argument, in the <filepath> argument, you can use \"*open\" without quotes to use the Windows File Dialogue to open files.\n\n");
553557

554558
return;
555559
}
@@ -1034,7 +1038,8 @@ namespace helpmsgs
10341038
colourSubheading();
10351039
std::cout << "Possible arguments for this command:" << NOULINE_STR;
10361040
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1037-
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n --cardodge\tStarts the CarDodge game, a game where you dodge enemy cars to gain points.\n\n"
1041+
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n --cardodge\tStarts the CarDodge game, a game where you dodge enemy cars to gain points.\n"
1042+
" --gtn\t\tStarts the Guess The Number game, a game where you guess a number between 1 and 100 in as little tries as you can.\n\n"
10381043
"Example: game --cardodge\n\n");
10391044

10401045
return;
@@ -1082,4 +1087,68 @@ namespace helpmsgs
10821087

10831088
return;
10841089
}
1090+
1091+
// FactorialHelp
1092+
void FactorialHelp() {
1093+
CentreColouredText(" ___FACTORIAL___ ", 1);
1094+
std::cout << "\n";
1095+
CentreColouredText("This command calculates the factors and prime factors of a positive integer.", 2);
1096+
std::cout << "\n\n";
1097+
1098+
colourSubheading();
1099+
std::cout << "What this command does:" << NOULINE_STR;
1100+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1101+
std::cout << wordWrap("\n- This command simply calculates the prime factors and factors of a positive integer.\n- The results are displayed on the terminal screen.\n\n");
1102+
1103+
colourSubheading();
1104+
std::cout << "Possible arguments for this command:" << NOULINE_STR;
1105+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1106+
std::cout << wordWrap("\n -h\tDisplays this help message.\n <num>\tFactorise a number from an argument parameter. Put the number in place of <num>.\n\nExample: factorial 45\n\n");
1107+
1108+
return;
1109+
}
1110+
1111+
// CalcQuadraticHelp
1112+
void CalcQuadraticHelp() {
1113+
CentreColouredText(" ___CALCQUADRATIC___ ", 1);
1114+
std::cout << "\n";
1115+
CentreColouredText("CalcQuadratic allows you to compute all values of a quadratic equation quickly and easily.", 2);
1116+
std::cout << "\n\n";
1117+
1118+
colourSubheading();
1119+
std::cout << "What this command does:" << NOULINE_STR;
1120+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1121+
std::cout << wordWrap("\n- This command calculates all the values of a quadratic mathematical equation quickly and easily.\n- All the command needs is the A, B and C values, from this quadratic equation form: [ax^2 + bx + c = 0].\n\n");
1122+
1123+
colourSubheading();
1124+
std::cout << "Possible arguments for this command:" << NOULINE_STR;
1125+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1126+
std::cout << wordWrap("\n -h\t\tDisplays this help message.\n <a> <b> <c>\tCompute values of quadratic equation from arguments. Put A, B and C values in place of <a>, <b> and <c> respectively.\n\n"
1127+
"Example: calcquadratic 1 9 18\n\nNOTE: The A, B and C arguments must be numerical for the calculator to work.\n\n");
1128+
1129+
return;
1130+
}
1131+
1132+
// Y2038Help
1133+
void Y2038Help() {
1134+
CentreColouredText(" ___Y2038___ ", 1);
1135+
std::cout << "\n";
1136+
CentreColouredText("This command displays how long is left until the Y2038 time overflow occurs.", 2);
1137+
std::cout << "\n\n";
1138+
1139+
colourSubheading();
1140+
std::cout << "What this command does:" << NOULINE_STR;
1141+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1142+
std::cout << wordWrap("\n- This command displays how long is left until the Y2038 time overflow occurs (aka the Y2038 problem, Y2K38).\n- This bug occurs because there are simply too many seconds to fit into a 32-bit integer. Therefore, it affects all 32-bit systems."
1143+
"\n- You can find out more about this phenomenon on the Wikipedia page: ");
1144+
colour(LBLU, ConfigObjMain.sColourGlobalBack);
1145+
std::cout << wordWrap("https://en.wikipedia.org/wiki/Year_2038_problem\n\n");
1146+
1147+
colourSubheading();
1148+
std::cout << "Possible arguments for this command:" << NOULINE_STR;
1149+
colour(ConfigObjMain.sColourGlobal, ConfigObjMain.sColourGlobalBack);
1150+
std::cout << wordWrap("\n -h\tDisplays this help message.\n\nExample: y2038 -h\n\n");
1151+
1152+
return;
1153+
}
10851154
}

CommandFiles/CommandsFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "CommandHelpMessages.cpp"
2929
#include "CalculationAlgorithm/CalculationAlgorithm.h"
3030
#include "../GameFiles/CarDodge/CarDodge.cpp"
31+
#include "../GameFiles/GuessTheNumber/GuessTheNumber.h"
3132

3233
#include <vector>
3334
#include <string>

CommandFiles/CommandsFiles/CommandsFile_1to10.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,12 +805,34 @@ bool commands::Commands1To10(const std::string sCommand, char* cCommandArgs, con
805805
UserErrorDisplay("An error occured. Your setting option seems to be incorrect. Make sure it's a number and try again.\nType \"settings -h\" for more info.\n");
806806
}
807807

808+
return true;
809+
}
810+
else if (sStringOptionCommandArgs[0] == "gtnforeground") {
811+
if (isNumberi(sStringDataCommandArgs[0])) {
812+
GuessTheNumberGameSettings(1, std::stoi(sStringDataCommandArgs[0]), 0);
813+
}
814+
else {
815+
VerbosityDisplay("In Commands() - ERROR: Could not detect numerical value in string-based number argument.\n");
816+
UserErrorDisplay("An error occured. Your setting option seems to be incorrect. Make sure it's a number and try again.\nType \"settings -h\" for more info.\n");
817+
}
818+
819+
return true;
820+
}
821+
else if (sStringOptionCommandArgs[0] == "gtnbackground") {
822+
if (isNumberi(sStringDataCommandArgs[0])) {
823+
GuessTheNumberGameSettings(2, 0, std::stoi(sStringDataCommandArgs[0]));
824+
}
825+
else {
826+
VerbosityDisplay("In Commands() - ERROR: Could not detect numerical value in string-based number argument.\n");
827+
UserErrorDisplay("An error occured. Your setting option seems to be incorrect. Make sure it's a number and try again.\nType \"settings -h\" for more info.\n");
828+
}
829+
808830
return true;
809831
}
810832
}
811833

812834
OptionSelectEngine oseSettings;
813-
oseSettings.nSizeOfOptions = 11;
835+
oseSettings.nSizeOfOptions = 12;
814836
std::string sOptions[] = {
815837
"Highlight Colour Settings",
816838
"Title Colour Settings",
@@ -822,6 +844,7 @@ bool commands::Commands1To10(const std::string sCommand, char* cCommandArgs, con
822844
"Cursor Settings",
823845
"LogFile System Settings",
824846
"CarDodge Game Settings",
847+
"Guess The Number Game Settings",
825848
"Other Settings"
826849
};
827850
oseSettings.sOptions = sOptions;
@@ -866,6 +889,9 @@ bool commands::Commands1To10(const std::string sCommand, char* cCommandArgs, con
866889
CarDodgeGameSettings();
867890
break;
868891
case 11:
892+
GuessTheNumberGameSettings();
893+
break;
894+
case 12:
869895
OtherSettings();
870896
break;
871897

CommandFiles/CommandsFiles/CommandsFile_21to30.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,25 @@ bool commands::Commands21To30(const std::string sCommand, char* cCommandArgs, co
816816
}
817817

818818
if (sFileName == "") {
819-
sFileName = StrInput("Please input the filepath for the custom file (0 to exit): > ");
819+
sFileName = StrInput("Please input the filepath for the custom file (0 to exit, *open for Windows File Dialogue): > ");
820820
if (sFileName == "0") {
821821
Exiting();
822822
return true;
823823
}
824824
}
825+
826+
// Open file with Windows File Dialogue
827+
if (sFileName == "*open") {
828+
// Use the Windows File Dialogue
829+
std::cout << wordWrap("Opening with the Windows File Dialogue...\n");
830+
FileOpenGUIEngine HackerFileOpen;
831+
HackerFileOpen.FileOpenDialogue("Open a File to Use for Hacker Type");
832+
sFileName = HackerFileOpen.GetRetrievedPathName();
833+
if (sFileName == "") {
834+
Exiting();
835+
return true;
836+
}
837+
}
825838

826839
if (bStartImmediately == false) {
827840
std::cout << '\n';

0 commit comments

Comments
 (0)