Implemented Carcassonne’s rules over the weekend (hacking toward an AI). Scoring farms was very hard to express. Anyone have elegant tricks?
Conversation
Replying to
there is nothing to beta test unless you like looking at unit tests that prove the rules are implemented correctly
Replying to
1
I suspect maybe they hard-coded handling of each tile type rather than trying to compute the general solution?
1
Show replies
Replying to
I want to say flood fill, but that’s probably too simplistic and requires a bunch of edge cases. What did you use?
2
@tennabey It was pretty flood-fill-y.
Replying to
Which farm scoring rules—European or American? (I haven’t tried to code it, but sounds cool!)
1
Whoa, I had no idea there were different rules. American, I guess!
1
Show replies
Replying to
I'd lean towards finding connected components of a vertex labelled graph, where label=adjacent city IDs + player weeb if any
1
1
And each tile maps to potentially several vertices, that's an important detail





