←back to thread

204 points warrenm | 2 comments | | HN request time: 0.543s | source
Show context
AnotherGoodName ◴[] No.45106653[source]
I’ve been working on board game ai lately.

Fwiw nothing beats ‘implement the game logic in full (huge amounts of work) and with pruning on some heuristics look 50 moves ahead’. This is how chess engines work and how all good turn based game ai works.

I’ve tried throwing masses of game state data at latest models in pytorch. Unusable. It Makes really dumb moves. In fact one big issue is that it often suggests invalid moves and the best way to avoid this is to implement the board game logic in full to validate it. At which point, why don’t i just do the above scan ahead X moves since i have to do the hard parts of manually building the world model anyway?

One area where current ai is helping is on the heuristics themselves for evaluating best moves when scanning ahead. You can input various game states and whether the player won the game or not in the end to train the values of the heuristics. You still need to implement the world model and look ahead to use those heuristics though! When you hear of neural networks being used for go or chess this is where they are used. You still need to build the world model and brute force scan ahead.

One path i do want to try more: In theory coding assistants should be able to read rulebooks and dynamically generate code to represent those rules. If you can do that part the rest should be easy. Ie. it could be possible to throw rulebooks at ai and it play the game. It would generate a world model from the rulebook via coding assistants and scan ahead more moves than humanly possible using that world model, evaluating to some heuristics that would need to be trained through trial and error.

Of course coding assistants aren’t at a point where you can throw rulebooks at them to generate an internal representation of game states. I should know. I just spent weeks building the game model even with a coding assistant.

replies(12): >>45106842 #>>45106945 #>>45106986 #>>45107761 #>>45107771 #>>45108876 #>>45109332 #>>45109904 #>>45110225 #>>45112651 #>>45113553 #>>45114494 #
coeneedell ◴[] No.45106842[source]
IIRC the rules system for magic the gathering: Arena is generated by a sort of compiler fed the rules. You might not even need a modern coding assistant to build out something reasonable in a DSL that is perfect, then have people (or an LLM after fine tuning) transforms rule books into the DSL.
replies(1): >>45110517 #
1. Crespyl ◴[] No.45110517[source]
They have an interesting write up here: https://magic.wizards.com/en/news/mtg-arena/on-whiteboards-n...

There's a lisp variant involved, and IIRC even a parser that reads the card text to auto-generate the rules code for most of the cards.

replies(1): >>45117283 #
2. fennecbutt ◴[] No.45117283[source]
Tho tbf there are plenty of cards with what are essentially footnotes. They say reading the card explains the card but that's not always the case, sometimes there's nuance because mtg has so many fucking crazy interactions and the whole stack thing.

I haven't played in a month or two but now I'm getting that itch again aha. When's bloomburrow 2, enough of this UB crap.