Hacker News new | ask | show | jobs
by durkes 1176 days ago
This is really cool. I had a lot of fun building a hangman style game just now! It took 3 prompts to get it right... here was my third iteration (sorry, didn't save the first two): There is a problem where player 1 is unable to enter the secret word at the very beginning. Fix this issue. Also, clear the letter from the input after each time player 2 makes a guess, but display the incorrect guesses somewhere and don't allow player 2 to guess the same letter more than once.

I think it got a little confused with my last prompt: "Make both players also able to submit the input with the enter key." It correctly added the functionality, but it left it's explanation in the HTML of the page too. Still very cool. Here is the working game: https://backend-pico.onrender.com/hyundai-interface

1 comments

Thanks for sharing! Glad you had fun.

GPT4 sometimes insists on adding commentary even though I told it to only reply with code. I need to add a regex to clean up the response and only put the code into the page. I fixed your code manually to remove the explanation.

I wonder if you remind it with those instructions with each prompt, if that would help? Also, I'm curious, approx how much does it cost for each small app build / iteration?
Been using system message with GPT4 and it's supposed to follow that better, but that's a good idea. Will experiment with that.

Cost is somewhere between 1 cent to 10 cents per iteration (follow up iterations include all previous code so it's a lot of tokens).