7

My non-developer friend (who knows some very rudimentary basics about front-end web dev through me) asked ChatGPT to create a game with an arrow-key (left, right) movable player that shoots bullets.

He pasted the answer in a jsfiddle. The first iteration didn't work. It used DOM and CSS, so I told him he needed to instruct it to use HTML canvas. Lo and behold: https://jsfiddle.net/mehp8jay/

Comments
  • 3
    See.
    Someone needs to know the tech
    Noones job is going anywhere
  • 2
    @AvatarOfKaine I still wonder in these cases, what would happen if the user just tell the AI : it doesn't work.

    I wonder if it will know what is not working and will use canvas on it's own.
  • 2
    @Grumm Great question, I'd like to know the answer to this as well.

    I'm not willing to give my phone number to openai, so I can't test it myself :c
  • 0
    @Hazarth When I can get on the chat, I will try it.

    It looks like there are a lot of stereotypes in it too.

    Like ask it to describe a stewardess and you will get the most generic possible answer : a blond girl in a blue dress (Cannot verify this at the moment)
  • 0
    @Grumm I'm honestly having a problem picturing how a neural net is generating program code.
  • 0
    @Grumm I mean maybe it's selecting strategies and something else organizes them and inserts tokens etc ?
  • 0
    @Grumm but then someone would have had to tokenize and template those strategies somehow
  • 0
    @Grumm ah.
    Maybe it parses the language and removes the string or numeric literals and replaced variables with "var" on the input neurons to select strategy and then references the modded upvoted articles and inserts the literals and the like into the parsed code examples?
  • 0
    @Grumm trying to picture how the good people at openai avoided editing 2 million stack overflow posts lol
  • 1
    @AvatarOfKaine Maybe... What I know is that the chat was made by humans.

    Whatever logic there is behind, it was created by a team. So for me any AI in the world is just a set of instructions. And it is running the program.

    Sure it can be with neural networking and all. But in the end a human created it.

    The fact that they curated all the data for training, shows that they either removed a lot of junk, could add personal (from the devs) opinions and other stuff.
  • 0
  • 1
    @Hazarth Ok, I tried and it is just not the best programmer... Created some html and js code to move something using pixels.

    said that is was not working and I get this :

    The code I provided is a basic example and it should work as expected but there might be some issues that could cause it not to work.

    Make sure that you are running the code on a web server. Some browsers do not allow running HTML files directly from the file system for security reasons, so you may need to run the code on a web server.

    Check the JavaScript console for any errors. The JavaScript code is where most of the game logic is implemented, so any errors there would prevent the game from working.

    Verify that the CSS styles are being applied correctly. If the player and bullet elements are not being styled correctly, then it will be difficult to tell if the game is working.

    Make sure that your browser support the feature you are trying to use, like event keyCode or offset properties.
  • 2
    @Grumm yeah, that's not super helpful unless you're already a programmer xD in which case you already know where to look
  • 0
    @Hazarth Yes, I use it for explaining stuff. Instead of searching on google and read 10 stackoverflows and some papers. I can just ask the chat to explain this and that.

    But to just copy paste the stuff it gives you... I hope that users always will double check first.
  • 1
    @Grumm it defo has its flaws, but still the example I shared in this rant I thought was pretty impressive after only 2 iterations, maybe 10min total.

    I could come up with the program myself, but not before spending a longer time to look up window mouse position properties and canvas-specific methods, then assert math assumptions.

    Also asked it to create an express.js middleware for loading translations asynchronously and did pretty well after 3 iterations
  • 1
    @webketje For that it is definitely a great tool too.

    You can spend less time figuring something out or just give a basic math code.

    But it can quickly turn into lazy programming.
Add Comment