Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    88comments
  2. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    44comments
  3. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    45comments
  4. San Francisco Onion Futures Company(onionfutures.com ↗)
    65comments
  5. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    406comments
  6. Apple M6 Pro Achieves the Highest Single-Core CPU Score in Geekbench 7(geekbench.com ↗)
    27comments
  7. Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step(github.com/awlevin ↗)
    46comments
  8. Cloudflare Quick Tunnels(cloudflare.com ↗)
    279comments
  9. Science Is Open Software(jepedersen.dk ↗)
    37comments
  10. SDCC – Small Device C Compiler(sourceforge.net ↗)
    17comments
  11. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    14comments
  12. How to Write with an LLM(sockpuppet.org ↗)
    326comments
  13. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    32comments
  14. Saving another 100TB of RAM(cloudflare.com ↗)
    72comments
  15. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    86comments
  16. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    5comments
  17. "The Secret Life of Circuits" is here(coredump.cx ↗)
    2comments
  18. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    2comments
  19. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    104comments
  20. OpenJev(openjev.com ↗)
    264comments
  21. Goroutine Leak Profiles(go.dev ↗)
    2comments
  22. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    88comments
  23. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    70comments
  24. Veronese's Dogs(publicdomainreview.org ↗)
    discuss
  25. Minimal Phone 2(minimalcompany.com ↗)
    221comments
  26. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    13comments
  27. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    63comments
  28. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    99comments
  29. Cyclomatic Complexity in C#(ndepend.com ↗)
    19comments
  30. Suppress vulnerabilities applying Kubernetes context to scans(github.com/alegrey91 ↗)
    1comments

Ask HN: Anyone Doing Advent of Code with ChatGPT?

10 pointsby 3y ago
5 comments
I've been thinking that it could be an interesting idea to see how far it can go, and to document each step along the way.
3y agoHN ↗

Just finished Day 1. Series of prompts were:

- --- Day 1: Calorie Counting --- (verbatim copied and pasted the problem text)

    To solve this problem, we need to read the list of food Calories and keep track of how many Calories each Elf is carrying. We can do this by keeping a list of the Calories carried by each Elf and updating the list as we read the input.

    (gave the answer here in Python-like pseudocode)

- Solve the above problem in Python

    (gave the answer in actual Python)

- Give me the answer but with the input hardcoded also (wanted to try some input hardcoded just to see if it works)

    (worked)

- I'm getting an error

    Traceback (most recent call last):
      File "main.py", line 18, in <module>
        ElfCalories[-1] += Calories
    IndexError: list index out of range

    The error IndexError: list index out of range means that you are trying to access an index in a list that does not exist. In this case, it looks like it is happening when you try to add the Calories to the current Elf (ElfCalories[-1] += Calories).

    The problem is that you are not adding a new Elf to the list when you encounter the first non-blank line in the input. This means that when you try to add the Calories to the current Elf, the list is empty, so there is no -1 index to access.

    To fix this, you can add a new Elf to the list when you first encounter a non-blank line in the input, like this:

    (fixed the error)

- Give me a function that reads in a file and solves the previous problem with the elves

    (gives the answer)

- Give me the same solution above but with the ability to input a link address to download the input file instead

    (gives the answer but the code itself didn't work, so I manually copied and pasted the input file and added it to the folder, which then gave the right answer)
3y agoHN ↗

Can it find the answer which doesn't use so much memory and doesn't have the edge case which caused the index error, or is it stuck at day 3 bootcamper level even with so much prompting?

3y agoHN ↗

I tried this prompt:

The Elves take turns writing down the number of Calories contained by the various meals, snacks, rations, etc. that they've brought with them, one item per line. Each Elf separates their own inventory from the previous Elf's inventory (if any) by a blank line. Find the total number of calories being carried by the elf who is carrying the most calories. Write Python code to solve this problem. This is the key paragraph from the problem description, plus the sentence asking for the solution.

The code it produced was correct, although it doesn't include reading the input from a file: https://pastebin.com/M00t217u

I then asked, "Can you modify the code to read the input from a file?"

Again, the code it produced was correct and it now reads from a file: https://pastebin.com/N6mcZu55

I then tried, "Can you make the code more memory efficient?".

It said, "Yes, we can make the code more memory efficient by avoiding the use of the intermediate list of lists that contains the number of calories for each Elf. Instead, we can directly compute the total number of calories for each Elf as we parse the input, and find the maximum value at the end. Here is an example:"

https://pastebin.com/NCtx4KHc

3y agoHN ↗

I tried this on a lark for Day 3 last night and it got Part 1 correct with no changes (other than using go:embed for the input file). Part 2 required a bit of tweaking. It is pretty impressive nonetheless.

Today, I used it to solve Day 2 (rock/paper/scissors). It got pretty close, but had 95% of the logic correct.