Piznium trash code storage

Garbage
Store code snippets from piznium that are absolutely trash - no one knows if it will be reused later!

Broken simple operator solver
returned = nil

function m22_basicOper(type,first,second) if type == "+" then returned = tonumber(first) + tonumber(second) elseif type == "-" then returned = tonumber(first) - tonumber(second) elseif type == "*" then returned = tonumber(first) * tonumber(second) elseif type == "/" then returned = tonumber(first) / tonumber(second) elseif type == "%" then returned = tonumber(first) % tonumber(second) elseif type == "^" then returned = tonumber(first) ^ tonumber(second) elseif type == "-q" then returned = math.sqrt(tonumber(first)) elseif type == "-a" then returned = math.abs(tonumber(first)) elseif type == "-s" then returned = math.sin(tonumber(first)) elseif type == "-c" then returned = math.cos(tonumber(first)) elseif type == "-t" then returned = math.tan(tonumber(first)) elseif type == "!v" then returned = math.floor(tonumber(first)) elseif type == "!^" then returned = math.ceil(tonumber(first)) elseif type == "!-" then returned = math.floor(tonumber(first) + 0.5) elseif type == "-l" then returned = math.log(tonumber(first)) elseif type == "-l10" then returned = math.log10(tonumber(first)) elseif end end

m22_basicOper("-",7,6) print(returned)

Unfinished
Ones that don't work perfectly but aren't garbage :P

Base function solver
returned = ""

local funcCalls = { "math.abs","7, )", "math.sin","8, )", "math.cos","returned = 5", "math.tan","10, )", }

local neededFunc = "math.cos"

function tempDebugInfo(message) print("Temporary debug information: " .. message) end

local howManyNeededCalls = 0 for i in pairs(funcCalls) do howManyNeededCalls = howManyNeededCalls + 1 end howManyNeededCalls = math.floor(howManyNeededCalls) local i = 1 local fulfilled = false repeat tempDebugInfo("Checking " .. funcCalls[i] .. " (" .. i .. " in list)") if funcCalls[i] == neededFunc then tempDebugInfo("(" .. funcCalls[i] .. " is indeed needed function)") fulfilled = true local fst = funcCalls[i + 1] loadstring(fst) break end i = i + 2 until i > howManyNeededCalls if fulfilled then tempDebugInfo("All done.") else tempDebugInfo("Can't find match for " .. neededFunc) end print(returned)

Pizn in C test
using namespace std;
 * 1) include
 * 2) include
 * 3) include // Probably not needed

const string nl = "\n"; // Newline const string tdent = " "; // Two indent int doing = 0; int doLine = 1;

void printStr(string message) { cout << message; }

void error(string message) { cout << "Error at line " << doLine << ":" << nl << tdent << message; }

void printList(vector const &a) { cout << "Elements: " << nl; for(int i = 0; i < a.size; i++) { cout << a.at(i) << nl; } }

vector split(string s,string delimiter) { vector got; size_t pos = 0; string token; while ((pos = s.find(delimiter)) != string::npos) { token = s.substr(0, pos); got.push_back(token); s.erase(0, pos + delimiter.length); } token = s.substr(0, pos); got.push_back(token); s.erase(0, pos + delimiter.length); return got; }

vector stSplit(string s,string delimiter) { // split but stuff in strings are ignored return split(s,delimiter); // Temporary }

vector splitFunc(string funcAsString) { vector ct = split(funcAsString,"("); vector gtArgs = split(ct[0],".");  vector gtParams = stSplit(ct[1].substr(0,ct[1].size - 1),",");  vector gtFinal = {gtArgs,gtParams};  return gtFinal; }

void runOneLine(string lineAsString) { vector ct = splitFunc(lineAsString); string module = ct[0][0]; string function = ct[0][1]; if (module == "main") { if (function == "print") { printStr(param(0)); } else { error("Module \"" + module + "\" doesn't have function \"" + function + "\"."); } } else { error("Unknown module \"" + module + "\"."); } }

void runPiznCode { runOneLine("mains.prints(hello,hgaha,crunchtt,'Monachel)"); // temporary }

int main { cout << "\n\n...\n\n"; runPiznCode; cout << "\n\n...\n\nProcess finished."; return 0; } (Done 24 March 2022 17:56 UTC+7)

// Imports
 * 1) include 
 * 2) include 

// Variables

// Constants

// Config vars and config-related functions int strictMode = 0; bool showLogs = false; bool showErrors = false;

void funcsMainQuickstart { strictMode = 0; showLogs = true; showErrors = true; }

bool strictModeEnabled { if (strictMode == 1 || strictMode == 4) { return true; } return false; }

// Log/error char* latestLog = ""; char* latestErrorMsg = ""; int latestErrorLine = 0;

void log(message) { }

// Parser/splitter void parseLine(lineToParse) { }

int main { // Write C code here printf("Hello world"); return 0; } o

Really garbage
Not gonna be reused.

using namespace std;
 * 1) include

class flexnum { public: int nsp1; int nsp2; int nsp3; int nsp4; };

int main { // "Flexnum" type thing test, can exceed int limit flexnum test;

// Store 74676833905748 test.nsp1 = 746768339; test.nsp2 = 105748; test.nsp2 = test.nsp2 - 100000; cout << test.nsp1 + test.nsp2; return 0; } (in C++)