Skip to main content

Challenge #4: Create a futuristic technology [COMPLETED]

Created
Active
Viewed 13k times
12 entries
38

List of awardees for the fourth Stack Overflow coding challenge; information is repeated below image in plaintext

Awards for the fourth Stack Overflow code challenge:

Most Upvotes: Davide Fiocco
Vision Architect: 12Kittens
New Contributor: Prakhar Agarwal

All of the awards given (aside from most upvotes) are subjective - Stack Overflow developers had a lot of fun reading through everyone's work and recognizing the entries that stood out.

Update on July 22, 2025: This challenge is now closed! Entries can still be posted and votes can still be cast, but they will not count towards determining the winners of the challenge. Winners will be announced soon.

Man climbing a mountain

Thanks for coming back for the fourth Stack Overflow code challenge, and welcome to those who are new. This challenge is three weeks long.

For more context on what this is and why we’re doing it, you can check out this post on Stack Overflow Meta. If you have feedback on the challenge itself, that’s the place to send it!

The Challenge

Science fiction inspires us with visions of futuristic technologies like matter replicators, interplanetary tourism, mixed reality spaces and more. While some of these still seem like fantasy, others might be available in the near future.

In this challenge, we want to see if you can bring the future into the present. Can you create a futuristic technology? Or even a portion of it?

For example, you could focus on smart home technology. In the future, perhaps your home would automatically make food for you. In this challenge, you could create a food prediction software that would know what kind of food you’d like to eat.

As another example, creating an immersive 3D room experience (inspired by something like the Holodeck from Star Trek) might require a user interface to allow participants to choose an experience. How might that interaction work? What options would it provide, and how would their choices be reflected in a scenario’s creation?

Consider what role Artificial Intelligence might play in your tech. Perhaps it can help you with the challenge. This challenge is open-ended, and you can take any aspect of a future technology that appeals to you. Note: this should specifically be something that does not exist yet in the real world. You are encouraged to use your imagination and/or draw inspiration from books, films, and other sources.

It’s likely that these futuristic technologies would include a combination of hardware and software aspects. For the sake of this challenge, we want to focus on just the software portion, though you could make reference to any hardware inputs or outputs as needed.

How does the actual contest work?

You have three weeks from the date this challenge is posted to submit your entry. For the first two weeks, other entries are only visible once you have submitted your own. After that, anyone can view and vote on others’ entries.

July 1: Challenge goes live

July 15: All entries visible to everyone

July 21: Challenge ends

How to Submit:

Even though the theme of this challenge relates to the use of AI technologies, we still expect your entry to be written by you. AI assistance with coding or debugging is permitted if it is disclosed in your entry and the initial code is wholly your own. It is also valid to call AI-based services for specific aspects of the solution (for example to process natural language input or create an image based on specific parameters).

Your submission should include:

  • An explanation of your approach

  • The code you have produced to create the futuristic technology

  • Some sample usage patterns

  • AI usage disclosure

  • Instructions for how others can run your code to observe how it works

  • Anything you learned or any interesting challenges you faced while coding!

How do I win?

For this coding challenge, user entries with the most upvotes will be recognized, as well as users with entries deemed to be particularly interesting by staff members. Please note that any upvotes received as part of this challenge do not count towards site reputation.

12 entries
Sorted by:
79879816
0

As far as know, artificial neural tissue is not yet used for virus analysis (although static analysis + heuristics + sandboxes are used for thus). Most of the source for utils is omitted due to 30,000-character-response-max for StackOverflow. Disclaimer: promotion of GitHub sources.
**
Howto: use local static analysis + heuristics + sandboxes + artificial CNS (central nervous systems) to secure computers; virus analysis tools improved** [This post from GitHub allows all uses. Post version is f81fb8a]

Intro

Static analysis + sandbox + CNS = 1 second (approx) analysis of new executables (secures all app launches,) but after first launch: caches reduce this to less than 1ms (just cost to compute caches.at(classSha2(ClassIoBytecode())), where caches is std::map<ResultListHash, VirusAnalysisResult> or ResultList::hashes).

../README.md has how to use this (what follows is more of a book of source code).

(Removed duplicate licenses, #if guards, #includes, namespaces (except files with >=2 namespaces), NOLINTBEGINs, NOLINTENDs from all except main.*xx; follow URLs for whole sources.)

For the most new sources (+ static libs), use apps such as iSH (for iOS) or Termux (for Android OS) to run this: git clone https://github.com/SwuduSusuwu/SusuLib.git && cd ./SusuLib/ && git switch preview && ./build.sh

To test certificates, view ../README.md#signaturecertificate + this post.

To improve how fast the whole program executes; set relevent environment flags (such as CXXFLAGS) to enable SIMD plus OpenMP.

To improve how fast backpropagation (ergo "training"; such as Cns::setupSynapses(), which {produceAnalysisCns(), produceVirusFixCns()} use) plus forwardpropagation (ergo "inference"; such as Cns::processTo*(), which {cnsAnalysisScore() and cnsVirusFix()} use) executes:

Source code

less cxx/VirusAnalysis.cxx

VirusAnalysisHook globalVirusAnalysisHook = virusAnalysisHookDefault; /* Just use virusAnalysisHook() to set+get this, virusAnalysisGetHook() to get this */
ResultList passList, abortList; /* hosts produce, clients initialize shared clones of this from disk */
#ifdef SUSUWU_USE_TENSORFLOW /* `cxx/ClassTensorFlowCns.hxx` specialization of `class Cns` */
TensorFlowCns analysisCns, virusFixCns; /* hosts produce, clients initialize shared clones of this from disk */
#else /* !defined(SUSUWU_USE_TENSORFLOW) */
Cns analysisCns, virusFixCns; /* hosts produce, clients initialize shared clones of this from disk */
#endif /* !defined(SUSUWU_USE_TENSORFLOW) */
std::vector<PortableExecutableFunctionSig> syscallPotentialDangers = {
    "memopen", "fwrite", "socket", "GetProcAddress", "IsVmPresent"
};
std::vector<std::string> stracePotentialDangers = {"write(*)"};
std::map<ResultListHash, VirusAnalysisResult> hashAnalysisCaches, signatureAnalysisCaches, staticAnalysisCaches, cnsAnalysisCaches, sandboxAnalysisCaches, manualReviewCaches; /* temporary caches; memoizes results */
void virusAnalysisResetCaches() SUSUWU_NOEXCEPT {
    hashAnalysisCaches.clear();
    signatureAnalysisCaches.clear();
    staticAnalysisCaches.clear();
    cnsAnalysisCaches.clear();
    sandboxAnalysisCaches.clear();
}
std::vector<VirusAnalysisFun> virusAnalyses = {hashAnalysis, signatureAnalysis, staticAnalysis, cnsAnalysis, sandboxAnalysis /* sandbox is slow, so put last*/};

bool virusAnalysisResultListIndex = false, virusAnalysisResultListWhitespace = false, virusAnalysisResultListPascal = true;
const bool virusAnalysisInit(const ClassIoPath &path, ResultList &passList, ResultList &abortList) {
    virusAnalysisLoadFrom(path + ".passOrNull.config", passList);
    virusAnalysisLoadFrom(path + ".abortOrNull.config", abortList);
    return true;
} /* TODO: handle exceptions in this? */
void virusAnalysisDumpTo(const ClassIoPath &path, const ResultList &list) {
    std::ofstream config(path);
    resultListDumpTo(list, config, virusAnalysisResultListIndex, virusAnalysisResultListWhitespace, virusAnalysisResultListPascal);
}
void virusAnalysisLoadFrom(const ClassIoPath &path, ResultList &list) {
#if IFSTREAM_HAS_IOS_BASE
    std::ifstream config(path);
#else
    const PortableExecutableBytecode configPE(path);
    std::stringstream config(configPE.bytecode);
#endif /* ! IFSTREAM_HAS_IOS_BASE */
    list.hashes.clear(); list.signatures.clear(); list.bytecodes.clear(); /* TODO: have `listLoadFrom()` do? */
    resultListLoadFrom(list, config, virusAnalysisResultListIndex, virusAnalysisResultListWhitespace, virusAnalysisResultListPascal);
}
#if SUSUWU_UNIT_TESTS
const bool virusAnalysisTests() {
    ResultList abortOrNull; {
        abortOrNull.hashes = {}, abortOrNull.signatures = {}, abortOrNull.bytecodes = { /* Produce from an antivirus vendor's (such as VirusTotal.com's) infection databases */
            "infection",
            "infectedSW",
            "corruptedSW",
            ""
        };
    }
    ResultList passOrNull; {
        passOrNull.hashes = {}, passOrNull.signatures = {}, passOrNull.bytecodes = { /* Produce from an antivirus vendor's (such as VirusTotal.com's) fresh-files databases */
            "",
            "SW",
            "SW",
            "newSW"
        };
    }
    resultListProduceHashes(passOrNull);
    resultListProduceHashes(abortOrNull);
    produceAbortListSignatures(passOrNull, abortOrNull);
    const ClassIoPath gotOwnPath = classIoGetOwnPath(); /* replaced `argv[0]`, ["Uncontrolled data used in path expression"](https://github.com/SwuduSusuwu/SusuLib/security/code-scanning/1277) fix. */
    virusAnalysisInitTests(gotOwnPath, passOrNull, abortOrNull);
    SUSUWU_NOTICE("resultListDumpTo(.list = passOrNull, .os = std::cout, .index = true, .whitespace = true, .pascalValues = false);");
    SUSUWU_EXECUTEVERBOSE(resultListDumpTo(passOrNull, std::cout, true, true, false));
    SUSUWU_NOTICE_EXECUTEVERBOSE((resultListDumpTo(/*.list = */abortOrNull, /*.os = */std::cout, /*.index = */false, /*.whitespace = */false, /*.pascalValues = */false), std::cout << std::endl));
    assert(4 == passOrNull.bytecodes.size());
    assert(passOrNull.bytecodes.size() - 1 /* 2 instances of "SW", discount dup */ == passOrNull.hashes.size());
    assert(0 == passOrNull.signatures.size()); /* NOLINT(readability-container-size-empty); all `.size()`, intuitive */
    assert(4 == abortOrNull.bytecodes.size());
    assert(abortOrNull.bytecodes.size() == abortOrNull.hashes.size());
    assert(abortOrNull.bytecodes.size() - 1 /* discount empty substr */ == abortOrNull.signatures.size());
    produceAnalysisCns(passOrNull, abortOrNull, ResultList(), analysisCns);
    produceVirusFixCns(passOrNull, abortOrNull, virusFixCns);
    if(ClassIoPath() != gotOwnPath) {
        const PortableExecutableBytecode executable(gotOwnPath);
        if(virusAnalysisAbort == virusAnalysisInteractive(executable)) {
            throw std::runtime_error(SUSUWU_ERRSTR(SUSUWU_SH_ERROR, "{virusAnalysisAbort == virusAnalysisInteractive((args[0]);} /* With such false positives, shouldn't hook kernel modules (next test is to hook+unhook `exec*` to scan programs on launch). */"));
        }
        const ResultList origPassList = passList, origAbortList = abortList;
        passList.bytecodes.push_back(executable.bytecode);
        abortList.bytecodes.push_back("test");
        produceAbortListSignatures(passList, abortList);
        if(virusAnalysisAbort == virusAnalysisInteractive(executable)) {
            throw std::runtime_error(SUSUWU_ERRSTR(SUSUWU_SH_ERROR, "{virusAnalysisAbort == virusAnalysisInteractive(args[0]);} /* Ignored `signaturesAnalysisCaches`. */"));
        }
        virusAnalysisResetCaches();
        if(virusAnalysisAbort != virusAnalysisInteractive(executable)) {
            throw std::runtime_error(SUSUWU_ERRSTR(SUSUWU_SH_ERROR, "{virusAnalysisAbort != virusAnalysisInteractive(args[0]);} /* This test was supposed to match positive but did not. */"));
        }
        passList = origPassList, abortList = origAbortList;
    }
    const bool originalRootStatus = classSysHasRoot();
    classSysSetRoot(true);
    virusAnalysisHookTests();
    classSysSetRoot(originalRootStatus);
    return true;
}

const bool virusAnalysisInitTests(const ClassIoPath path, ResultList &passList, ResultList &abortList) {
    const std::string passPath = path + ".passList.config";
    const std::string abortPath = path + ".abortList.config";
    try {
        const std::ifstream config(passPath);
    } catch (std::exception &w) {
        SUSUWU_WARNING("`std::ifstream config(\"" + passPath + "\");` threw \" " + w.what() + "\"; will skip `virusAnalysisDumpTo()` and `virusAnalysisLoadFrom()` tests.");
        return false;
    }
    virusAnalysisDumpTo(passPath, passList);
    virusAnalysisDumpTo(abortPath, abortList);
    SUSUWU_NOTICE("resultListDumpTo(.list = passList, .os = std::cout, .index = true, .whitespace = true, .pascalValues = false);");
    SUSUWU_EXECUTEVERBOSE(resultListDumpTo(passList, std::cout, true, true, false));
    SUSUWU_NOTICE_EXECUTEVERBOSE((resultListDumpTo(/*.list = */abortList, /*.os = */std::cout, /*.index = */false, /*.whitespace = */false, /*.pascalValues = */false), std::cout << std::endl));
    virusAnalysisLoadFrom(passPath, passList);
    virusAnalysisLoadFrom(abortPath, abortList);
    return true;
}
const bool virusAnalysisHookTests() {
    const VirusAnalysisHook originalHookStatus = virusAnalysisGetHook();
    VirusAnalysisHook hookStatus = virusAnalysisHook(virusAnalysisHookClear | virusAnalysisHookExec);
    if(virusAnalysisHookExec != hookStatus) {
        throw std::runtime_error("`virusAnalysisHook(virusAnalysisHookClear | virusAnalysisHookExec)` == " + std::to_string(hookStatus));
        return false; /* cppcheck-suppress duplicateBreak */
    }
    hookStatus = virusAnalysisHook(virusAnalysisHookClear | virusAnalysisHookNewFile);
    if(virusAnalysisHookNewFile != hookStatus) {
        throw std::runtime_error("`virusAnalysisHook(virusAnalysisHookClear | virusAnalysisHookNewFile)` == " + std::to_string(hookStatus));
        return false; /* cppcheck-suppress duplicateBreak */
    }
    hookStatus = virusAnalysisHook(virusAnalysisHookClear);
    if(virusAnalysisHookDefault != hookStatus) {
        throw std::runtime_error("`virusAnalysisHook(virusAnalysisHookClear)` == " + std::to_string(hookStatus));
        return false; /* cppcheck-suppress duplicateBreak */
    }
    hookStatus = virusAnalysisHook(virusAnalysisHookExec | virusAnalysisHookNewFile);
    if((virusAnalysisHookExec | virusAnalysisHookNewFile) != hookStatus) {
        throw std::runtime_error("`virusAnalysisHook(virusAnalysisExec | virusAnalysisHookNewFile)` == " + std::to_string(hookStatus));
        return false; /* cppcheck-suppress duplicateBreak */
    }
    hookStatus = virusAnalysisHook(virusAnalysisHookClear | originalHookStatus);
    if(originalHookStatus != hookStatus) {
        throw std::runtime_error("`virusAnalysisHook(virusAnalysisHookClear | originalHookStatus)` == " + std::to_string(hookStatus));
        return false; /* cppcheck-suppress duplicateBreak */
    }
    return true;
}
#endif /* SUSUWU_UNIT_TESTS */

static const bool virusAnalysisImpl(const PortableExecutable &file) {
    switch(virusAnalysis(file)) {
    case virusAnalysisPass:
        return true; /* launch this */
    case virusAnalysisRequiresReview:
        return (virusAnalysisPass == virusAnalysisManualReview(file));
    default:
        return false; /* abort */
    }
}
const VirusAnalysisHook virusAnalysisHook(VirusAnalysisHook hookStatus) { /* Ignore depth-of-1 recursion: NOLINT(misc-no-recursion) */
    const VirusAnalysisHook originalHookStatus = globalVirusAnalysisHook;
    if(virusAnalysisHookQuery == hookStatus || originalHookStatus == hookStatus) {
        return originalHookStatus;
    }
    if(virusAnalysisHookClear & hookStatus) {
        /* TODO: undo OS-specific "hook"s/"callback"s */
        globalVirusAnalysisHook = virusAnalysisHookDefault;
    }
    if(virusAnalysisHookExec & hookStatus) {
#ifdef SUSUWU_POSIX
        auto lambdaScanExecv = [](const char *pathname, char *const argv[]) { /* NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays); this is the standard function signature. */ /* cppcheck-suppress constParameter */
            return static_cast<int>(virusAnalysisImpl(PortableExecutable(pathname)));
        };
        classSysKernelSetHook(execv, lambdaScanExecv);
#elif defined(SUSUWU_WIN32) /* def SUSUWU_POSIX else */
        auto lambdaScanCreateProcessA = [](LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR                lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) {
            return virusAnalysisImpl(PortableExecutable(lpApplicationName));
        };
        classSysKernelSetHook(CreateProcessA, lambdaScanCreateProcessA);
#else /* defined(SUSUWU_WIN32) else */
        SUSUWU_ERROR("virusAnalysisHook(virusAnalysisHookExec) { if(!SUSUWU_POSIX && !SUSUWU_WIN32) { /* TODO: you can contribute or post to https://github.com/SwuduSusuwu/SusuLib/issues/new */ } }");
#endif /* defined(SUSUWU_WIN32) else */
        globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookExec);
    }
    if(virusAnalysisHookNewFile & hookStatus) {
//      classSysKernelSetHook(fwrite, lambdaScanFwrite); /* TODO: OS-specific "hook"/"callback" for new files/downloads */
        globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookNewFile);
    }
    return virusAnalysisGetHook();
}

const VirusAnalysisResult virusAnalysis(const PortableExecutable &file) {
    const auto fileHash = classSha2(file.bytecode);
    for(const auto &analysis : virusAnalyses) {
        switch(analysis(file, fileHash)) {
            case virusAnalysisPass:
                return virusAnalysisPass;
            case virusAnalysisRequiresReview:
                return virusAnalysisRequiresReview;
            case virusAnalysisAbort:
                return virusAnalysisAbort;
            case virusAnalysisContinue:
                continue;
        }
    }
    return virusAnalysisPass;
}
const VirusAnalysisResult virusAnalysisRemoteAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    SUSUWU_NOTICE("virusAnalysisRemoteAnalysis: {/* TODO: compatible hosts to upload to */}");
    return virusAnalysisRequiresReview;
}
const VirusAnalysisResult virusAnalysisManualReviewCacheless(const PortableExecutable &file, const ResultListHash &fileHash) {
    SUSUWU_INFO("virusAnalysis(\"" + file.path + "\") {return virusAnalysisRequiresReview;}, what do you wish to do?");
    while(true) {
        std::cout << "Allowed responses: ab(o)rt = `virusAnalysisAbort`, (s)ubmit to remote host for analysis /* TODO */ = `virusAnalysisRequiresReview`, la(u)nch = `virusAnalysisPass`. {'o', 's', or 'u'}. Input response: [s]";
        const char defaultResponse = 's';
        char response = defaultResponse;
        if(!std::cin.get(response)) {
            SUSUWU_INFO("virusAnalysisManualReview(): {(!std::cin.get(response)) /* Input disabled */}, will assume default response.");
        } else if('\n' != response) {
            std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
        }
        if('\n' == response || '\r' == response) {
            response = defaultResponse;
        }
        switch(response) {
        case 'o':
            return virusAnalysisAbort;
        case 's':
            return virusAnalysisRemoteAnalysis(file, fileHash);;
        case 'u':
            return virusAnalysisPass;
        default:
            SUSUWU_WARNING(std::string("virusAnalysisManualReview(): {\"response: '") + response + "'\" isn't valid. Choose from list (or press <enter> to default to '" + defaultResponse + "')}");
        }
    }
}

const VirusAnalysisResult hashAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    try {
        const auto result = hashAnalysisCaches.at(fileHash);
        return result;
    } catch (...) {
        if(listHasValue(passList.hashes, fileHash)) {
            return hashAnalysisCaches[fileHash] = virusAnalysisPass;
        } else if(listHasValue(abortList.hashes, fileHash)) {
            SUSUWU_NOTICE("hashAnalysis(/*.file =*/ \"" + file.path + "\", /*.fileHash =*/ 0x" + classIoHexStr(fileHash) + ") {return virusAnalysisAbort;} /* due to hash 0x" + classIoHexStr(fileHash) + " (found in `abortList.hashes`). You should treat this as a virus detection if this was not a test. */");
            return hashAnalysisCaches[fileHash] = virusAnalysisAbort;
        } else {
            return hashAnalysisCaches[fileHash] = virusAnalysisContinue; /* continue to next tests */
        }
    }
}

const VirusAnalysisResult signatureAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    try {
        const auto result = signatureAnalysisCaches.at(fileHash);
        return result;
    } catch (...) {
        auto match = listFindSignatureOfValue(abortList.signatures, file.bytecode);
        if(-1 != match.fileOffset) {
            SUSUWU_NOTICE("signatureAnalysis(/*.file =*/ \"" + file.path + "\", /*.fileHash =*/ 0x" + classIoHexStr(fileHash) + ") {return virusAnalysisAbort;} /* due to signature 0x" + classIoHexStr(match.signature) + " found at offset=" + std::to_string(match.fileOffset) + ". You should treat this as a virus detection if this was not a test. */");
            return signatureAnalysisCaches[fileHash] = virusAnalysisAbort;
        }
        return signatureAnalysisCaches[fileHash] = virusAnalysisContinue;
    }
}

void produceAbortListSignatures(const ResultList &passList, ResultList &abortList) {
    abortList.signatures.reserve(abortList.bytecodes.size());
    for(const auto &file : abortList.bytecodes) {
        const auto tuple = listProduceSignature(passList.bytecodes, file);
        const auto itBegin = std::get<0>(tuple),  itEnd = std::get<1>(tuple);
        if(itBegin < itEnd) { /* require `(0 < ResultListSignature.size())` to prevent crashes */
            abortList.signatures.push_back(ResultListSignature(itBegin, itEnd));
        }
    } /* The most simple signature is a substring, but some analyses use regexes. */
}

const std::vector<PortableExecutableFunctionSig> importedFunctionsList(const PortableExecutable &file) {
    return file.importedFunctionsList(); /* List of lib functions which the SW `call`s (or `jmp`s to). */
/* TODO: use [**x86** instruction list for _Intel_+_AMD_](https://wikipedia.org/wiki/x86),
 * plus [**arm64** instruction list for most tablets+smartphones](https://wikipedia.org/wiki/aarch64),
 * to produce lists of OS functions the SW uses without libs; `int`s (or `syscall`s) to.
 * Plus, instructions lists show how to parse which arguments the SW gives to functions/syscalls (simple for constant arguments such as `push 0x2; call function;`,
 * but if SW uses registers/addresses as arguments (such as `push eax; push [address]; call [address2];`) must guess what is `[eax]`/`[address]`/`[address2]` (or use `strace` or such debug tools).
 *
 * If this tool [parses `GetProcAddress` arguments to know which functions are used](https://www.codeproject.com/Questions/338807/How-to-get-list-of-all-imported-functions-invoked), `syscallPotentialDangers[]` does not have to include `GetProcAddress()`.
 */
}

const VirusAnalysisResult staticAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    try {
        const auto result = staticAnalysisCaches.at(fileHash);
        return result;
    } catch (...) {
        auto syscallsUsed = importedFunctionsList(file);
        std::sort(syscallPotentialDangers.begin(), syscallPotentialDangers.end());
        std::sort(syscallsUsed.begin(), syscallsUsed.end());
        if(listsIntersect(syscallPotentialDangers, syscallsUsed)) {
            return staticAnalysisCaches[fileHash] = virusAnalysisRequiresReview;
        }
        return staticAnalysisCaches[fileHash] = virusAnalysisContinue;
    }
}

const VirusAnalysisResult sandboxAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    try {
        const auto result = sandboxAnalysisCaches.at(fileHash);
        return result;
    } catch (...) {
#ifdef SUSUWU_POSIX
        execvex("cp -r '/usr/home/sandbox/' '/usr/home/sandbox.bak'"); /* or produce FS snapshot */
        execvex("cp '" + file.path + "' '/usr/home/sandbox/'");
        execvex("chroot '/usr/home/sandbox/' \"strace basename '" + file.path + "'\" >> strace.outputs");
        execvex("mv/ '/usr/home/sandbox/strace.outputs' '/tmp/strace.outputs'");
        execvex("rm -r '/usr/home/sandbox/' && mv '/usr/home/sandbox.bak' '/usr/home/sandbox/'"); /* or restore FS snapshot */
        return sandboxAnalysisCaches[fileHash] = straceOutputsAnalysis("/tmp/strace.outputs");
#else /* ndef SUSUWU_POSIX */
        SUSUWU_ERROR("sandboxAnalysis: {#ifndef SUSUWU_POSIX /* TODO: convert to win32 */}");
        return sandboxAnalysisCaches[fileHash] = virusAnalysisRequiresReview;
#endif /* ndef SUSUWU_POSIX */
    }
}
const VirusAnalysisResult straceOutputsAnalysis(const ClassIoPath &straceOutput) {
        auto straceDump = std::ifstream(straceOutput);
        std::vector<std::string> straceOutputs /*= explodeToList(straceDump, "\n")*/;
        for(std::string straceOutputIt; std::getline(straceDump, straceOutputIt); ) {
            straceOutputs.push_back(straceOutputIt);
        }
        std::sort(stracePotentialDangers.begin(), stracePotentialDangers.end());
        std::sort(straceOutputs.begin(), straceOutputs.end());
        if(listsIntersect(stracePotentialDangers, straceOutputs)) { /* Todo: regex */
            return virusAnalysisRequiresReview;
        }
    return virusAnalysisContinue;
}

void produceAnalysisCns(const ResultList &pass, const ResultList &abort,
const ResultList &unreviewed /* = ResultList(), WARNING! Possible danger to use unreviewed files */,
Cns &cns /* = analysisCns */
) {
    std::vector<std::tuple<ClassIoBytecode, float>> inputsToOutputs;
    const size_t maxPassSize = listMaxSize(pass.bytecodes);
    const size_t maxAbortSize = listMaxSize(abort.bytecodes);
    const size_t maxDepthOfOpcodes = 6666; /* is not max depth of callstack, but of instruction pointer. TODO: compute this */
    const size_t maxWidthOfOpcodes = (maxPassSize > maxAbortSize ? maxPassSize : maxAbortSize);
    cns.setInputMode(objectModeString);
    cns.setOutputMode(objectModeFloat);
    cns.setInputNeurons(maxWidthOfOpcodes);
    cns.setOutputNeurons(cns.isSquareConnectome() ? maxWidthOfOpcodes : 1);
    cns.setLayersOfNeurons(maxDepthOfOpcodes);
    cns.setNeuronsPerLayer(maxWidthOfOpcodes /* TODO: reduce this */);
    inputsToOutputs.reserve(pass.bytecodes.size());
    for(const auto &bytecodes : pass.bytecodes) {
        inputsToOutputs.push_back({bytecodes, 1.0});
    }
    cns.setupSynapses(inputsToOutputs);
    inputsToOutputs.clear();
    if(!unreviewed.bytecodes.empty()) { /* WARNING! Possible danger to use unreviewed files */
        inputsToOutputs.reserve(unreviewed.bytecodes.size());
        for(const auto &bytecodes : unreviewed.bytecodes) {
            inputsToOutputs.push_back({bytecodes, 1 / 2});
        }
        cns.setupSynapses(inputsToOutputs);
        inputsToOutputs.clear();
    }
    inputsToOutputs.reserve(abort.bytecodes.size());
    for(const auto &bytecodes : abort.bytecodes) {
        inputsToOutputs.push_back({bytecodes, 0.0});
    }
    cns.setupSynapses(inputsToOutputs);
    inputsToOutputs.clear();
}
const float cnsAnalysisScore(const PortableExecutable &file, const ResultListHash &fileHash, const Cns &cns /* = analysisCns */) {
    return cns.processToFloat(file.bytecode);
}
const VirusAnalysisResult cnsAnalysisImpl(const PortableExecutable &file, const ResultListHash &fileHash, const Cns &cns /* = analysisCns */) {
    try {
        const auto result = cnsAnalysisCaches.at(fileHash);
        return result;
    } catch (...) {
        return cnsAnalysisCaches[fileHash] = static_cast<bool>(round(cnsAnalysisScore(file, fileHash, cns))) ? virusAnalysisContinue : virusAnalysisRequiresReview;
    }
}
const VirusAnalysisResult cnsAnalysis(const PortableExecutable &file, const ResultListHash &fileHash) {
    return cnsAnalysisImpl(file, fileHash);
}

void produceVirusFixCns(const ResultList &passOrNull, const ResultList &abortOrNull, Cns &cns /* = virusFixCns */) {
    std::vector<std::tuple<ClassIoBytecode, ClassIoBytecode>> inputsToOutputs;
    const size_t maxDepthOfOpcodes = 6666; /* is not max depth of callstack, but of instruction pointer. TODO: compute this */
    const size_t maxPassSize = listMaxSize(passOrNull.bytecodes);
    const size_t maxAbortSize = listMaxSize(abortOrNull.bytecodes);
    const size_t maxWidthOfOpcodes = (maxPassSize > maxAbortSize ? maxPassSize : maxAbortSize);
    cns.setInputMode(objectModeString);
    cns.setOutputMode(objectModeString);
    cns.setInputNeurons(cns.isSquareConnectome() ? maxWidthOfOpcodes : maxAbortSize);
    cns.setOutputNeurons(cns.isSquareConnectome() ? maxWidthOfOpcodes : maxPassSize);
    cns.setLayersOfNeurons(maxDepthOfOpcodes);
    cns.setNeuronsPerLayer(maxWidthOfOpcodes /* TODO: reduce this */);
    assert(passOrNull.bytecodes.size() == abortOrNull.bytecodes.size());
    inputsToOutputs.reserve(passOrNull.bytecodes.size());
    for(size_t x = 0; passOrNull.bytecodes.size() > x; ++x) {
        inputsToOutputs.push_back({abortOrNull.bytecodes[x], passOrNull.bytecodes[x]});
    }
    cns.setupSynapses(inputsToOutputs);
}

const ClassIoBytecode cnsVirusFix(const PortableExecutable &file, const Cns &cns /* = virusFixCns */) {
    return cns.processToString(file.bytecode);
}

Comparison to assistants

For comparison; produceVirusFixCns() with cnsVirusFix() is close to assistants, since all of them are general use artificial neural tissues which trains on couples of problems (questions, or programs infected with viruses) which map to solutions (answers, or original programs) to learn how to compute such solutions (for new problems) on their own.

Have used class Cns to implement assistant demo through produceAssistantCns(), assistantCnsProcess() and assistantCnsLoopProcess():


less cxx/AssistantCns.cxx

/* snip */
void produceAssistantCns(const ResultList &questionsOrNull, const ResultList &responsesOrNull, Cns &cns) {
    std::vector<std::tuple<ResultListBytecode, ResultListBytecode>> inputsToOutputs;
    const size_t maxConvolutionsOfMessages = 6666; /* is not conversation's max message count, but max steps to compute output. TODO: compute this value */
    const size_t maxResponseSize = listMaxSize(responsesOrNull.bytecodes);
    const size_t maxQuestionSize = listMaxSize(questionsOrNull.bytecodes);
    const size_t maxWidthOfMessages = (maxResponseSize > maxQuestionSize) ? maxResponseSize : maxQuestionSize;
    cns.setInputMode(objectModeString);
    cns.setOutputMode(objectModeString);

cns.setInputNeurons(cns.isSquareConnectome() ? maxWidthOfMessages : maxQuestionSize);
    cns.setOutputNeurons(cns.isSquareConnectome() ? maxWidthOfMessages : maxResponseSize);
    cns.setLayersOfNeurons(maxConvolutionsOfMessages);
    cns.setNeuronsPerLayer(maxWidthOfMessages /* TODO: reduce this */);
    assert(questionsOrNull.bytecodes.size() == responsesOrNull.bytecodes.size());
    inputsToOutputs.reserve(questionsOrNull.bytecodes.size());
    for(size_t x = 0; questionsOrNull.bytecodes.size() > x; ++x) {
        inputsToOutputs.push_back({questionsOrNull.bytecodes[x], responsesOrNull.bytecodes[x]});
    }
    cns.setupSynapses(inputsToOutputs);
}

const std::string assistantCnsProcess(const Cns &cns, const ClassIoBytecode &bytecode) {
    return cns.processToString(bytecode);
}
79744211
-5
import random

class DreamWeaverAI:
    def __init__(self):
        self.experience_types = {
            1: "Adventure",
            2: "Relaxation",
            3: "Training",
            4: "Social"
        }
        self.environments = {
            "Adventure": ["Alien City", "Underwater Kingdom", "Ancient Egypt", "Space Battle"],
            "Relaxation": ["Sunny Beach", "Mystic Forest", "Floating in Space", "Snowy Mountains"],
            "Training": ["Public Speaking Arena", "Martial Arts Dojo", "Language Immersion City", "Puzzle Chamber"],
            "Social": ["AI Companions Café", "Virtual Concert", "Dream Plaza", "Collaborative VR Hub"]
        }
        self.emotion_levels = ["Calm", "Exciting", "Intense"]

    def start(self):
        print("🌌 Welcome to DreamWeaver AI 🌌")
        print("Shape your dream. Live your story.\n")

        # Choose Experience
        for key, value in self.experience_types.items():
            print(f"{key}. {value}")
        choice = int(input("\nChoose your dream experience: "))
        experience = self.experience_types.get(choice, "Adventure")

        # Choose Environment
        print("\nAvailable environments:")
        for i, env in enumerate(self.environments[experience], start=1):
            print(f"{i}. {env}")
        env_choice = int(input("\nPick an environment: "))
        environment = self.environments[experience][env_choice - 1]

        # Choose Emotion Level
        print("\nEmotion Levels:")
        for i, level in enumerate(self.emotion_levels, start=1):
            print(f"{i}. {level}")
        emo_choice = int(input("\nSelect emotion intensity: "))
        emotion = self.emotion_levels[emo_choice - 1]

        # Duration
        duration = input("\nHow long do you want this dream? (e.g., 30 min, 2 hrs): ")

        # Generate Scenario
        self.generate_dream(experience, environment, emotion, duration)

    def generate_dream(self, experience, environment, emotion, duration):
        print("\n✨ Initializing your dream...")
        print(f"🌍 Experience Type: {experience}")
        print(f"🏞️ Environment: {environment}")
        print(f"💫 Emotion Level: {emotion}")
        print(f"⏳ Duration: {duration}\n")

        # Dream narrative (randomly generated twist)
        twists = [
            "You encounter a mysterious guide who offers wisdom.",
            "An unexpected challenge appears, testing your courage.",
            "You discover a hidden portal to another world.",
            "The environment shifts, revealing a secret layer beneath reality."
        ]
        print(f"🔮 Dream Sequence: In your {environment}, {random.choice(twists)}")
        print("Enjoy your journey... 🌌\n")

# Run the simulation
if __name__ == "__main__":
    ai = DreamWeaverAI()
    ai.start()
79737650
-3
import React, { useMemo, useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { 
  Sparkles, Brain, Clock, Map, Users, Heart, Wand2, Ship, Coffee, Moon, Star, Shield, Play, Repeat, Library, Plus, Download, Settings
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Slider } from "@/components/ui/slider";
import { Switch } from "@/components/ui/switch";
import { Badge } from "@/components/ui/badge";

const choice = (arr) => arr[Math.floor(Math.random() * arr.length)];

const SCENES = [
  { key: "adventure", label: "Adventure", icon: Ship },
  { key: "relax", label: "Relaxation", icon: Coffee },
  { key: "romance", label: "Romance", icon: Heart },
  { key: "self", label: "Self‑Discovery", icon: Brain },
  { key: "surprise", label: "Surprise Me", icon: Wand2 },
];

const LOCATIONS = [
  "Ocean Bioluminescent Reef",
  "Orbital Space Habitat",
  "Ancient Library of Alexandria",
  "Neon City 2199",
  "Cloud Forest Monastery",
  "Your Childhood Street",
  "Alien Savannah (Tau Ceti e)",
];

const EMOJI_STORYTILES = ["🌊", "🪐", "📚", "🌆", "🏯", "🏡", "🦄", "🌀", "✨", "🧭", "🛡️", "🎭", "🧠", "💤"];

export default function DreamWeaverPrototype() {
  const [mode, setMode] = useState("adventure");
  const [location, setLocation] = useState(LOCATIONS[0]);
  const [tone, setTone] = useState([40]); // 0 calm → 100 intense
  const [duration, setDuration] = useState([45]); // minutes of targeted REM window
  const [lucid, setLucid] = useState(true);
  const [safety, setSafety] = useState(true);
  const [characters, setCharacters] = useState(["Supportive Guide", "Curious Dolphin"]);
  const [newChar, setNewChar] = useState("");
  const [intent, setIntent] = useState("Recharge, explore, and return with one new idea for my project.");
  const [compiled, setCompiled] = useState(null);

  const suggestion = useMemo(() => {
    const suggestions = {
      adventure: `Calm ocean exploration with friendly dolphins guiding you to a hidden reef tunnel that opens into a star field.`,
      relax: `Warm tide pools at dusk, slow waves syncing with your breath, distant lanterns drifting.`,
      romance: `Starlit terrace above a neon city, gentle music from an unseen quartet, shared floating steps.`,
      self: `Walk through your memory garden; each tree is a year, each leaf a moment you can revisit safely.`,
      surprise: `A door appears in the sky. When opened, gravity turns into music and you drift upward smiling.`,
    };
    return suggestions[mode];
  }, [mode]);

  function addCharacter() {
    if (!newChar.trim()) return;
    setCharacters((prev) => Array.from(new Set([...prev, newChar.trim()])));
    setNewChar("");
  }
  function removeCharacter(name) {
    setCharacters((prev) => prev.filter((c) => c !== name));
  }

  function randomizeAll() {
    const m = choice(SCENES).key;
    setMode(m);
    setLocation(choice(LOCATIONS));
    setTone([Math.floor(Math.random() * 101)]);
    setDuration([15 + Math.floor(Math.random() * 61)]);
    const roster = ["Old Friend", "Mystery Cat", "Future Self", "Kind Stranger", "Star Cartographer"];
    setCharacters([choice(roster), choice(roster)].filter((v, i, a) => a.indexOf(v) === i));
    setIntent(choice([
      "Wake inspired with a title for my story.",
      "Release today’s stress and sleep deeply.",
      "Practice confident public speaking in a safe setting.",
      "Revisit a happy memory and notice new details.",
    ]));
    setCompiled(null);
  }

  function compileProgram() {

    const timeline = [];
    const total = duration[0];
    const phases = [
      { t: 0.1, label: "Induction", cue: "breath‑sync" },
      { t: 0.25, label: "Stabilize", cue: "theta‑harmonics" },
      { t: 0.55, label: "Scene Build", cue: "visual‑parietal seed" },
      { t: 0.8, label: "Narrative", cue: "fronto‑hippocampal weave" },
      { t: 0.95, label: "Gentle Exit", cue: "alpha‑ramp" },
    ];
    phases.forEach((p, i) => {
      const start = Math.round((i === 0 ? 0 : phases[i - 1].t) * total);
      const end = Math.round(p.t * total);
      timeline.push({ start, end, label: p.label, cue: p.cue });
    });

    const program = {
      version: "0.9‑alpha",
      meta: {
        createdAt: new Date().toISOString(),
        targetDurationMin: total,
        lucidLock: lucid,
        safetyRails: safety,
      },
      userIntent: intent,
      scene: {
        mode,
        location,
        emotionalTone: tone[0],
        characters,
        aiSuggestion: suggestion,
      },
      neuralSequence: {
        modulation: {
          toneGain: tone[0] / 100,
          noveltyBias: mode === "surprise" ? 0.9 : 0.35,
          attachmentSoften: mode === "self" ? 0.6 : 0.2,
        },
        timeline,
        safety: {
          nightmareDeflection: safety,
          selfAwakenGesture: lucid,
          memoryWriteDepth: 0.6,
        },
      },
      prompts: {
        narrativeSeed: buildNarrativeSeed({ mode, location, characters, intent, suggestion }),
        imagery: buildImageryPrompts({ mode, location, tone: tone[0] }),
        soundtrack: buildSoundtrack({ mode, tone: tone[0] }),
      },
    };

    setCompiled(program);
  }

  return (
    <div className="min-h-screen w-full bg-gradient-to-b from-slate-950 via-slate-900 to-slate-950 text-slate-100 p-6">
      <div className="max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 gap-6">
        {/* Header */}
        <div className="lg:col-span-2">
          <div className="flex items-center justify-between">
            <div className="flex items-center gap-3">
              <Moon className="h-7 w-7" />
              <h1 className="text-2xl md:text-3xl font-semibold tracking-tight">DreamWeaver — Dream Programming Console</h1>
              <Badge variant="secondary" className="rounded-2xl">Prototype</Badge>
            </div>
            <div className="flex items-center gap-2">
              <Button variant="secondary" className="rounded-2xl" onClick={randomizeAll}>
                <Repeat className="h-4 w-4 mr-2" /> Surprise Me
              </Button>
              <Button className="rounded-2xl" onClick={compileProgram}>
                <Play className="h-4 w-4 mr-2" /> Compile Program
              </Button>
            </div>
          </div>
        </div>

        {/* Left: Controls */}
        <Card className="bg-slate-900/60 border-slate-800 backdrop-blur-xl shadow-xl">
          <CardHeader>
            <CardTitle className="flex items-center gap-2">
              <Settings className="h-5 w-5" /> Scenario Builder
            </CardTitle>
          </CardHeader>
          <CardContent className="space-y-6">
            {/* Modes */}
            <div className="space-y-3">
              <label className="text-sm text-slate-300">Dream Mode</label>
              <div className="grid grid-cols-2 md:grid-cols-3 gap-2">
                {SCENES.map(({ key, label, icon: Icon }) => (
                  <button
                    key={key}
                    onClick={() => setMode(key)}
                    className={`group flex items-center gap-2 rounded-2xl px-3 py-2 border transition ${
                      mode === key ? "border-indigo-400 bg-indigo-400/10" : "border-slate-800 hover:border-slate-700"
                    }`}
                  >
                    <Icon className={`h-4 w-4 ${mode === key ? "" : "opacity-70"}`} />
                    <span className="text-sm">{label}</span>
                  </button>
                ))}
              </div>
              <p className="text-xs text-slate-400 flex items-center gap-2">
                <Sparkles className="h-3.5 w-3.5" /> AI Suggestion: {suggestion}
              </p>
            </div>

            {/* Location */}
            <div className="space-y-2">
              <label className="text-sm text-slate-300 flex items-center gap-2"><Map className="h-4 w-4" /> Location</label>
              <select
                value={location}
                onChange={(e) => setLocation(e.target.value)}
                className="w-full rounded-2xl bg-slate-900/70 border border-slate-800 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-400/40"
              >
                {LOCATIONS.map((loc) => (
                  <option key={loc} value={loc}>{loc}</option>
                ))}
              </select>
            </div>

            {/* Characters */}
            <div className="space-y-2">
              <label className="text-sm text-slate-300 flex items-center gap-2"><Users className="h-4 w-4" /> Characters</label>
              <div className="flex gap-2">
79731016
-2

This program creates genie lamps (folders).

This C++ program will, when run, create a new folder on your desktop called MagicLamp (or MagicLamp1, MagicLamp2, etc., if that name is already taken), and inside it, generate 10 large text files each filled with random 0’s and 1’s.

just look at the cool 15mb worth of random combinations of 1s and 0s.

This is my first c++ project ever. What could it do in the future ? Who knows, but I think the imaginary sci-fi type of future can elaborate on it.

//
//  main.cpp
//  GeniesLamps
//
//  Created by Ryan LeRoy Sykes on 7/18/25.
//

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <filesystem>

#ifdef _WIN32
#include <windows.h>
#endif

namespace fs = std::filesystem;

const int NUM_FILES = 10;
const int FILE_SIZE_BYTES = 15 * 1024 * 1024; // 15 MB

std::string getDesktopPath() {
#ifdef _WIN32
    char* userProfile = getenv("USERPROFILE");
    return std::string(userProfile) + "\\Desktop\\";
#else
    char* home = getenv("HOME");
    return std::string(home) + "/Desktop/";
#endif
}

std::string findAvailableFolderName(const std::string& basePath, const std::string& baseName) {
    std::string folderPath = basePath + baseName;
    int counter = 0;

    while (fs::exists(folderPath)) {
        ++counter;
        folderPath = basePath + baseName + std::to_string(counter);
    }

    return folderPath + fs::path::preferred_separator;
}

int main() {
    std::srand(std::time(0)); // Seed RNG
    std::string desktopPath = getDesktopPath();
    std::string folderPath = findAvailableFolderName(desktopPath, "MagicLamp");

    fs::create_directories(folderPath);

    for (int fileNum = 1; fileNum <= NUM_FILES; ++fileNum) {
        std::string filename = folderPath + "Genie" + std::to_string(fileNum) + ".txt";
        std::ofstream outFile(filename, std::ios::out | std::ios::binary);

        if (!outFile) {
            std::cerr << "Failed to create file: " << filename << std::endl;
            continue;
        }

        for (int i = 0; i < FILE_SIZE_BYTES; ++i) {
            char bit = (std::rand() % 2) ? '1' : '0';
            outFile.put(bit);
        }

        outFile.close();
        std::cout << "Created " << filename << " (" << FILE_SIZE_BYTES << " bytes)" << std::endl;
    }

    std::cout << "All files saved in: " << folderPath << std::endl;
    return 0;
}
79707719
-1

A basic Python script that takes text input like "make pasta" and prints out cooking steps, basically simulating a holographic chef.

import random


def process_voice_command(command):
    if "make pasta" in command.lower():
        return "pasta"
    elif "make salad" in command.lower():
        return "salad"
    else:
        return None


recipes = {
    "pasta": [
        "Step 1: Boil water and add pasta.",
        "Step 2: While pasta cooks, saute garlic and tomatoes.",
        "Step 3: Mix the sauce with the cooked pasta.",
        "Step 4: Serve and enjoy!"
    ],
    "salad": [
        "Step 1: Wash and cut your greens.",
        "Step 2: Add other vegetables like cucumber and bell peppers.",
        "Step 3: Drizzle with your favorite dressing.",
        "Step 4: Toss and serve."
    ]
}


def holographic_chef():
    print("Welcome to your futuristic kitchen! I'm your Holographic Chef.")
    print("What would you like to cook? (e.g., 'Make pasta')")
    

    user_input = input("You: ")
    
    dish = process_voice_command(user_input)
    
    if dish in recipes:
        print(f"\nOkay, projecting the recipe for {dish}...")
        for step in recipes[dish]:
            print(f"Holographic Chef: {step}")
    else:
        print("\nI'm sorry, I don't have that recipe yet. Please try another one.")

if __name__ == "__main__":
    holographic_chef()
79705372
-1

my future tech:

from datetime import datetime as datetime
while True:
  print(datetime.today().strftime('%Y-%m-%d %H:%M:%S'))
79704310
5

A C++2238 Undefined behaviour detector.

This tool takes in a c++ project directory, analyzes it and spits out a result whether your code contains undefined behaviour, unfortunately, it needs a y256 comformant architecture to be run.

#include <std33_filesystem> // supply the STL version you want to use
#include <std33_compile> // in the future, you can generate code at runtime
#include <std77_entry> // the future does not care about ABI, you can use any STL version you want
#include <std77_cyber> // for cyberspace memory allocation
//             v-------- In C++1037, async attribute was introduced
//                      v------- In C++2033, the implicit_status attribute lets you define an enum that is automatically converted to std::program_status, where 0 is still success
[[nodiscard, async, implicit_status(std::undefined_behaviour_result) ]]std::undefined_behaviour_result check_ub(std::cpp_standard standard); // in 2238, we still need to forward declare.

std::program_status main(std::v77::argument_list argv) { // C++2077 conformant entry point

   std::v33::file_list cpp_source_files = std::v33::get_cpp_project(argv[0]);

   std::v77::cyber_vector link_files {愛} // tell the cyberspace - of japanese origin - to treat your files with love
   for(auto&&& f : cpp_source_files) // cyber reference, the memory is not on your machine, it goes hand-in-hand with <std77_cyber>
   {
      for(auto&&& parse_result : std::v33::compiler::parse(f)) { // c++77 introduced multi pass parsing and ditched object file generation, the AST is directly used to generate the final cyber-binary
         link_files.push_back(parse_result);
      }
   }
   //check for undefined behaviour now
   return await check_ub(std::cpp_standard::idc); // implicit conversion takes care of the program result.
}


std::undefined_behaviour_result check_ub(std::cpp_standard standard) { // checks a project for undefined behaviour
   return std::undefined_behaviour_result::undefined_behaviour;
}
79697048
19

🖥️My proposal: a holographic computer interface

I didn't use any AI to generate the code, not even code completions.

I wasn't sure about what did we have to do in this challenge. In previous challenges, we had to make a small script, but this time it looks like we have to do a whole project. So I made a simulator of a kind of holographic computer interface. My code uses 3D CSS features to simulate 3D holographic windows.

You can see the project in the link below. You can interact with some windows, for example, you can send messages to the different chats or draw in the painting app. You can move the windows by holding them by the top, like a normal computer.

Hope you like it.

https://iamarobot123.github.io/holo/

(The link redirects to my GitHub Page, but I just use It for this kind of projects.)

Anyway, thanks to the challenge, I learned a lot I didn't know about CSS transformations. I think I have to use 3D CSS tranformations more often for my personal projects. I really enjoyed this challenge.

Here is the full code:

HTML <index.html>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <link href="styles/main.css" rel="stylesheet" />
        <title>Holographic computer</title>
    </head>
    <body>
        <div id="3ddisplay">
            <img class="bgimagecube" src="images/cube1.jpg" id="left">
            <img class="bgimagecube" src="images/cube3.jpg" id="front">
            <img class="bgimagecube" src="images/cube2.jpg" id="right">
            <img class="bgimagecube" src="images/cube4.jpg" id="back">
            <div class="window">
                <div class="main-bar">
                    <div class="move-window">Settings</div>
                    <div class="close-button">X</div>
                </div>
                <div class="content holo">
                    <p>     
                        <span>Circle radius</span>               
                        <input type="range" class="slider" id="radius-input" min="700" max="1300" value="800">
                    </p>
                    <p>     
                        <span>Opacity</span>               
                        <input type="range" class="slider" id="opacity-input" min="0.3" max="0.95" value="0.8" step="0.025">
                    </p>
                    <p>     
                        <span><b style="color: #ff0060">Warning:</b> A higher oppacity may affect the energy spent by the holographic projector.</span>               
                    </p>
                    <p>     
                        <span>Hold the wheel button or click the movement buttons to move to the sides</span>               
                    </p>     
                </div>

            </div>
            <div class="window">

                <div class="main-bar">
                    <div class="move-window">Messages</div>
                    <div class="close-button">X</div>
                </div>
                <div class="content messages">
                    <div class="chats">
                        <div class="chat">
                            <div class="chat-profile-photo" style="background-color: #ff3030">

                            </div>
                            <div class="chat-name">
                                Chat 1
                            </div>
                        </div>
                        <div class="chat">
                            <div class="chat-profile-photo" style="background-color: #30ff30">

                            </div>
                            <div class="chat-name">
                                Chat 2
                            </div>
                        </div>
                        <div class="chat">
                            <div class="chat-profile-photo" style="background-color: #00bfff">

                            </div>
                            <div class="chat-name">
                                Chat 3
                            </div>
                        </div>
                    </div>
                    <div id="chat-display">
                        <div id="chat-output">

                        </div>
                        <div id="chat-bar">
                            <input type="text" id="chat-input">
                            <button id="chat-send">Send</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="window">
                <div class="main-bar">
                    <div class="move-window">Notes</div>
                    <div class="close-button">X</div>
                </div>
                <div class="content notes">
                    <textarea id="notes-display">Taking notes here</textarea>
                    <div class="notes-button-container">
                        <button id="notes-save">Save</button>
                        <button id="notes-reset">Reset</button>
                        <input id="notes-filename" type="text" value="Notes" placeholder="filename"><span>.txt</span>
                    </div>
                </div>
            </div>
            <div class="window">
                <div class="main-bar">
                    <div class="move-window">Paint</div>
                    <div class="close-button">X</div>
                </div>
                <div class="content paint">
                    <canvas id="paint-display">Something went wrong</canvas>
                    <div class="paint-button-container">
                        <button id="paint-save">Save</button>
                        <button id="paint-reset">Reset</button>
                        <input id="paint-filename" type="text" value="Painting" placeholder="filename"><span>.png</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="move-button left">
            &LeftArrow;
        </div>
        <div class="move-button right">
            &RightArrow;
        </div>
        <script src="scripts/main.js"></script>
    </body>
</html>

CSS <styles/main.css>

.bgimagecube {
    background-color: #908070;
    width: 1000px;
    height: 1000px;
    margin: 0;
    padding: 0;
    position: absolute;
    grid-template-rows: 20px calc(100% - 20px);
}
.window {
    background-color: #a0c0ff;
    background-image: repeating-linear-gradient(#90b0ff 5px, #c0c0ff 10px);
    opacity: 0.8;
    border-radius: 8px;
    position: absolute;
    resize: both;
    overflow: auto;
    display: grid;
    width: 700px;
    height: 500px;
    margin: 0;
    padding: 0;
    grid-template-rows: 20px calc(100% - 20px);
}
body {
    margin: 0px;
    height: 100svh;
    width: 100svw;
    overflow: hidden;
}
.main-bar {
    display: grid;
    background-image: repeating-linear-gradient(#6090ff 5px, #80a0ff 10px);
    grid-template-columns: calc(100% - 20px) 20px;
    margin: 0;
    padding: 0;
    cursor: grab;
}
.move-window {
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    padding: 3px 7px;
    height: 14px;
}
.close-button {
    background-color: #ff0030;
    opacity: 0.8;
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    font-size: 11pt;
    display: grid;
    padding: 3px 5px;
    height: 14px;
}
.holo {
    padding: 8px;
}
p {
    margin-top: 0;
}
.slider {
    margin: 0;
    display: inline;
    text-align: center;
    position: relative;
    top: 4px;
    cursor: pointer;
}
span {
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    color: #ffffff;
    font-size: 11pt;
}
.messages {
    display: grid;
    grid-template-columns: 150px calc(100% - 150px)
}
.chats {
    display: grid;
    background-image: repeating-linear-gradient(#6090ff 5px, #80a0ff 10px);
    grid-template-rows: 60px 60px 60px;
}
.chat {
    display: grid;
    grid-template-columns: 50px 100px;
    background-color: #8090ff;
    border-width: 0;
    border-bottom: 1px;
    border-style: solid;
    border-color: #a0c0ff;
    cursor: pointer;
}
.chat-profile-photo {
    margin: 15px 10px;
    border-radius: 100%;
}
.chat-name {
    margin-top: 20px;
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
}
#chat-display {
    display: grid;
    grid-template-rows: calc(100% - 30px) 30px;
}
#chat-bar {
    display: grid;
    background-image: repeating-linear-gradient(#6090ff 5px, #80a0ff 10px);
    grid-template-columns: calc(100% - 60px) 60px;
}
#chat-input, #notes-filename, #paint-filename {
    margin: 5px;
    background-color: #a0c0ff;
    border-style: solid;
    border-width: 1px;
    border-radius: 5px;
    border-color: #808080;
}
#chat-send, #notes-save, #notes-reset, #paint-save, #paint-reset {
    margin: 5px;
    background-color: #a0c0ff;
    border-style: solid;
    border-width: 1px;
    border-radius: 5px;
    border-color: #808080;
    color: #404040;
}
#chat-send:hover, #notes-save:hover, #notes-reset:hover, #paint-save:hover, #paint-reset:hover {
    background-color: #c0c0ff;
    cursor: pointer;
}
.chat-header {
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    padding: 5px;
    background-color: #90b0ff;
}
.msg1 {
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    padding: 5px;
    margin: 5px;
    font-size: 11pt;
    width: fit-content;
    background-color: #6080ff;
    border-radius: 5px;
}
.msg2 {
    color: #ffffff;
    font-family: "Fira Sans", Arial, Helvetica, sans-serif;
    padding: 5px;
    margin: 5px;
    margin-left: auto;
    font-size: 11pt;
    width: fit-content;
    background-color: #90a0ff;
    border-radius: 5px;
}
#notes-display {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-width: 0;
    margin: 8px;
    padding: 0;
    display: grid;
    resize: none;
    background-color: #0000;
}
.notes-button-container, .paint-button-container {
    background-image: repeating-linear-gradient(#6090ff 5px, #80a0ff 10px);
}
.notes, .paint {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-rows: calc(100% - 30px) 30px;
}
#paint-display {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-width: 0;
    border-radius: 8px;
    margin: 8px;
    padding: 0;
    display: grid;
    resize: none;
    background-color: #e0e0ff;
}
.move-button {
    position: absolute;
    width: 50px;
    background-color: #80808080;
    border-radius: 8px;
    text-align: center;
    text-wrap: center;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bolder;
    font-size: 18px;
    margin-top: 5px;
    padding-top: 5px;
    padding-bottom: 7px;
    cursor: pointer;
}
.right {
    margin-left: calc(100% - 55px);
}
.left {
    margin-left: 5px;
}

JavaScript <scripts/main.js>


const windows = [ ...document.getElementsByClassName('window')];
const background = [ ...document.getElementsByClassName('bgimagecube')];
const moveButtons = [ ...document.getElementsByClassName('move-button')];

const radiusInput = document.getElementById('radius-input');
const opacityInput = document.getElementById('opacity-input');
let windowTransform = [
    { direction: 0, height: 0, vh: 300, vw: 500 },
    { direction: 50, height: 0, vh: 300, vw: 500  },
    { direction: 100, height: 0, vh: 300, vw: 500  },
    { direction: 310, height: 0, vh: 300, vw: 500  },

]


const deg = (n) => n / 180 * Math.PI;
let c = 500;
let r = 0;
let o = 0;
let wheelPressed = false;

document.addEventListener('mousemove', (e) => {
    if(wheelPressed)
    r -= e.movementX / 5;
})
document.addEventListener('mousedown', (e) => {
    if(e.button == 1) {
        wheelPressed = true;
        e.preventDefault();
    }
})
document.addEventListener('mouseup', (e) => {
    if(e.button == 1) {
        wheelPressed = false;
        e.preventDefault();
    }
})
for(const n in moveButtons) {
    const assign = [-10, 10];
    moveButtons[n].onclick = () => r += assign[n];
}

const notesSave = document.getElementById('notes-save');
const notesReset = document.getElementById('notes-reset');
const notesInput = document.getElementById('notes-display');
const notesFileName = document.getElementById('notes-filename');
notesSave.onclick = () => {
    const element = document.createElement('a');
    element.setAttribute('href', 'data:txt;charset=utf8,' + encodeURIComponent(notesInput.value));
    element.setAttribute('download', notesFileName.value);
    element.click();
}
notesReset.onclick = () => {
    notesInput.value = '';
}

const paintSave = document.getElementById('paint-save');
const paintReset = document.getElementById('paint-reset');
const paintInput = document.getElementById('paint-display');
const ctx = paintInput.getContext('2d');
const paintFileName = document.getElementById('paint-filename');
paintSave.onclick = () => {
    const element = document.createElement('a');
    element.setAttribute('href', paintInput.toDataURL('png'));
    element.setAttribute('download', paintFileName.value);
    element.click();
}
paintReset.onclick = () => {
    paintInput.height = paintInput.clientHeight;
    paintInput.width = paintInput.clientWidth;
    ctx.reset();
    ctx.fillStyle = '#e0e0ff';
    ctx.fillRect(0, 0, paintInput.width, paintInput.height);
}
paintInput.height = paintInput.clientHeight;
paintInput.width = paintInput.clientWidth;
ctx.fillStyle = '#e0e0ff';
ctx.fillRect(0, 0, paintInput.width, paintInput.height);
let pencilDown = false;
let pencilX = 0, pencilY = 0;
let pencilBX = 0, pencilBY = 0;
paintInput.addEventListener('mousedown', (e) => {
    if(e.button == 0)
    {
        pencilDown = true;
        pencilBX = e.offsetX;
        pencilBY = e.offsetY;
    }
})
document.addEventListener('mouseup', (e) => {
    if(e.button == 0) pencilDown = false;
})
paintInput.addEventListener('mousemove', (e) => {
    pencilX = e.offsetX;
    pencilY = e.offsetY;
})
const chats = [ ...document.getElementsByClassName('chat')];
const display = document.getElementById('chat-output');
const input = document.getElementById('chat-input');
const send = document.getElementById('chat-send');

let selected = 0;
const dialogues = [
    `
    <p class="chat-header">Chat 1</p>
    <p class="msg1">Hello</p>
    `,
    `
    <p class="chat-header">Chat 2</p>
    <p class="msg1">Hi! How's it going?</p>
    <p class="msg2">I'm too busy right now. Let's talk later</p>
    <p class="msg1">Ok</p> 
    `,
    `
    <p class="chat-header">Chat 3</P>
    <p class="msg1">Do you have a moment?</p>
    <p class="msg1">I've to tell you something important</p>
    <p class="msg2">I don't have time</p>
    <p class="msg1">Ok, let's talk later</p>
    `,
]
for(const n in chats) {
    chats[n].addEventListener('click', (e) => {
        selected = n;
        
    })
}
send.onclick = (e) => {
    if(!input.value) return;
    dialogues[selected] += '<p class="msg2">' + input.value + '</p>';
    input.value = '';
}
input.onkeydown = (e) => {
    if(e.key != 'Enter') return;
    if(!input.value) return;
    dialogues[selected] += '<p class="msg2">' + input.value + '</p>';
    input.value = '';
}

const mainBars = [ ...document.getElementsByClassName('main-bar')];
for(const n in mainBars) {
    let selected = false;
    mainBars[n].addEventListener('mousedown', (e) => {
        if(e.button == 0) selected = true;
    })
    document.addEventListener('mouseup', (e) => {
        if(e.button == 0) selected = false;
    })
    document.addEventListener('mousemove', (e) => {
        if(selected) {
            windowTransform[n].direction -= e.movementX / 7;
            windowTransform[n].height += e.movementY;
        }
    })
}

function loop(frame) {
    if(pencilDown) {
        ctx.beginPath();
        ctx.moveTo(pencilBX, pencilBY);
        ctx.lineTo(pencilX, pencilY);
        ctx.lineWidth = 2;
        ctx.strokeStyle = '#404040';
        ctx.stroke();
        ctx.closePath();
        pencilBX = pencilX;
        pencilBY = pencilY;
    }
    if(paintInput.clientHeight != paintInput.height || paintInput.clientWidth != paintInput.width) {
    {
        paintInput.height = paintInput.clientHeight;
        paintInput.width = paintInput.clientWidth;
        ctx.fillStyle = '#e0e0ff';
        ctx.fillRect(0, 0, paintInput.width, paintInput.height);
    }
    }
    for(const n in background) {
        // The background is a cubemap I downloaded from the Internet.
        background[n].style.transform = 
        `
        translate(${window.innerWidth / 2 - 500}px, ${window.innerHeight / 2 - 500}px)
        perspective(1000px)
        translate3d(${-Math.sin(deg(r + n * 90)) * 500}px, ${0}px, ${-Math.cos(deg(r + n * 90)) * 500 + 1000}px)
        rotate3d(0, 1, 0, ${r + n * 90}deg)
        `
    }
    c = radiusInput.value;
    o = opacityInput.value;   
    for(const n in windows) {
        // Apply 3D CSS transformations

        windows[n].style.transform = ''
        windowTransform[n].vw = windows[n].clientWidth;
        windowTransform[n].vh = windows[n].clientHeight;
        windows[n].style.transform = 
        `
        translate(${window.innerWidth / 2 - windowTransform[n].vw / 2}px, ${window.innerHeight / 2 - windowTransform[n].vh / 2}px)
        perspective(1000px)
        translate3d(${-Math.sin(deg(windowTransform[n].direction + r)) * c}px, ${windowTransform[n].height}px, ${-Math.cos(deg(windowTransform[n].direction + r)) * c + 1000}px)
        rotate3d(0, 1, 0, ${windowTransform[n].direction + r}deg)
        `
        // Apply opacity
        windows[n].style.opacity = `${+o + Math.random() / 30}`

    }
    display.innerHTML = dialogues[selected];
    requestAnimationFrame(loop);
}
loop(0);

Thanks for reading. Hope you liked the idea!

79701204
2

I'm conflicted. On one hand, it's a really cool demo of CSS capabilities, but on the other, I'm not sure this is actually "futuristic" within the parameters of the challenge. I mean, I know hologram projectors aren't a thing yet, but that's not what's being made here either.

79702104
0
  • A slider for window opacity would be worthwhile to increase the immersion of the reality augmentation of your demo.

  • Some amount of tech that implements this kind of feature set is already in place in augmented reality glasses that are in the market. Not as polished as your demo, but stuck because of regulatory and privacy issues, instead of technical roadblocks.

79703290
2

Thanks for the idea. I just didn't know about the newest AR/VR software, I took inspiration from some sci-fi books.

79891221
1

The link https://iamarobot123.github.io/holo/ leads to "Site not found"

79696480
11

Programming languages tend not to die out. FORTRAN is still widely used in legacy systems. PHP is the foundation of the modern web. Newer languages may be gaining steam, but existing ones won't just disappear - the skills programmers gain in the languages of today will still be relevant in the tech stacks of tomorrow. As such, no matter how many technologies exist in the future, I can say with almost complete certainly that this program will be one of them:

C++

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
79694984
1

This script take your name and a year, and takes you to that year, printing a list of celebrities from that decade, saying you've met them.

name = input("What is your name? ")
year = int(input("Which year do you wish to visit? "))

# Decade icons dictionary
values = {
    tuple(range(1900, 1910)) : ["The Wright Brothers", "Henry Ford", "Marie Curie", "Mark Twain"],
    tuple(range(1910, 1920)) : ["Charlie Chaplin", "Franz Kafka", "Tsar Nicholas II", "Mata Hari"],
    tuple(range(1920, 1930)) : ["F. Scott Fitzgerald", "Josephine Baker", "Louis Armstrong", "Babe Ruth", "Coco Chanel"],
    tuple(range(1930, 1940)) : ["Clark Gable", "Fred Astaire & Ginger Rogers", "Amelia Earhart", "Albert Einstein"],
    tuple(range(1940, 1950)) : ["Frank Sinatra", "Winston Churchill", "Marilyn Monroe", "Audrey Hepburn", "George Orwell"],
    tuple(range(1950, 1960)) : ["Elvis Presley", "James Dean", "Lucille Ball", "Jackie Robinson", "Marilyn Monroe"],
    tuple(range(1960, 1970)) : ["The Beatles", "Muhammad Ali", "Andy Warhol", "John F. Kennedy", "Bob Dylan", "Che Guevara"],
    tuple(range(1970, 1980)) : ["David Bowie", "Bruce Lee", "Stephen King", "Pele", "Meryl Streep", "Star Wars Cast"],
    tuple(range(1980, 1990)) : ["Michael Jackson", "Madonna", "Arnold Schwarzenegger", "Prince", "Princess Diana", "Steven Spielberg"],
    tuple(range(1990, 2000)) : ["Kurt Cobain", "Oprah Winfrey", "Will Smith", "Michael Jordan", "Britney Spears", "Keanu Reeves"],
    tuple(range(2000, 2010)) : ["Beyoncé", "Angelina Jolie", "Cristiano Ronaldo", "Lionel Messi", "Eminem", "Barack Obama", "Harry Potter Franchise"],
    tuple(range(2010, 2020)) : ["Taylor Swift", "Drake", "Kim Kardashian", "Elon Musk", "Greta Thunberg", "Game of Thrones Cast"],
    tuple(range(2020, 2030)) : ["Zendaya", "BTS", "Timothée Chalamet", "Taylor Swift", "MrBeast", "Pedro Pascal"]
}   
found = False
for key in values: 
    if year in key:
        icons = values[key]
        print(f"Hello {name} let's take you to the year {year}")
        for icon in icons: 
            print("You met", icon)
        found = True 
        break 
if not found: 
    print(" The time Machine wasn't created for that time ")
        
79687639
4

You are encouraged to use your imagination and/or draw inspiration from books, films, and other sources.

OK, you asked for it. Sometimes old technology is used to solve new problems. In the absence of a good definition and concrete examples (after all Google already knows what I want to eat, and VR goggles have been around for years), that's what we'll label "future technology."

With that in mind:

Futuristic IQ and Aptitude Test

This test is designed to test what your aptitude is good at, so you can get a job while you're being a particular individual (in jail or whatever).

In this speculated "future," the collective intelligence of humanity has dropped. Unfortunately, my future oracle only has given me a glimpse into one question, but one could easily add more. There will also be a shape-matching interface, but it doesn't really have to do anything. Or it can be used to start the exam computer up.

/*
  This test is sponsored by Brawndo(TM), the Thirst Mutilator.
*/
const qPool = [
  "If you have one bucket that holds two gallons and another bucket that holds five gallons, how many buckets do you have?",
  // Other questions, if any
];

function say(s) {
  textToSpeechApiCall(s);
}

function micPrompt(s) {
  textToSpeechApiCall(s);
  return transcribeMicInputApiCall();
}

for (const [i, q] of qPool.entries()) {
  const resp = micPrompt(q);
  evaluate({q: i, resp});
  say("Thank you.");
}
say(getResult());

The test will of course be evaluated by a backend.

const answerKey = [
  ["2", "two"],
  // Next answers here, if any
];

let correctAnswers = 0;
function evaluate(q, resp) {
  if (answerKey[q].includes(resp))
    correctAnswers++;
}

function getResult() {
  if (correctAnswers / answerKey.length === 1) {
    return "You got all the answers right! Possible genius. Recommend political office.";
  }
  // Other score tier results...
}

It's all JS-based pseudocode. You could easily make it into a real thing, though.

Once the result is obtained, it will be sent to the Department of Labor for job assignment.

Citations

In the interest of avoiding plagiarism:

Idea based on movie Idiocracy. 1st paragraph above paraphrased from direct quote. Scene: https://www.youtube.com/watch?v=jbmq9P-8FiM

79687431
44

To leap up in space, open your Python console and run

import antigravity

Now, let's see if Perl lovers can match this...

Flying with Python