Show HN: Controversial quiz game generated by ChatGPT

(github.com)

40 points | by lovasoa 508 days ago

7 comments

  • lovasoa 508 days ago
    The quiz is deployed on https://sensitive-topic-history-quiz.ophir.dev/

    It took me way longer than it would if I had allowed myself to tweak the code myself, but I finally did it. There isn't a single line of code in the repo that I wrote myself. There are some things that required many iterations for ChatGPT to get right, but I always found a way to point it to its own mistakes and to have it rewrite the part of the code that was wrong on its own.

    • dgeiser13 507 days ago
      Why is there a countdown timer? Why can't I just answer questions without being timed?
      • lovasoa 507 days ago
        Yes, that was an idea of ChatGPT. I could have had it remove the timer, but I find it interesting this way. To get a good score, you have to play multiple times, and in the end you really learn the answer to all the questions.
      • lobsterboix 507 days ago
        Ask the AI, the poster didn't write it!
  • valleyer 508 days ago
    How are you all getting around the response length limits?

    I've been experimenting with using ChatGPT to generate source code, and the code listings keep getting cut off. My attempts to get it to paginate its responses have not really worked (it seems to understand that I'm asking for the file to be broken across several messages, but suggestions like "limit each message to 50 lines of code" aren't heeded).

    • ad404b8a372f2b9 507 days ago
      The best I've managed is to say something to the effect of:

      Ok now write the end of the file starting from line "[the literal line before it cut off]". That being said, as with the "Try Again" function, there is no guarantee that it's what it would have written the first time around. Also it keeps breaking the blockquote formatting, I don't know why.

      Generally I've found it's incapable of writing large novel systems correctly if you are trying to solve a specific problem, so I found large outputs generally useless. What I do is that I cut the problem into sub-problems and have him solve them one by one. Sometimes I'll show him an example of inputs, tell him what I want the function to do and ask him to generate the output. Then I'll tell him "Generate a function to go from this input to this output" and he has a good track record of producing small and correct pieces of code. Then the context of this previous task helps him solve the subsequent tasks more easily.

      Another pitfall with large outputs is that he seems to give as much weight to his answers as to yours. So if he gives a large incorrect output it will be more likely to corrupt the logic on which it will base subsequent answers. Often I'll tell it to just "Answer with O.K" or just end with "Do you understand?" so it doesn't go on a long logic-corrupting answer. The problem is that eventually he starts to answer with specifications of his own and asks me if I understand and to only respond with O.K ...

    • keenmouse 505 days ago
      I've had fairly good success with "Divide the code into numbered sections, tell me how many there are, and allow me to request a section by number." It usually then shows a numbered list of sections with descriptions of what is in each section(!). Then I just say, "Show me section x." for each one.

      I use either that method or "Continue from this line: [unique line of code from near the end of the previous output]"

      Neither method works consistently, but usually one or the other does.

    • lovasoa 508 days ago
      I had to ask it to refactor components multiple times, so as to keep small components that it could easily rewrite in full in a single answer.
    • sdwr 508 days ago
      Not chatGPT, but the openAI code playground will continue a functionn if given another turn.
      • valleyer 508 days ago
        So, I can totally get ChatGPT to continue the file it's listing, but when it does, it's clear that some code was skipped. (The messages often truncate right in the middle of a line, or even in the middle of a "quoted string literal".)
    • djokkataja 507 days ago
      Haven't tried it much for source code, but for prose you can simply say "continue" and it will pick up where it left off.
  • lovasoa 504 days ago
    Someone opened an issue on the repo, so I let ChatGPT handle it: https://github.com/lovasoa/Sensitive-Topic-History-Quiz/issu...
  • eqmvii 508 days ago
    Now we just have to automate making multiple files at once, and maybe bolt some unit testing on to feed prompts backs in…
  • zug_zug 508 days ago
    I would love if you could publish the set of prompts you used to generate this game (I guess that's the new equivalent form of source)
    • lovasoa 508 days ago
      I made it over the course of several hours, and had to start from a fresh thread multiple times. I don't have all of the prompts. But here are some examples:

      - Fix the missing div and classes in the component

      - Wait a few milliseconds before switching to the next question when the user answers

      - During this time, change the color of the button using a css class. Use coherent colors, make the color different when the answer was right and when it was wrong.

      - Use react instead of direct dom manipulation to handle classes

      - Create a new GameInProgress.css stylesheet just for this component where you handle button colors, and import it in the component Answer with just two code blocks, for the js and for the css

      - Add the "correct" or "incorrect" class only when the button is clicked, wait 50ms before switching to the next question.

      - When the button is clicked, we need to first change the class, then wait 50ms, then call the rest of the code to handle the answer selection. Also, we need to do that using only react, no direct dom manipulation. In NO case should the answer be given to the user before they clicked a button. Respond with only the JSX.

      - Change the CSS to make the transitions smooth during the 100ms interval where the correct answers are shown.

      - The main title of the page is displayed too high, it is half cut. How to fix that in the main CSS ?

      - It's still not displayed in full, the top appears cropped

      - Thanks, it's better, but there is still not enough space at the top of the page

      - Here is a list of questions for a quizz game… Generate a JSON containing 10 more questions in the same style.

      - Write a JSON file containing 10 more questions and answers in the same format and in the same style. All the questions should be about the present or past foreign policy of the US, contain some degree of irony, and make the player think about the human lives that were lost or destroyed because of such policies.

  • _ache_ 508 days ago
    USA invades Spain ? O_o

    Isn't it a little exaggerated ?

  • timhigins 508 days ago
    Can you publish some of the prompts that you used?
    • lovasoa 508 days ago
      I published some of them in another thread. If you have cool prompt ideas, please try them and make a PR to the repo with the changes ChatGPT suggested :)