Skip to content

An agent to automatically search for every possible combination in Infinite Craft https://neal.fun/infinite-craft/

License

Notifications You must be signed in to change notification settings

shitwolfymakes/NoFunNeal

Repository files navigation

Just how "infinite" is Infinite Craft?

What is Infinite Craft?

Infinite Craft is a combiner game in the same vein as Doodle God, with the twist that responses are generated by Llama 2. This makes the combinations theoretically infinite, but potentially not if the LLM starts to hallucinate.

What does it look like under the hood?

The API is called with a URL constructed from the two types being combined:

https://neal.fun/api/infinite-craft/pair?first=Fire&second=Water

And returns a JSON block with this structure:

{
  "result":"Steam",
  "emoji":"💨",
  "isNew":false
}

How can we store the response?

A graph database is ideal for this. I went with the DGraph database because it had a docker compose that worked the moment I ran it

How many responses can we send responsibly? (Smant/PointCrow Infinite-Craft stream for numbers)

Rate limit script only reaches a 100 requests in roughly 30 secs, so DDoS isn't something that needs to be worried about with a single runner.

Full testing with a single agent hit a rate limit of roughly 1 request/second

API hit failure (I think he noticed me)

A couple of days after starting curl testing on the api, it suddenly started returning 403 errors. Turns out I needed to include a User Agent String!

What size is the problem space?

Given the combination is of any 2 items and we can't rule out that order doesn't matter, the potential total number of combinations are:

∑,M,k=0; k!/((M−k)!M!) // the formula for total unique combinations

Algos for exhaustive search of M-to-M combinations?

I present: Bogosearch! Like Bogosort, but for searching. Maximally cursed!

  1. Select two random types
  2. Check if this combination is already stored
  3. If not already stored, reach out to the api to get the combination

Publishing the data

Combination data is published every 4 hours to this repo!

Abnormally long response times

The game can sometimes take very long periods of time responding to niche combinations. For example:

Pair to be combined: Farmer Zombie, Breakfast In Bed
Result "Nothing" inserted successfully.
Combo "Nothing" inserted successfully.
Elapsed time: 100627.74 milliseconds
Pair to be combined: Crypto Summer, Fishing Pole
Result "Crypto Winter" already exists.
Combo "Crypto Winter" inserted successfully.
Elapsed time: 79824.59 milliseconds
Pair to be combined: Prom Dragon, Devil
Result "Prom King" already exists.
Combo "Prom King" inserted successfully.
Elapsed time: 86221.65 milliseconds

None of these result in discoveries, it seems like Llama 2 just chokes on the input for some unknown reason.

Stuff I learned

  • Golang!
  • Graph database basics, DGraph, GraphQL
  • Document database basics, MongoDB
  • API analysis and communication
  • Improved prompting skills for/pair programming with ChatGPT, even 3.5 is pretty great if you know what you're asking for
  • Secrets management and handling creds programmatically (Biggest weakness is hardcoding filenames)

Headaches encountered

  • DGraph doesn't appear to have a way to spin up the db using a custom schema (wtf?)
  • Containerizing the agent itself was a 5-hour rabbithole of intractible networking issues. Skipped for time. Ultimately unnecessary, as the rate limit is super low.
  • Not setting the predicate types to exact in dgraph resulted in bad string comparison, so 18,274 extra nodes were created for the "???" result, and 1577 extra for "?"
  • "Connection reset by peer" issues seem to be solved by no longer spaming the api with the same "???" and "???" combinations

About

An agent to automatically search for every possible combination in Infinite Craft https://neal.fun/infinite-craft/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published