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.
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
}
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
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
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!
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
I present: Bogosearch
! Like Bogosort, but for searching. Maximally cursed!
- Select two random types
- Check if this combination is already stored
- If not already stored, reach out to the api to get the combination
Combination data is published every 4 hours to this repo!
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.
- 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)
- 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