-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathintention_repeater_max_3.2.cpp
363 lines (281 loc) · 12.1 KB
/
intention_repeater_max_3.2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
/*
Intention Repeater MAX v3.2 created by Thomas Sweet.
Performance benchmark, enhancement and flags by Karteek Sheri.
Created 11/12/2020 for C++.
Directions to compile on Windows: https://github.com/tsweet77/repeater-max/blob/main/Win_MAX_Compile_Directions.txt
To compile on Linux (Requires 64-bit Compiler): g++ ./intention_repeater_max.cpp -O3 -o ./intention_repeater_max
Repeats your intention up to 100+ million times per second to make things happen.
For help: intention_repeater_max.exe --help
Intention Repeater MAX is powered by a Servitor (20 Years / 2000+ hours in the making) [HR 6819 Black Hole System].
Servitor Info: https://enlightenedstates.com/2017/04/07/servitor-just-powerful-spiritual-tool/
Website: https://www.intentionrepeater.com/
Forum: https://forums.intentionrepeater.com/
Licensed under GNU General Public License v3.0
This means you can modify, redistribute and even sell your own modified software, as long as it's open source too and released under this same license.
https://choosealicense.com/licenses/gpl-3.0/
*/
#include <stdio.h>
#include <string>
#include <string.h>
#include <math.h>
#include <iostream>
#include <time.h>
#include <ctime>
#include <ratio>
#include <chrono>
#include <iomanip>
#include <locale.h>
//#include <atomic>
#include <cstdint>
#include <vector>
#include <iterator>
#include <sstream>
using namespace std;
using namespace std::chrono;
#define ONE_MINUTE 60
#define ONE_HOUR 3600
//#define SCALED //uncomment this if you want to use suffix or suffix_hz in your code
std::string PROCESS_STATEMENT = " REGULATE/INTEGRATE/OM";
class comma_numpunct: public std::numpunct < char > {
protected: virtual char do_thousands_sep() const {
return ',';
}
virtual std::string do_grouping() const {
return "\03";
}
};
#ifdef SCALED
static const char* short_scale[] = {
"",
"k",
"M",
"B",
"T",
"q",
"Q",
"s",
"S"
};
static const char* short_scale_hz[] = {
"",
"k",
"M",
"G",
"T",
"P",
"E",
"Z",
"Y"
};
const char* scale(unsigned long long int n, int decimals = 1, const char* units[] = short_scale)
{
/*
* Number of digits in n is given by
* 10^x = n ==> x = log(n)/log(10) = log_10(n).
*
* So 1000 would be 1 + floor(log_10(10^3)) = 4 digits.
*/
int digits = n==0? 0 : 1+floor(log10l(fabs(n)));
// determine base 10 exponential
int exp = digits <= 4? 0 : 3*((digits-1)/3);
// normalized number
double m = n / powl(10, exp);
// no decimals? then don't print any
if ( m - static_cast<long>(n) == 0 )
decimals = 0;
// don't print unit for exp<3
static char s[64];
static const char* fmt[] = {"%1.*lf%s", "%1.*lf"};
sprintf(s, fmt[exp<3], decimals, m, units[exp/3]);
return s;
}
const char* suffix(unsigned long long int n, int decimals = 1)
{
static char s[64];
strcpy(s, scale(n, decimals, short_scale));
return s;
}
const char* suffix_hz( unsigned long long int n, int decimals = 1)
{
static char s[64];
strcpy(s, scale(n, decimals, short_scale_hz));
return s;
}
#endif
std::string FormatTimeRun(int seconds_elapsed) {
int hour, min, sec;
std::string hour_formatted, min_formatted, sec_formatted;
hour = seconds_elapsed / ONE_HOUR;
seconds_elapsed -= hour * ONE_HOUR;
min = seconds_elapsed / ONE_MINUTE;
seconds_elapsed -= min * ONE_MINUTE;
sec = seconds_elapsed;
if (hour < 10) {
hour_formatted = "0" + std::to_string(hour);
} else {
hour_formatted = std::to_string(hour);
}
if (min < 10) {
min_formatted = "0" + std::to_string(min);
} else {
min_formatted = std::to_string(min);
}
if (sec < 10) {
sec_formatted = "0" + std::to_string(sec);
} else {
sec_formatted = std::to_string(sec);
}
return hour_formatted + ":" + min_formatted + ":" + sec_formatted;
}
void print_help() {
cout << "Intention Repeater MAX v3.2 (c)2020 Thomas Sweet aka Anthro Teacher." << endl;
cout << "Performance benchmark, exponents and flags by Karteek Sheri." << endl;
cout << "Intention multiplying by Thomas Sweet." << endl << endl;
cout << "Optional Flags:" << endl;
cout << " a) --dur or -d" << endl;
cout << " b) --imem or -m" << endl;
cout << " c) --intent or -i" << endl;
cout << " d) --help" << endl << endl;
cout << "--dur = Duration in HH:MM:SS format. Example 00:01:00 to run for one minute. Default = \"Until Stopped\"." << endl;
cout << "--imem = Specify how many GB of System RAM to use. Default = 1.0. Higher amount produces a faster repeat rate, but takes longer to load into memory." << endl;
cout << "--intent = Intention. Default = Prompt the user for intention." << endl;
cout << "--help = Display this help." << endl << endl;
cout << "Example automated usage: intention_repeater_max.exe --dur 00:01:00 --imem 4.0 --intent \"I am calm.\"" << endl;
cout << "Default usage: intention_repeater_max.exe" << endl << endl;
cout << "gitHub Repository: https://github.com/tsweet77/repeater-max" << endl;
cout << "Forum: https://forums.intentionrepeater.com" << endl;
cout << "Website: https://www.intentionrepeater.com" << endl;
}
// Utility function to find the sum of two numbers represented as a string in CPP
std::string findsum(std::string a, std::string b){
std::vector<int>finalsum; // Stores the final sum of two number
int carry=0; // Stores carry at each stage of calculation
/* Step 1 starts here */
int i = a.size()-1,j=b.size()-1; // Start adding from lowest significant bit
while((i>=0) && (j>=0)){ // Loop until either of number exhausts first
int x = (a[i]-'0') + (b[j]-'0') + carry; // Calculate the sum of digit in final sum by adding respective digits with previous carry.
finalsum.push_back(x%10); // Store the respective digit of the final sum in a vector.
carry = x/10; // update the carry. The carry for next step is the remaining number after forming the digit of final sum.
i--; // Move one step towards the left in both the string(numbers)
j--;
}
/* Step 2 starts here */
while(i>=0){ // If the number 1 was greater than number 2, then there must be some digits to be taken care off.
int x = (a[i]-'0') + carry; // Add the remaining digits to the carry one by one and store the unit digit.
finalsum.push_back(x%10);
carry = x/10; // update the carry from each step.
i--;
}
/* Step 3 starts here */
while(j>=0){ // If the number 2 was greater than number 1, then there must be some digits to be taken care off.
int x = (b[j]-'0') + carry; // Add the remaining digits to the carry one by one and store the unit digit.
finalsum.push_back(x%10);
carry = x/10; // update the carry from each step.
j--;
}
/* Step 4 starts here */
while(carry){ //If after finishing addition of the two numbers, if there is still carry/leftover then we need to take it into the final sum.
finalsum.push_back(carry%10); // Store digit one by one.
carry=carry/10; // Reduce carry
}
/* Step 5 starts here */
std::stringstream final_iter;
// Since vector pushes value at last, the most significant digits starts at the end of the vector. Thus print reverse.
std::copy(finalsum.rbegin(), finalsum.rend(), std::ostream_iterator<int>(final_iter,""));
return final_iter.str();
}
int main(int argc, char ** argv) {
std::string intention, process_intention,intention_value,duration,param_duration,param_intention,runtime_formatted, ref_rate="Average";
unsigned long long int iterations = 0, cpu_benchmark_count = 0;
int seconds = 0; unsigned long long multiplier = 0; float ram_size_value = 1;
///parse command line arguments
param_duration = "Until Stopped"; param_intention = "";
for(int i = 1; i < argc; i++){
if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ){
print_help();
exit(0);
}else if(!strcmp(argv[i], "-d") || !strcmp(argv[i], "--dur")){
param_duration = argv[i+1];
}else if(!strcmp(argv[i], "-m") || !strcmp(argv[i], "--imem")){
ram_size_value = atof(argv[i+1]);
}else if(!strcmp(argv[i], "-r") || !strcmp(argv[i], "--rate")){
ref_rate = argv[i+1];
}else if(!strcmp(argv[i], "-i") || !strcmp(argv[i], "--intent")){
param_intention = argv[i+1];
}else{
if(i == argc-1){
break;
}
std::cout<<"ERROR: Invalid Command Line Option Found: "<< argv[i]<< " Error "<<std::endl;
} i++;
}
unsigned long long int INTENTION_MULTIPLIER = (ram_size_value*1024*1024*512);
std::locale comma_locale(std::locale(), new comma_numpunct());
std::cout.imbue(comma_locale);
cout << "Intention Repeater MAX v3.2 created by Thomas Sweet." << endl;
cout << "Performance benchmark, enhancements and flags by Karteek Sheri." << endl;
cout << "Intention multiplier by Thomas Sweet." << endl;
cout << "This software comes with no guarantees or warranty of any kind and is for entertainment purposes only." << endl;
cout << "Press Ctrl-C to quit." << endl << endl;
if ((param_intention) == "") {
cout << "Intention: ";
std::getline(std::cin, intention);
} else {
intention = param_intention;
}
cout << "Loading Intention into Memory." << std::flush;
//Repeat string till it is more than INTENTION_MULTIPLIER characters long.
while (intention_value.length() < INTENTION_MULTIPLIER) {
intention_value += intention;
++multiplier;
}
--multiplier; //Account for having to reduce at the end.
//Now, remove enough characters at the end to account for the process statement to limit to less than 1024 characters.
long long int intention_value_length = intention_value.length();
long long int intention_length = intention.length();
int process_statement_length = PROCESS_STATEMENT.length();
long long int intention_length_val = intention_value_length - intention_length - process_statement_length;
intention_value = intention_value.substr(0,intention_length_val);
intention_value += PROCESS_STATEMENT;
intention_value = intention + PROCESS_STATEMENT;
duration = param_duration;
//This code is to benchmark cpu iterations. By Karteek Sheri.
auto b_start = std::chrono::system_clock::now();
auto b_end = std::chrono::system_clock::now();
while ((std::chrono::duration_cast < std::chrono::seconds > (b_end - b_start).count() != 1))
{
process_intention = intention_value; //The Intention Repeater Statement
++cpu_benchmark_count;
b_end = std::chrono::system_clock::now();
}
//Benchmark ends here
cout << endl;
auto start = std::chrono::system_clock::now();
auto end = std::chrono::system_clock::now();
std::string iterations_string= "0",iterations_string_freq= "0";
int digits = 0, freq_digits = 0;
do {
start = std::chrono::system_clock::now();
while ((std::chrono::duration_cast < std::chrono::seconds > (end - start).count() != 1)) {
for(int i=0;i<cpu_benchmark_count;++i){
process_intention = intention_value; //This is the Intention Repeater call that actually does the work with the Servitor.
++iterations;
}
end = std::chrono::system_clock::now();
}
++seconds;
runtime_formatted = FormatTimeRun(seconds);
iterations_string_freq = to_string(iterations * multiplier);
iterations_string= findsum(iterations_string, iterations_string_freq );
digits = iterations_string.length();
freq_digits = iterations_string_freq.length();
std::cout<< "[" + runtime_formatted + "]" << " (" <<setprecision(3)<<fixed<<(stoull(iterations_string.substr(0,4)))/pow(10,3)<<"x10^"<<digits-1<<" / "<<(stoull(iterations_string_freq.substr(0,4))/pow(10,3))<<"x10^"<<freq_digits-1<<" Hz): "<<intention<<" \r" << std::flush;
iterations =0;
if (runtime_formatted == duration) {
std::cout << endl << std::flush;
exit(0);
}
} while (1);
std::cout << endl << std::flush;
return 0;
}