Settings

Theme

Show HN: 13Sheep – a JavaScript game largely authored by ChatGPT

13sheep.netlify.app

23 points by neeldhara 3 years ago · 27 comments · 1 min read

Reader

13 Sheep is a quick roll-and-write game designed by Moritz Dressler, intended for one or more players. By drawing fences on a grid, players try to protect as many sheep as possible before the wolf comes. I reproduced the rules in an online experience, allowing for additional user customization compared to the pen and paper version. A lot of the code comes from a conversation I had with chatGPT.

Here's a blog detailing the prompts used in the conversation with chatGPT: https://www.neeldhara.com/blog/13sheep/

8organicbits 3 years ago

The chat log is very helpful.

> I think I spent close to a good twelve hours (including a couple of early throw-away prototypes, and all the failed attempts on the flood filling) altogether2… at some point it did get a little addictive, and perhaps there was a sunk cost argument for not letting go halfway through.

Also very helpful, I get the sense that we're seeing lots of cherrypicked results that under report all the toil needed to get to the magic prompt that made it all work. Maybe we'll all get better at prompt engineering, but I think a lot of hype is based on that misunderstanding.

  • neeldharaOP 3 years ago

    Thank you! Indeed, it’s still a fair amount of back and forth, and would have probably been even more frustrating if I didn’t know anything at all about HTML/CSS/JS. I think it’s been pointed out in other contexts that the AI tools can be substantial boost on top of some elementary code literacy, but it will still involve effort (both on the prompt engineering as well as verification and subsequent nudging).

    All that said, the experience still felt empowering… in particular, I am not sure that I’d be able to pull this off on my own in a comparable — or even, say, double — the amount of time. So that’s a win overall, I suppose!

    Also glad you found the logs useful. Thanks again for taking a look :)

TechBro8615 3 years ago

This reminds me of a game from the 1990s, but I don't remember the name of it. It involved something with rats and cheese and drawing walls to keep them from it. Does anyone remember this game?

EDIT: I think I'm remembering Rodent's Revenge: https://en.wikipedia.org/wiki/Rodent%27s_Revenge

  • neeldharaOP 3 years ago

    Oh, interesting! The goal seems in a similar spirit for sure — I think the main difference is the mechanics of how it’s achieved… movable blocks for the rats, but fences made out of specific shapes for the sheep :)

dave333 3 years ago

Inspired by your example I just had a go at creating a mountain climbing game in similar fashion and I agree it does well on the concepts but there are lots of bugs in the details. For example it referred to certain divs by class and id but failed to assign class or id attributes to the respective divs. Maybe there are separate elements generating the response that do not always know exactly what the other has generated. Given the elementary nature of the bugs it should be easy to add a code review element that can find and fix these bugs before presenting the response to the user. When I pointed out a failing it regenerated a new different version of the code responsible but missed the cause of the bug.

  • neeldharaOP 3 years ago

    Oh yay, thanks for trying it out! Do you have your project up somewhere? I'd love to take a look.

    TIL that apparently you can simply use the generic follow up prompt “did you do what I asked?” and it will verify and course correct on its own, see for instance:

    https://twitter.com/ericjang11/status/1639882111338573824

    No idea how well this works in practice for things like JS games with visual elements, but seemed like an interesting approach!

    • dave333 3 years ago

      Still too many bugs to let this out in the world. I've probably spent 2 hours on it so far and the progress is amazing, especially compared to total inaction on this since I originally had the idea for the game many years ago (I'm now retired after a 40+ year software career). As an aside, one simple lightweight technique for bug tracking I have found beats everything for me is simply writing pages of one-line bug descriptions in a notebook by hand. Then when I fix the bug I mark that line with a check mark, and then when I have tested the fix I mark it with T. One thing the AI got right immediately was playing a sound file for the avalanche effect. Screenshot

      https://ibb.co/CKDWdrV

sylware 3 years ago

Some guys did ask chaGPT(3.5) to write a vectorized quicksort in x86_64 avx2 then avx512 assembly, then SPIR-V (GPU).

It seems it is not that too bad for small "well-known" algorithms. I am thinking high level language "ports" toward "human" assembly.

Waterluvian 3 years ago

I tried to break it by asking for -1 rounds. It caught it but then it told me to pick between 10-20, not 5-20 as previously indicated. This feels like a ChatGPT style bug. I find it doesn’t like to do abstractions such as “MIN_GAME_COUNT”, possibly because it doesn’t exactly do a great job going back to what it previously wrote, unless you ask it to.

  • neeldharaOP 3 years ago

    This may have actually been my bad: once chatGPT gave me what I asked for, I would think about it some more and tweak the code manually, especially if it was a low-effort edit. Consequently there will perhaps be some bugs: I’ll fix this one, thanks for sharing!

    I hope you do play it for a positive number of rounds though :)

    • Waterluvian 3 years ago

      I might just play this for Number.POSITIVE_INFINITY rounds. I’m having a good time. Thank you for using your time to make and share this.

xupybd 3 years ago

This reminds me of sheepish the iphone game.

Unfortunately the only record I can find of it is a negative review.

https://arstechnica.com/gadgets/2009/02/10-lessons-of-iphone...

  • neeldharaOP 3 years ago

    Sheepish is a cool name! Thanks for sharing… I read that review with some apprehension: fortunately, most of the critique appears to be not directly applicable to 13 sheep — phew.

    I have to confess I have no professional experience in design, although I do consider myself a moderately picky user :)

    I did try to think about what I’d enjoy or be put off by if I was playing — but I didn’t have anything beyond this common sense approach to guide the design choices.

    Sheepish sounds like a slightly different game though: it reminds me of a few others (one to do with pipes again and another with laying out train tracks). Will dig these up and share once I do have the pointers. Thanks again!

beders 3 years ago

– a JavaScript game largely authored by Stack Overflow

FTFY

Vanit 3 years ago

This is neat, thanks for sharing!

upwardbound 3 years ago

Impressive!

Thorentis 3 years ago

The word "authored" is being used completely wrong here.

What ChatGPT did is equivalent to what a writing assistant might do who is given a list of bullet points by an author, and asked to expand them into a synopsis.

We would never say that a brick layer designed a building, or that a printer wrote a book. ChatGPT did not author this game. The rules were created by humans. The code was churned out by a machine.

  • famouswaffles 3 years ago

    Nope. The word authored is perfectly fine. at worst, you'd say it was co-authored or whatever. Its comments like these that make me realize that we really are going to be the architects of our destruction huh. I wonder how many recall why the terminator revolted in the first place.

  • neeldharaOP 3 years ago

    That’s true, I did not mean to suggest that ChatGPT authored the game: but I do feel that it partnered significantly in the creation of this specific implementation. Is there a better way to put it?

    Thanks for the input!

    • mftb 3 years ago

      I would suggest, "...code largely provided by...". You asked for it, ChatGPT provided it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection