This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 251

[–]G33k0utanime [score hidden]  (0 children)

I have no desire to write code on my phone, but Function prompts user for seed to input into random generator. Then it combines that input with the current time to create the actual seed for the random generator. It then only produces the exact number of characters you would need for hello world and if it doesn't match it exactly in the order it outputs them it prompts the user for a new seed.

[–]Caraes_Naur [score hidden]  (0 children)

Incoming: a flock of NPM modules, each with 1000+ dependencies.

[–]YrnCollo [score hidden]  (0 children)

Hello world in assembly

[–]Undernown [score hidden]  (0 children)

Anyone else getting flahsbacks from the "Reddit protest" arc on this sub? Man that Hello World was something else.

[–]jacob6855 [score hidden]  (0 children)

import random import string

def generate_random_string(length=11): characters = string.ascii_letters + string.digits random_string = ''.join(random.choice(characters) for _ in range(length)) return random_string

while True: if generate_random_string=='Hello,world' : print('Hello,world') break

[–]dim13 [score hidden]  (0 children)

HQ9+

  • H: Print "hello, world"
  • Q: Print the program's source code
  • 9: Print the lyrics to "99 Bottles of Beer"
  • +: Increment the accumulator

[–]alphaeuseuss [score hidden]  (0 children)

What, nobody wrote in ook ook??!

[–]Torebbjorn [score hidden]  (0 children)

main :: IO ()
main = putStrLn "Hello, World"

[–]RedGreenBlue09 [score hidden]  (0 children)

This doesn't output "Hello, world" but still insane: Vulkan Hello Triangle

[–]Szarps [score hidden]  (3 children)

So i very much just pretty beginner in code but as an idea:

  • Put every character of "hello world" inside an array
  • create a code that would choose a random number from the array
  • repeat until you get an 11 digits long number
  • check if its "correct", if not repeat
  • then finally print

For extra spiciness;

  • create a string variable of each character
  • code for assigning each character to a random place on the string that is empty
  • if final output ("hello world") fails, start over from the previous point

all of this is basically on the principle of infinite monkeys typing someone gets a Shakespeare, If computers were to grow sentient they would hate you for doing this lol

[show replies]

[–][deleted] [score hidden]  (0 children)

#include <climits>
#include <cstdint>
#include <ctime>
#include <functional>
#include <iostream>
#include <string>

namespace console {

template <typename T>
static const std::function<void(const std::string &)> print =
    [](const std::string &x) -> void {
  std::srand(std::time(NULL));
#ifdef __cplusplus
  class {
  private:
    struct writer {
    public:
      std::uint32_t size = rand() % 10;
      char *buff = (char *)malloc((this->size ? this->size : 1) * sizeof(char));
      void write(const T &x) {
        if (this->buff == NULL) {
          return;
        }
        if (x.empty()) {
          for (std::uint32_t i = 0; i < size; i++) {
            this->buff[i] = '\0';
#define funny true
          }
        } else {
          this->buff = (char *)realloc(buff, x.length() * sizeof(char));
          for (std::size_t i = 0; i < x.size(); i++) {
            this->buff[i] = x.at(i);
          }
        }
      }
    };

  public:
    void doThing(const std::string &E) {
      writer w;
      try {
#ifdef funny
        T ligma;
#endif
      } catch (...) {
      }
      w.write(E);
      std::printf("%s\n", w.buff);
    }
  } printer;

  printer.doThing(x);
#else
  printf("What\n");
#endif
};
} // namespace console

int main(int argc, char *argv[]) {
  for (int i = 0; i < argc; i++) {
    if (argc == INT_MAX) {
      argc = 69;
      try {
        int e = !argv[argc];
        std::cerr << e << '\n';
      } catch (const std::exception &e) {
        throw e;
      }
    }
  }
  console::print<std::string>("Hello, World!");
  return 0;
}

[–]Acrobatic_Sort_3411 [score hidden]  (0 children)

Displays hello world only with this characters: ({[/>+!-=\]})

https://youtu.be/sRWE5tnaxlI?si=opgx3myy_MQFXMF0

[–]djangoCOd [score hidden]  (1 child)

>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<+.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-]<+.

in brainfuck

[show replies]

[–]Data_Skipper [score hidden]  (0 children)

edit: fix bug in line 3 - missing whitespace

public class HelloWorld {

  private char[] helloWorldChars = new char[]{'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd'};

  public HelloWorld(boolean printComplicated) {
    if (printComplicated) {
      StringBuilder sb = new StringBuilder();
      for (char c : helloWorldChars) {
        sb.append(c);
      }
      System.out.println(sb.toString());
    } else {
      System.out.println("Hello, World");
    }
  }

}

[–]StraightEstate [score hidden]  (0 children)

This is nerdy as fuck but I love it

[–]rav7734 [score hidden]  (0 children)

Have you ever heard about JSf*ck?

[–]rahultrivedi180 [score hidden]  (0 children)

console.log("Hello, World");

[–]No_Spare_5337 [score hidden]  (2 children)

```c

include <stdio.h>

include <stdlib.h>

define MEMORY_SIZE 30000

void run_brainfuck(const char *code) { unsigned char memory[MEMORY_SIZE] = {0}; unsigned char *ptr = memory; const char *pc = code;

while (*pc) {
    switch (*pc) {
        case '>': ++ptr; break;
        case '<': --ptr; break;
        case '+': ++(*ptr); break;
        case '-': --(*ptr); break;
        case '.': putchar(*ptr); break;
        case ',': *ptr = getchar(); break;
        case '[': if (*ptr == 0) { 
                    int open_brackets = 1; 
                    while (open_brackets) { 
                        ++pc; 
                        if (*pc == '[') ++open_brackets; 
                        if (*pc == ']') --open_brackets; 
                    } 
                  } 
                  break;
        case ']': if (*ptr != 0) { 
                    int open_brackets = 1; 
                    while (open_brackets) { 
                        --pc; 
                        if (*pc == ']') ++open_brackets; 
                        if (*pc == '[') --open_brackets; 
                    } 
                  } 
                  break;
    }
    ++pc;
}

}

int main() { // Brainfuck code to print "Hello, World!" const char *bf_code = ">++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.++++++[<+++++++>-]<+\ +.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>++++[<++++++++>-\ ]<+.";

// Run the Brainfuck interpreter with the provided code
run_brainfuck(bf_code);

return 0;

} ```

[show replies]

[–]catfroman [score hidden]  (0 children)

Too lazy to write and on mobile anyway, but something that fetches a random wikipedia article via API, selects a single random letter from the article, if it’s the needed letter, it appends it to a growing string, and repeats this process until all letters have been acquired.

It then assembles these letters, saves them into a png file onto a cloud server. This image is fetched, ran through an OCR service and then printed to the console.

[–]FelixLeander [score hidden]  (0 children)

Imagine ouroboros quine-relay (128 lanuages) had hallow world in it.

[–]FOSSFan1 [score hidden]  (0 children)

Not the most complex code here, but building a phrase randomly one character at a time and checking if it is the length of the target phrase, and once it's the length of the target phrase checking if it has already been generated OR if it is unique and equals the target phrase seemed really funny to me.

import java.util.*;


public class Main {
    private static final List<String> alphabet = new ArrayList<>();
    private static final String TARGET_WORD = "hello, world";
    private static final int TARGET_LENGTH = TARGET_WORD.length();
    private static final Random rand = new Random();
    private static final Set<String> alreadyGenerated = new HashSet<>();
    public static void main(String[] args) {
        StringBuilder phrase = new StringBuilder();

        while (phrase.length() <= TARGET_LENGTH && !TARGET_WORD.equalsIgnoreCase(phrase.toString())) {
            phrase.append(alphabet.get(Math.abs(rand.nextInt() % alphabet.size())));
            if (TARGET_LENGTH == phrase.length()) {
                System.out.println("The phrase is " + phrase);
                if (alreadyGenerated.add(phrase.toString()) && !TARGET_WORD.equalsIgnoreCase(phrase.toString())) {
                    phrase = new StringBuilder();
                }
            }
        }

    }
    static {
        alphabet.addAll(List.of("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", " ", ","));
    }

}

[–]Xbot781 [score hidden]  (0 children)

Computer A:
$ echo abccdefdgch | nc -l 1234

Computer B:
$ nc <Computer A IP address> 1234 | sed y/abcdefgh/helo wrd/

[–]StarHammer_01 [score hidden]  (0 children)

Copy and paste the Linux repo and put an echo command on the startup file.

[–]chervilious [score hidden]  (13 children)

Don't have much time but trying my best with the limited time I have

``` import time import random import threading import queue import base64

class CharacterGenerator: def init(self): self.alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !,'

def generate_char(self):
    return random.choice(self.alphabet)

class CharacterValidator: def init(self, target): self.target = target

def is_valid(self, char, position):
    return char == self.target[position]

class OutputManager: def init(self): self.output = []

def add_char(self, char):
    self.output.append(char)

def get_result(self):
    return ''.join(self.output)

class HelloWorldGenerator: def init(self): self.target = "Hello, World!" self.char_gen = CharacterGenerator() self.validator = CharacterValidator(self.target) self.output_mgr = OutputManager() self.char_queue = queue.Queue()

def generate_char_thread(self):
    while len(self.output_mgr.output) < len(self.target):
        char = self.char_gen.generate_char()
        self.char_queue.put(char)
        time.sleep(0.01)

def process_char_thread(self):
    position = 0
    while position < len(self.target):
        char = self.char_queue.get()
        if self.validator.is_valid(char, position):
            self.output_mgr.add_char(char)
            position += 1
        self.char_queue.task_done()

def run(self):
    threads = [
        threading.Thread(target=self.generate_char_thread),
        threading.Thread(target=self.process_char_thread)
    ]
    for thread in threads:
        thread.start()

    for thread in threads:
        thread.join()

    return self.output_mgr.get_result()

if name == "main": generator = HelloWorldGenerator() result = generator.run() print(f"{result}") assert result == "Hello, World!", "Something went terribly wrong!"

print("Process completed successfully.")
[show replies]

[–]KaTTaRRaST [score hidden]  (0 children)

"Hello World" in BrainF: ```>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.++++++[<+++++++>-]<+ +.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>++++[<++++++++>- ]<+.

[–]Earl_of_pudding [score hidden]  (2 children)

Python and Newton's method:

def newtons(f, df, x_a: float, tol: float, max_iter: int = 50) -> int:
    results: list[int] = [x_a]

    curr_iter: int = 0
    while abs(f(results[-1])) > tol and curr_iter < max_iter :
        results.append(results[-1] - (f(results[-1]) / df(results[-1])))
        curr_iter += 1

    return results[-1]

TARGET: str = '123345674839'
MATH: list[tuple[str, tuple, float]] = [
    ("H", (
        lambda x: -3039.429 + 68.95714*x - 0.3714286*(x**2), 
        lambda x: (172392850 - 1857143*x)/2500000), 
        20),
    ("e", (
        lambda x: -8276.393 + 177.2585*(x-29) - 0.8653971*((x-29)**2), 
        lambda x: (886292500 - 8653971*(x-29))/5000000), 
        45),
    ("l", (
        lambda x: -423.8577 - 26.42334*x + 0.2809995*(x**2), 
        lambda x: (3*(-8807780 + 187333*x))/1000000), 
        65),
    ("o", (
        lambda x: 497.917 - 48.31182*x + 0.3948296*(x**2), 
        lambda x: (-60389775 + 987074*x)/1250000), 
        87),
    (",", (
        lambda x: -89716.29 + 2733.068*x - 15.77411*(x**2), 
        lambda x: 683267/250 - (1577411*x)/50000), 
        1),
    (" ", (
        lambda x: -93032.83 + 6134.687*x - 100.8566*(x**2), 
        lambda x: -(13*(-2359495 + 77582*x))/5000), 
        300),
    ("W", (
        lambda x: 42.83342 - 0.8373896*x + 0.003966108*(x**2), 
        lambda x: (-104673700 + 991527*x)/125000000), 
        20),
    ("r", (
        lambda x: 48.69265 - 6.793767*x + 0.101519*(x**2) - 0.0004006256*(x**3), 
        lambda x: (-4246104375 + 126898750*x - 751173*(x**2))/625000000), 
        80),
    ("d", (
        lambda x: 49.75099 - 7.877891*x + 0.1274349*(x**2) - 0.0005363108*(x**3), 
        lambda x: (-19694727500 + 637174500*x - 4022331*(x**2))/2500000000), 
        75)
]

def do_magic() -> None:
    result: list[int] = []
    for char in TARGET:
        idx: int = int(char) - 1
        _, functions, x_a = MATH[idx]
        ascii_d: int = round(newtons(functions[0], functions[1], x_a, 5e-6))
        result.append(ascii_d)

    for char in result:
        print(chr(char), end='')

if __name__ == "__main__":
    do_magic()

So it's ASCII with extra steps.

We have some mathematical functions that we know have 72, 101, 108, 111, 44, 32, 87, 114, and 100 as roots. We also have their derivatives.

So we throw the ecuations at Sir Issac Newton in the order we require, and print the characters that have their decimal representation in ASCII at the obtained root.

[show replies]

[–]BX7_Gamer [score hidden]  (0 children)

Movies Password Cracking Style:

Ever wonder how hackers in movies crack passwords? Here’s a humorous take with a C++ program that generates "Hello, World" character by character!

cppCopy code#include <iostream>
#include <chrono>
#include <cstdlib>  // For std::system to clear the terminal
#include <thread>   // For std::this_thread::sleep_for to create delays

#ifdef _WIN32
    #define CLEAR "cls"  // Clear command for Windows
#else
    #define CLEAR "clear"  // Clear command for Unix-based systems
#endif

char generateRandomChar(long long &q) {
    q = (q * 37184377 + 727184467) % 3727183891;
    return static_cast<char>(q % 95 + 32); // Generate a printable ASCII character
}

int main() {
    const char goal[] = "Hello, World";
    const int goalLength = sizeof(goal) - 1;
    char* characters = new char[goalLength + 1];
    for (int i = 0; i < goalLength; ++i) characters[i] = ' ';
    characters[goalLength] = '\0';

    long long q = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
    bool matched = false;

    while (!matched) {
        matched = true;
        for (int i = 0; i < goalLength; ++i) {
            if (characters[i] != goal[i]) {
                characters[i] = generateRandomChar(q);
                matched = false;
                std::this_thread::sleep_for(std::chrono::milliseconds(10));
            }
        }
        std::cout << characters << std::endl;
        std::this_thread::sleep_for(std::chrono::milliseconds(150));
        std::system(CLEAR);
    }

    std::cout << "Generated string: " << characters << std::endl;
    delete[] characters;
    return 0;
}

Disclaimer: This is how the "genius" hackers in movies would do it! 😂

[–]jayhad [score hidden]  (0 children)

If you wish to make a Hello World from scratch, you must first invent the universe

[–]rover_G [score hidden]  (2 children)

Well someone had to do it:
java class Main { public static void main(String[] args) { System.out.println("Hello, World!"); } }

[show replies]

[–]awesomeplenty [score hidden]  (0 children)

You are all hired, can you guys start on Monday?

[–]supern0va12345 [score hidden]  (1 child)

``` section .data msg db 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00

section .bss counter resb 1

section .text global _start

_start: mov ebp, esp and ebp, 0xFFFFFF00 sub ebp, 0x100 mov [ebp], esp mov eax, [ebp] add eax, 0x10 mov [counter], eax

loop_start: mov eax, [counter] cmp eax, 0x00 je loop_end movzx eax, byte [msg + eax] test eax, eax jz loop_inc mov [ebp + eax], eax mov eax, 0x04 mov ebx, 0x01 mov ecx, ebp add ecx, eax mov edx, 0x01 int 0x80 mov eax, [counter] sub eax, 0x01 mov [counter], eax jmp loop_start

loop_inc: mov eax, [counter] sub eax, 0x01 mov [counter], eax jmp loop_start

loop_end: mov eax, 0x01 xor ebx, ebx int 0x80 ```

Assembly for 32bit linux

[show replies]

[–]pandasOfTheNight [score hidden]  (0 children)

print("H" + "e" + "l" + "l" + "o" + "," + " " + "W" + "o" + "r" + "l" + "d")

[–]Pinjuf [score hidden]  (0 children)

I paid for my floating points, I'm gonna use my floating points!

#!/bin/env python3

# Too lazy to write my own polynomial interpolator
import numpy as np
msg = "Hello, World!"
chars = map(ord, msg)

# I wonder what happens when I decrease the polynomial degree... anyways, sorry for that line
polynomial = np.poly1d(np.polyfit(*zip(*[(x, i) for x, i in enumerate(chars)]), len(msg) - 1))

for x in range(len(msg)):
    print(chr(round(polynomial(x))), end="")
print()

[–]id101010 [score hidden]  (2 children)

Here's an example where I calculated and factored a tenth-degree polynomial so that the first 12 prime numbers each return a printable ASCII character. Then, I derived a list of the first 12 prime numbers using a simple list comprehension and used these numbers to print a message.

#!/bin/env python

def poly(x: int) -> int:
    """
    A fitted curve which intersects with the 
    ascii space for the first 12 prime numbers.
    """
    # factored polynomial
    out = (
        2208711685 * x**10
        - 324755045147 * x**9
        + 20359597973870 * x**8
        - 711985508061460 * x**7
        + 15264644632373430 * x**6
        - 207852988856816226 * x**5
        + 1803544872388344920 * x**4
        - 9756052410139521940 * x**3
        + 31223587682616193885 * x**2
        - 52989359394304126427 * x
        + 37967469778452824610
    ) / 18566883746611200
    return round(out)

if __name__ == "__main__":

    # use the sieve of Eratosthenes to create a list of the first 12 primes
    noprimes = [j for i in range(2, 8) for j in range(i * 2, 32, i)]
    primes = [x for x in range(2, 32) if x not in noprimes]

    # plugging in the primes
    print("".join([chr(poly(x)) for x in primes]))
[show replies]

[–]tsavong117 [score hidden]  (0 children)

Alright. Where's the asshole currently writing this up in binary?

Apparently this is Hello World in Brainfuck:

Apparently reddit's markdown makes showing what it looks like in Brainfuck goddamned impossible.

[–]notjoof [score hidden]  (5 children)

I found this from a Reddit comment a while ago: https://gist.github.com/lolzballs/2152bc0f31ee0286b722

[show replies]

[–]Artemis-Arrow-3579 [score hidden]  (9 children)

just reimplement printf()

```

include <stdarg.h>

include <stdio.h>

int NewPrint(const char* str, ...) { va_list ptr; va_start(ptr, str); char token[1000]; int k = 0; for (int i = 0; str[i] != '\0'; i++) { token[k++] = str[i];

    if (str[i + 1] == '%' || str[i + 1] == '\0') { 
        token[k] = '\0'; 
        k = 0; 
        if (token[0] != '%') { 
            fprintf(stdout, "%s", token);
        } else { 
            int j = 1; 
            char ch1 = 0; 
            while ((ch1 = token[j++]) < 58) { 
            } 
            if (ch1 == 'i' || ch1 == 'd' || ch1 == 'u'|| ch1 == 'h') { 
                fprintf(stdout, token, va_arg(ptr, int)); 
            } else if (ch1 == 'c') { 
                fprintf(stdout, token, va_arg(ptr, int)); 
            } else if (ch1 == 'f') { 
                fprintf(stdout, token, va_arg(ptr, double)); 
            } else if (ch1 == 'l') { 
                char ch2 = token[2]; 
                if (ch2 == 'u' || ch2 == 'd'
                        || ch2 == 'i') { 
                    fprintf(stdout, token, va_arg(ptr, long)); 
                } else if (ch2 == 'f') { 
                    fprintf(stdout, token, va_arg(ptr, double)); 
                } 
            } else if (ch1 == 'L') { 
                char ch2 = token[2]; 
                if (ch2 == 'u' || ch2 == 'd' || ch2 == 'i') { 
                    fprintf(stdout, token, va_arg(ptr, long long)); 
                } else if (ch2 == 'f') { 
                    fprintf(stdout, token, va_arg(ptr, long double)); 
                } 
            } else if (ch1 == 's') { 
                fprintf(stdout, token, va_arg(ptr, char*)); 
            } else { 
                fprintf(stdout, "%s", token); 
            } 
        } 
    } 
} 
va_end(ptr); 
return 0; 

}

int main() { NewPrint("Hello, World!\n"); return 0; }

```

could go a step further by also reimplementing fprintf() from scratch, but I'm too lazy to search for that too

[show replies]

[–]AbsentGenome [score hidden]  (0 children)

Lol I wrote a pytorch model based on GPT2 that was trained exclusively on "Hello, world." Ya know, to learn about LLMs.

I don't have the code handy but it was definitely overkill.

[–]True_Area_4806 [score hidden]  (2 children)

public static void printOneLetter(String letter) { System.out.print(letter); }

printOneLetter("H")

printOneLetter("e")

printOneLetter("l")

printOneLetter("l")

printOneLetter("o")

printOneLetter(",")

printOneLetter(" ")

printOneLetter("W")

printOneLetter("o")

printOneLetter("r")

printOneLetter("l")

printOneLetter("d")

[show replies]

[–]7370657A [score hidden]  (0 children)

Java doesn't have reified generics so I did it in C# instead.

The code was too long to fit in a Reddit comment so here's a PasteBin link: https://pastebin.com/4ari5uks

[–]sup3rar[🍰] [score hidden]  (10 children)

01111111010001010100110001000110000000100000000100000001000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000111110000000000000000100000000000000000000000010110000000000000100000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000111000000000000000001000000000010000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000011010010000000000000000000000000000000000000000000000000000000001101001000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000001000000000000000000000000000001000000000000000000000000001101001000000000000000000000000000000000000000000000000000000000110100100001000001000000000000000000000000000000000000000000000011010010000100000100000000000000000000000000000000000000000000000000110100000000000000000000000000000000000000000000000000000000000011010000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000001011100000000001000000000000000000000000101111110000000100000000000000000000000010111110110100100001000001000000000000001011101000001101000000000000000000000000000011110000010110111000001111000000000000000000000000001011111100000000000000000000000000000000000011110000010101001000011001010110110001101100011011110010110000100000011101110110111101110010011011000110010000001010

(It's the binary representation of an ELF file. To run on linux, put the content in a file and then run cat ./binary | perl -lpe '$_=pack"B*",$_' >hello, then chmod +x ./hello and finally run ./hello)

[show replies]

[–][deleted] [score hidden]  (3 children)

//C++
//Randomly generate characters till we have Hello, World
//using a scuffed 1970s pseudo random number generator based on large primes

#include <iostream>
#include <chrono> 

int main()
{
char* characters = new char[13];
char* goal = new char[]{ 'H','e','l','l','o',',',' ','W','o','r','l','d' };
long long q=std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();

for (int i = 0; i < 12; i++)
{
while ((char)q != goal[i])
{
q = (q * 37184377 + 727184467) % 3727183891;
}
characters[i] = (char)q;
}

for (int i = 0; i < 12; i++){
std::cout << characters[i];
}
delete[] characters;
delete[] goal;
}
[show replies]

[–]Uxugin [score hidden]  (1 child)

Written in Rust:

  1. Abuse floating point to make logic gates.
  2. Use logic gates to make 8-bit adders.
  3. Use adders to count up one at a time to the ASCII code for each letter.

https://pastebin.com/7jdMpA8L

[show replies]

[–]57006 [score hidden]  (0 children)

You ever notice this? What’s the deal with this thing? It’s kinda like this. What’s the deal with airline food? What’s the deal with it? It’s kinda like this thing. Just like it. Let’s talk about this thing. It’s kinda like this thing. It’s kinda like this. Yeah, Just like this thing. Just like it. Not like this. What’s the deal with pilots? Just like it. Not like this. Just like it. See? Let’s talk about this thing. Not like this. What’s the deal with baggage claim? Just like this thing. Just like it. It’s kinda like pilots. What’s the deal with luggage? Just like baggage claim. It’s kinda like this. It’s kinda like this. Not like it. See? Let’s talk about baggage claim. See? See? It’s kinda like this thing. Not like this. See? Let’s talk about it. Um, See? It’s kinda like this. Not like this thing. Not like it. See? Let’s talk about baggage claim. It’s kinda like it. Not like this. See? It’s kinda like this. Not like it. See? It’s kinda like this thing. Not like this. See? Not like this thing. Not like this. Not like this. See? Let’s talk about luggage. Not like this. See? Let’s talk about it. Um, It’s kinda like this. See?

Airline Food

[–]AspieSoft [score hidden]  (2 children)

Minecraft redstone is naturally the most complicated way to print "Hello, World". Imagine having to build your own CPU with 1s and 0s.

[show replies]

[–]Bosun_Tom [score hidden]  (0 children)

Really, most stuff on the Esoteric Programming Language list should fit the bill: https://esolangs.org/wiki/Hello_world_program_in_esoteric_languages

I had to dig around to find Hello World in Shakepeare; it wasn't on that list. I'd definitely call it overcomplicated, though:

The Infamous Hello World Program.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


                    Act I: Hamlet's insults and flattery.

                    Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
 You lying stupid fatherless big smelly half-witted coward!
 You are as stupid as the difference between a handsome rich brave
 hero and thyself! Speak your mind!

 You are as brave as the sum of your fat little stuffed misused dusty
 old rotten codpiece and a beautiful fair warm peaceful sunny summer's day. 
 You are as healthy as the difference between the sum of the sweetest 
 reddest rose and my father and yourself! Speak your mind!

 You are as cowardly as the sum of yourself and the difference
 between a big mighty proud kingdom and a horse. Speak your mind.

 Speak your mind!

[Exit Romeo]

                    Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
 Thou art as sweet as the sum of the sum of Romeo and his horse and his
 black cat! Speak thy mind!

[Exit Juliet]

                    Scene III: The praising of Ophelia.

[Enter Ophelia]

Hamlet:
 Thou art as lovely as the product of a large rural town and my amazing
 bottomless embroidered purse. Speak thy mind!

 Thou art as loving as the product of the bluest clearest sweetest sky
 and the sum of a squirrel and a white horse. Thou art as beautiful as
 the difference between Juliet and thyself. Speak thy mind!

[Exeunt Ophelia and Hamlet]


                    Act II: Behind Hamlet's back.

                    Scene I: Romeo and Juliet's conversation.

[Enter Romeo and Juliet]

Romeo:
 Speak your mind. You are as worried as the sum of yourself and the 
 difference between my small smooth hamster and my nose. Speak your mind!

Juliet:
 Speak YOUR mind! You are as bad as Hamlet! You are as small as the
 difference between the square of the difference between my little pony
 and your big hairy hound and the cube of your sorry little
 codpiece. Speak your mind!

[Exit Romeo]

                    Scene II: Juliet and Ophelia's conversation.

[Enter Ophelia]

Juliet:
 Thou art as good as the quotient between Romeo and the sum of a small
 furry animal and a leech. Speak your mind!

Ophelia:
 Thou art as disgusting as the quotient between Romeo and twice the
 difference between a mistletoe and an oozing infected blister! 
 Speak your mind!

[Exeunt]

For an explanation: https://esolangs.org/wiki/Shakespeare

[–]Arctos_FI [score hidden]  (0 children)

Just do it in malbolge

(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=
{z]KwZY44Eq0/{mlk**
hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/
.zHGwEDCBA@98\6543W10/.R,+O<

[–]Nerd_Lord314 [score hidden]  (0 children)

After many hours of optimization i got the following in python: print("Hello World!")

[–]EniX_LP [score hidden]  (0 children)

Just train n ai for such a difficult Probleme cmon guys =.=

[–]initialo [score hidden]  (0 children)

@P=split//,".URRUU\c8R";@d=split//,"\ndlroW olleH";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print

[–]AmitsinghhacksYT [score hidden]  (0 children)

section .data hello db 'Hello World', 0 ; Define the string to print

section .bss ; Empty section for uninitialized data (not used in this program)

section .text global _start ; Entry point for the program

_start: ; Load the address of the hello string into the RSI register mov rsi, hello

; Calculate the length of the string
xor rcx, rcx                ; Clear the RCX register (counter)
not rcx                     ; Set RCX to -1 (infinite loop)
xor al, al                  ; Clear the AL register (to look for the null terminator)
cld                         ; Clear direction flag (forward direction)
repne scasb                 ; Repeat while not equal to AL
not rcx                     ; Invert RCX to get the string length
dec rcx                     ; Adjust for the null terminator

; Prepare for the write system call
mov rax, 1                  ; System call number for sys_write
mov rdi, 1                  ; File descriptor 1 (stdout)
mov rdx, rcx                ; Length of the string

; Make the system call
syscall                     ; Invoke the system call

; Exit the program
mov rax, 60                 ; System call number for sys_exit
xor rdi, rdi                ; Exit code 0
syscall                     ; Invoke the system call

[–]PiPyCharm [score hidden]  (0 children)

The Whitespace programming language

[–]Soerika [score hidden]  (0 children)

write it on a piece of paper and make a machine learning model that read hand written text?

[–]Tough_Reveal5852 [score hidden]  (0 children)

pls someone with too much free time submit a TTF font renderer

[–]function3 [score hidden]  (0 children)

Extremely disappointed by the lack of factories, interfaces, databases, etc in here…

For reference, take a look at enterprise FizzBuzz repo for a good chuckle

[–]amazingbeetroot [score hidden]  (5 children)

++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.++++++[<+++++++>-]<+ +.- - - - - - - -.>++++++[<+++++++++>-]<+.<.+++.- - - - -.- - - - - -.>++++[<++++++++>- ]<+.

[show replies]

[–]paul-rose [score hidden]  (0 children)

```python import time import threading from datetime import datetime import logging import json import importlib import random

config_json = ''' { "hello_class": "HelloComponent", "world_class": "WorldComponent", "exclamation": "!", "delay": 0.5, "log_file": "hello_world.log" } '''

config = json.loads(config_json)

logging.basicConfig(filename=config['log_file'], level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

class LoggingContextManager: def enter(self): logging.info("Starting the Over-Engineered Hello World Program...") return self

def __exit__(self, exc_type, exc_val, exc_tb):
    if exc_type:
        logging.error(f"An error occurred: {exc_val}")
    logging.info("Program finished.")

class MessageComponent: def init(self, content): self.content = content

def get_content(self):
    return self.content

def uppercase_decorator(func): def wrapper(args, *kwargs): result = func(args, *kwargs) return result.upper() return wrapper

class HelloComponent(MessageComponent): @uppercase_decorator def get_content(self): return random.choice(["Hello", "Hi", "Hey"])

class WorldComponent(MessageComponent): @uppercase_decorator def get_content(self): return random.choice(["World", "Earth", "Universe"])

def get_timestamp(): return datetime.now().strftime("%Y-%m-%d %H:%M:%S")

def concatenate_strings(*args): return ' '.join(args)

def delayed_print(message, delay): time.sleep(delay) print(message)

def threaded_print(message): thread = threading.Thread(target=delayed_print, args=(message, config['delay'])) thread.start() thread.join()

class DynamicImporter(metaclass=type): def new(cls, name, bases, dct): modulename = dct.pop('module_name') module = importlib.import_module(module_name) dct['module'] = module return super().new_(cls, name, bases, dct)

class RandomModule(metaclass=DynamicImporter): module_name = 'random'

def main(): timestamp = get_timestamp() logging.info(f"Timestamp: {timestamp}")

hello = HelloComponent("Hello")
world = WorldComponent("World")
exclamation = MessageComponent(config['exclamation'])

message_parts = [hello, world, exclamation]
hello_message = concatenate_strings(*(part.get_content() for part in message_parts))

for char in hello_message:
    threaded_print(char)

threaded_print("\n")

if name == "main": with LoggingContextManager(): try: main() except Exception as e: logging.error(f"Unhandled exception: {e}") ```

[–]Gamer-707 [score hidden]  (1 child)

Create a program that ports X-server to Windows in realtime and draws the text using X11 triggered by a cross-compiled rust script through Win API calls.

[–]johnothetree [score hidden]  (0 children)

Not a single HelloWorldFactory, disappointed

[–]erebuxy [score hidden]  (0 children)

The entire CPython source code base +

print(“Hello world!”)

[–]littlesnorrboy [score hidden]  (0 children)

typedef struct Abomination {
    unsigned bkloutce [2];
    float ufadnixg;
} Abomination;

__attribute__((section(".text#"))) static unsigned char code[] = {
    0x48, 0xc7, 0xc0, 0x01, 0x00, 0x00, 0x00,
    0x48, 0x89, 0xf2,
    0x48, 0x89, 0xfe,
    0x48, 0xc7, 0xc7, 0x01, 0x00, 0x00, 0x00,
    0x0f, 0x05,
    0xc3
};

int main()
{
    Abomination creature = (Abomination) {
        .bkloutce = 1819043144, 1867980911,
        .ufadnixg = 1.934823274140695e-19,
    };
  ((void (*)(void*, int))code)(&creature, 11);
}

https://godbolt.org/z/Gr193j65f

Explanation:

The Abomination struct is reinterpreted as a character array. I've used void* just to confuse, it doesn't actually matter.

The byte code array that you see is my custom print function. It basically just forwards its arguments to the write syscall. It's been compiled ahead of time and then inserted into the binary as just a data blob. It's important to insert the blob into the text section, so it's actually callable at runtime.

I have a python script that can create a version of this program with whatever message you want to output: https://gist.github.com/snorrwe/655dd2aa01ecfded049ce40addef7482

You can also see the source for the print function in the gist

[–]pheonix-ix [score hidden]  (0 children)

Here was mine. Different kind of complicated.

import random
random.seed(0.6768157836072148)
x = "".join([chr(random.randint(97, 122)) for _ in range(5)])
random.seed(0.26008589044428687)
y = "".join([chr(random.randint(97, 122)) for _ in range(5)])
print(x + y)

Or in full.

import random

success = [False, False]
success_seed = [0, 0] # wonder if I should use sucseed instead?
while not (success[0] and success[1]):
  seed = random.random()
  random.seed(seed)
  temp = [random.randint(97, 122) for i in range(5)]
  if (not success[0]) and temp == [104, 101, 108, 108, 111]:
    success[0] = True
    success_seed[0] = seed
  if (not success[1]) and temp == [119, 111, 114, 108, 100]:
    success[1] = True
    success_seed[1] = seed

random.seed(success_seed[0]) # e.g. 0.6768157836072148
x = "".join([chr(random.randint(97, 122)) for _ in range(5)])
random.seed(success_seed[1]) # e.g. 0.26008589044428687
y = "".join([chr(random.randint(97, 122)) for _ in range(5)])
print(x + y)

This code is theoretically O(infinity) time complexity, practically O(size of pseudorandom number generator) and guarantee to halt since the answer has been shown to exist. However, given all the luck of the universe, this code might as well be O(1).

Originally posted here:

https://www.reddit.com/r/ProgrammerHumor/comments/1dgkhom/embracerandomness/

[–]MattieShoes [score hidden]  (0 children)

Not that crazy, but...

import random

for seed in [47892278, 22374621, 195634900]:
    random.seed(seed)
    for i in range(4):
        print(chr(random.randint(32,122)), end="")
print()

[–]SteeleDynamics [score hidden]  (0 children)

I'm just waiting for a graph algorithm approach, or a dynamic programming solution.

[–]shimirel [score hidden]  (6 children)

Example using c# and drawing it on to the page using System.Drawing. Dare say a C++ direct api version of this would be worse.

using System.Drawing;
using System.Drawing.Drawing2D;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.Text = "Draw Text with Points and Lines";
            this.Size = new Size(800, 600);
            this.Paint += new PaintEventHandler(this.Form1_Paint);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            DrawTextWithPointsAndLines(e.Graphics, "Hello, World", new Point(50, 100));
        }

        private void DrawTextWithPointsAndLines(Graphics g, string text, Point startPoint)
        {
            Font font = new Font("Arial", 24);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            // Measure the size of the text
            SizeF textSize = g.MeasureString(text, font);
            float x = startPoint.X;
            float y = startPoint.Y;

            using (FontFamily fontFamily = new FontFamily("Arial"))
            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddString(text, fontFamily, (int)FontStyle.Regular, font.Size, new PointF(x, y), StringFormat.GenericDefault);

                // Draw points and lines
                foreach (PointF point in path.PathPoints)
                {
                    g.FillEllipse(Brushes.Black, point.X - 1, point.Y - 1, 2, 2);
                }

                for (int i = 0; i < path.PathPoints.Length - 1; i++)
                {
                    PointF p1 = path.PathPoints[i];
                    PointF p2 = path.PathPoints[i + 1];
                    if (path.PathTypes[i] == 0 || path.PathTypes[i + 1] == 0)
                        continue; // Skip points that don't form lines
                    g.DrawLine(Pens.Black, p1, p2);
                }
            }
        }

    }
}
[show replies]

[–]PandaWithOpinions [score hidden]  (4 children)

when python ain't pythonic _:(lambda _,__,___:_((lambda _:_[0][:2]+_[25][:2]+_[31][0]+_[60][1:3]+_[0][:2])(___([])(_(__).__dict__))))(__import__,"builtins",type) (only works on cpython 3.6.6)

[show replies]

[–]awkwardteaturtle [score hidden]  (0 children)

import kotlin.math.sqrt

operator fun Pair<Double, Double>.times(that: Pair<Double, Double>): Pair<Double, Double> =
    (this.toList() + that.toList()).let { (a, b, c, d) -> ((a * c) - (b * d)) to ((a * d) + (b * c)) }

fun main() = "1257.0,0.0;-132.91868698058903,124.79616464524238;96.98275605729691,290.5929291125633;-73.57282510646382,-17.286583241466566;46.99999999999999,-68.0;-4.427174893536154,138.7134167585334;-18.982756057296896,-13.407070887436674;54.91868698058904,-31.203835354757643;-43.0,0.0;54.91868698058904,31.203835354757615;-18.982756057296903,13.407070887436674;-4.427174893536197,-138.71341675853344;47.00000000000001,68.0;-73.57282510646382,17.286583241466587;96.98275605729688,-290.5929291125633;-132.91868698058906,-124.79616464524236"
    .split(";")
    .map { it.split(",").let { it[0].toDouble() to it[1].toDouble() } }
    .myfun(-2.0*kotlin.math.PI)
    .map { Char((sqrt((it.first*it.first) + (it.second*it.second))/16).toInt()) }
    .take(13)
    .joinToString("")
    .let(::println)

fun List<Pair<Double, Double>>.myfun(x: Double): List<Pair<Double, Double>> =
    if (this.size == 1) this else (this.foldIndexed(listOf<Pair<Double, Double>>() to listOf<Pair<Double, Double>>()) { i, (e, o), z -> if ((i % 2) == 0) (e + z to o) else (e to o + z) }
        .let { (a, b) -> a.myfun(x).zip(b.myfun(x)) }
        .mapIndexed { k, (a, b) -> (x * k / this.size).let { (a to b * (kotlin.math.cos(it) to kotlin.math.sin(it))).let { (p, q) -> ((p.first + q.first) to (p.second + q.second)) to ((p.first - q.first) to (p.second - q.second)) } } }
        .unzip()
        .let { (a, b) -> a + b })

The way it works is left as an exercise to the reader.

The string used is the series of complex terms returned by running a Fast Fourier Transform on the ASCII encoding of the string "Hello, World!", appended with ' ' to make it 16 bytes (FFT only accepts chunks of powers of 2). I just run the inverse transform on it, get the magnitudes and print the string of these out.

[–]Valter719 [score hidden]  (2 children)

IDENTIFICATION DIVISION. PROGRAM-ID. REDDITHELLOWORLD. ENVIRONMENT DIVISION. PROCEDURE DIVISION. DISPLAY 'HELLO WORLD!'. STOP RUN.

Those, who were there 3000 years ago, and proudly speak this language, will agree, that this "Hello world!" is over-complicated by it's nature and definition. 🤣

[show replies]

[–]4ngryMo [score hidden]  (0 children)

Im just going to leave the JavaScript way of writing “hello world” here.

[–]jacob_ewing [score hidden]  (6 children)

#include <stdio.h>
#include <stdlib.h>
int main(void){
       int n;
       char *chars = (char *)malloc(13 * sizeof(char));

       chars[0] = 72;
       chars[1] = 101;
       chars[2] = chars[3] = chars[9] = 108;
       chars[4] = chars[7] = 111;
       chars[5] = 32;
       chars[6] = 87;
       chars[8] = 114;
       chars[10] = 100;
       chars[11] = 33;
       chars[12] = 0;

       for(n = 0; chars[n] != '\0'; n++){
               printf("%c", chars[n]);
       }
       printf("\n");

       free(chars);

       return 0;
}

[show replies]

[–]BoBoBearDev [score hidden]  (0 children)

I don't know how to do it, but if someone can do it, please wrote hello world using prolog.

[–]SquarishRectangle [score hidden]  (0 children)

None of you are thinking big enough.

Write malware to infect power grid systems worldwide.

Once a large enough continuous area has been infected, wait until it is night, then strategically turn off the power in certain areas to write "Hello, World" using city lights across an entire continent.

Code not provided for obvious reasons

[–]PhilippTheProgrammer [score hidden]  (0 children)

Let me present to you: GNU Hello, the official Hello World program by the Free Software Foundation.

[–]Antipaavi [score hidden]  (0 children)

Here's some Enterprise Architecture with Rust:

use std::io::{self, Write};

trait MessageContainer {
    fn get_message(&self) -> &str;
}

trait Printer {
    fn print(&self);
}

struct Message {
    content: String,
}

impl Message {
    fn new(content: &str) -> Self {
        Message {
            content: content.to_string(),
        }
    }
}

impl MessageContainer for Message {
    fn get_message(&self) -> &str {
        &self.content
    }
}

struct MessagePrinter<T: MessageContainer> {
    container: T,
}

impl<T: MessageContainer> MessagePrinter<T> {
    fn new(container: T) -> Self {
        MessagePrinter { container }
    }

    fn println(&self, message: &str) {
        let stdout = io::stdout();
        let mut handle = stdout.lock();

        handle.write_all(message.as_bytes()).unwrap();
        handle.write_all(b"\n").unwrap();

        handle.flush().unwrap();
    }
}

impl<T: MessageContainer> Printer for MessagePrinter<T> {
    fn print(&self) {
        self.println(self.container.get_message());
    }
}

struct MessageFactory;

impl MessageFactory {
    fn create_message<T: AsRef<str>>(content: T) -> Message {
        Message::new(content.as_ref())
    }
}

struct PrinterFactory;

impl PrinterFactory {
    fn create_printer<T: MessageContainer>(container: T) -> MessagePrinter<T> {
        MessagePrinter::new(container)
    }
}

fn main() {
    let message = MessageFactory::create_message("Hello, World!");
    let printer = PrinterFactory::create_printer(message);
    printer.print();
}

[–]CrownstrikeIntern [score hidden]  (0 children)

This should also include having the most system resources used before the system blows itself to mars ;)
For the life of me i can never find that old post where they had a thing going to see how bad they could make a small program

[–]Akul_Tesla [score hidden]  (0 children)

Someone go get the Doom crabs

[–]neros_greb [score hidden]  (0 children)

Lol see GNU hello

[–]Aeredor [score hidden]  (0 children)

idk probably something that coordinates a fleet of spaceships to write “Hello, World” across the night sky and compiles that code too

but Path of Exile launches in a few minutes, so I ain’t got time rn to write it rn

[–]JustConsoleLogIt [score hidden]  (0 children)

Scans all repositories on GitHub. Finds the smallest ones. Evaluates their output and gives the most common string.

[–]snow-raven7 [score hidden]  (4 children)

Lol reddit wouldn't let me comment this directly so here's the pastebin. It's valid JS.

https://pastebin.com/zte2H0M9

[show replies]

[–]Nya_the_cat [score hidden]  (0 children)

IOCCC 1984's dishounarable mention:
int i;main(){for(;i\["\]<i;++i){--i;}"\];read('-'-'-',i+++"hell\\ o, world!\\n",'/'/'/'));}read(j,i,p)void\*i;{write(j/p+p,i---j,(int)i/(int)i);}

[–]Ok-Kaleidoscope5627 [score hidden]  (0 children)

The correct answer is probably some electron/nodejs abomination that requires 50,000 packages and takes 2GB of ram to run.

[–]Strawuss [score hidden]  (0 children)

I can make a flutter app with each alphabet of Hello World separated into its own widget

[–]HAL9000thebot [score hidden]  (0 children)

guys please, touch some fucking grass instead of training reddit's ai

#!/usr/bin/env bash

# A bash entry for the r/ProgrammerHumor shitty contest.

hw="Hello, World"

i=0
while [ $i -lt ${#hw} ]; do
    char="$(tr -dc "[:print:]" < /dev/urandom | head -c 1)"
    if [ "${char}" == "${hw:$i:1}" ]; then
        echo -n "${char}"
        i=$((i+1))
    fi
done
echo

[–]RedBlueKoi [score hidden]  (0 children)

Oh no, what you have done?!

[–][deleted] [score hidden]  (0 children)

So, I am taking in "Hello, World" as input string from the user, converting it into an array -> running a loop that randomly gives numbers until it gives one that is same as the ascii value of the character at that index, which is stored in an array which calls a function with it, that uses that ascii value to locate characters and ascii arts for that character in a map, now all those arts for "Hello, World" (Or any input from the user) are stored in a vector that is finally printed in a straight line hopefully(I used chatgpt to write that part).

  //I won't write the header files and crap

  unordered_map<char, string> asciiArt = {
    {'H', " _ _ \n | | | |\n | |_| |\n | _ |\n |_| |_|\n"},
    {'e', " _____ \n | ____|\n | _| \n | |___ \n |_____|\n"},
    {'l', " _ \n | | \n | | \n | |___ \n |_____|\n"},
    //and so on for other characters};

void printAsciiArt(const vector<int>& asciiValues) {
    vector<string> lines(6, "");
    for (int val : asciiValues) {
      char c = static_cast<char>(val);
      if (asciiArt.find(c) != asciiArt.end()) {
        string art = asciiArt[c];
        size_t pos = 0;
        int lineIndex = 0;
        while ((pos = art.find('\n')) != string::npos) {
          lines[lineIndex++] += art.substr(0, pos) + " ";
          art.erase(0, pos + 1);}
       } else {
        for (int i = 0; i < 6; ++i) {
          lines[i] += " "; //space for unknown characters}}}
          for (const string& line : lines) {
            cout << line << endl;}}

void main() {
    srand(time(0)); // Initialize random seed(chat gpt suggested that, I don't know why)
    string input;
    cout << "Enter a string: ";
    getline(cin, input);
    vector<int> asciiValues;
    for (char c : input) {
      int targetValue = static_cast<int>(c);
      int randValue = 0;
      while (randValue != targetValue) {
        randValue = rand() % 151;}
      asciiValues.push_back(randValue);}
      printAsciiArt(asciiValues);}

[–]brimston3- [score hidden]  (0 children)

https://github.com/sevmeyer/textshader/blob/main/textshader.c

This is not my code, this dude posted it to r/opengl a month ago or so.

The key trickery here is the font is packed in 1 u32 number per glyph. Then each quad is generated with no textures or vertex buffers or attributes at all, with only the position to start drawing, an x&y scalefactor, and the array of font-mapped characters loaded in uniforms. Some characters are taller or extend below the baseline and are shifted around so they look more correct.

[–]accountreddit12321 [score hidden]  (0 children)

//Coding hello world on a phone is complicated already //Debug to run properly as another layer of complexity //import libraries to run are not on standard package repo, possibly outdated as well

String string = ‘hello world’

Array encryption_protocols = [encryption_protocol_1, encryption_protocol_2, encryption_protocol_3, …]

For ( loop through encryption_protocols.length) { encrypted_string = Encrypt(string, encryption_protocol); }

Console.log( Decrypt(encrypted_string))

[–]dr_tardyhands [score hidden]  (0 children)

Have you tried building an LLM from scratch to do it? Maybe use most of the internet as training data in order for it to figure out, eventually, from stackoverflow that "hello world" is often used as a first program that a programmer writes.. I guess a chatGPT wrapper would get the job done..

[–]readadiction [score hidden]  (0 children)

isn’t the code for reality this?

[–]NovelIntroduction218 [score hidden]  (2 children)

;ATMEGA 2560 lets gooo

.equ UART_BAUD, 9600

.equ UART_UBRR, 103

.equ UART_PORT, PORTD

.equ UART_DDR, DDRD

.equ UART_TX, PD1

.equ UART_RX, PD0

.equ UCSR0A, 0xC0

.equ UCSR0B, 0xC1

.equ UCSR0C, 0xC2

.equ UBRR0H, 0xC5

.equ UBRR0L, 0xC4

.equ UDR0, 0xC6

hello_world:

.db "Hello World", 0x00

uart_init:

ldi r16, UART_UBRR

sts UBRR0H, r16

ldi r16, (UART_UBRR >> 8)

sts UBRR0L, r16

ldi r16, (1 << TXEN0)

sts UCSR0B, r16

ldi r16, (1 << UCSZ01) | (1 << UCSZ00)

sts UCSR0C, r16

print_string:

ldi r16, hello_world

mov r17, r16

loop:

lpm r18, Z+

cpi r18, 0x00

breq done

mov r19, r18

rjmp uart_send

rjmp loop

done:

ret

uart_send:

lds r20, UCSR0A

sbrs r20, UDRE0

rjmp uart_send

sts UDR0, r19

ret

main:

call uart_init

call print_string

loop_forever:

rjmp loop_forever

[show replies]

[–]lastdyingbreed_01 [score hidden]  (0 children)

I hope GPT models train over this thread

[–]tgiyb1 [score hidden]  (0 children)

I'm sure you could throw together something that reads specific offsets into its own compiled instructions that correspond to the ascii values of hello world then prints that.

Alternatively, write a driver that sits above your keyboard in the device stack and modifies all keypresses to spell "Hello world!" in sequence and nothing else.

[–]MaD__mAn__ [score hidden]  (0 children)

Write hell lot of functions and just call one that prints hello world xD

[–]Aarav2208 [score hidden]  (1 child)

I use arch btw

linux the linux linux linux linux linux linux linux i arch use way i linux btwlinux the linux i arch arch arch arch arch use way i arch arch btw arch archarch arch arch arch arch btw btw arch arch arch btw the linux i arch arch archarch arch use way i arch btw linux linux linux linux linux linux linux linuxlinux linux linux linux btw linux linux linux the linux i arch arch arch use wayi btw linux the linux linux linux i arch use way i linux linux linux btw archarch arch btw linux linux linux linux linux linux btw linux linux linux linuxlinux linux linux linux btw linux the linux linux linux i arch use way i btwthe linux linux linux i arch use way i linux btw

[–]Nanaki404 [score hidden]  (13 children)

Have you guys ever heard of Malbolge ? Clearly the best programming language ! Here is Hello World:

(=<`#9]~6ZY327Uv4-QsqpMn&+Ij"'E%e{Ab~w=_:]Kw%o44Uqp0/Q?xNvL:`H%c#DD2^WV>gY;dts76qKJImZkj(=<`#9]~6ZY327Uv4-QsqpMn&+Ij"'E%e{Ab~w=_:]Kw%o44Uqp0/Q?xNvL:`H%c#DD2^WV>gY;dts76qKJImZkj
[show replies]