← Back to context

Comment by nl

4 years ago

> A new computer lanugage called hnarguer has a for loop mechanisms call "loopy", an "if" statement called "loveit" and declares the type of all variables.

> Write "hello world" in hnarguer

Here is how you can write "Hello, world!" in the hnarguer programming language:

  # Declare a string variable to store the output message
  string message = "Hello, world!"

  # Use the "loopy" for loop to iterate over the characters in the message
  loopy(int i = 0; i < length(message); i++) {
    # Use the "loveit" if statement to check if the current character is a space
    loveit(message[i] == ' ') {
      # If so, output a newline character
      print("\n")
    }
    # Otherwise, output the current character
    else {
      print(message[i])
    }
  }

(it can also do FizzBuzz)

I asked it to write a function that could calculate the grade adjusted pace between 2 latitude, longitude coordinate pairs. What it spit was naive but correct enough, given the prompt. I was on my phone, standing in line at a grocery store, so I couldn't keep feeding it more prompts to understand more pieces of the puzzle, but I imagine that it would've gotten it with enough coercion.

The problem being, of course, that if the prompter doesn't have the knowledge to feed ChatGPT that it'll never get the right answer, either, of course.

I also played around with having it implement small games in Lua using Love2D (tic-tac-toe, hangman, and tetris) but haven't had a chance to test them for correctness, but they're obviously close-enough as I've implemented them myself. Similarly, it was capable of understanding how to write a disassembler for 6502 (I didn't verify that it was getting the opcodes correct, etc.), ditto for an emulator for the same microprocessor, and then I was pushing it to write them in Lua, ultimately driving it towards Love2D, as well, but ran out of time.

It's not perfect but it's really intriguing. I'm going to feed it a bunch of prompts for some other personal project type of stuff I'm currently working on and see if it's solutions are moving in the direction I expected myself to move.