rosshamish / catanlog Goto Github PK
View Code? Open in Web Editor NEWmachine-parsable, human-readable file format for describing a game of Catan
License: GNU General Public License v3.0
machine-parsable, human-readable file format for describing a game of Catan
License: GNU General Public License v3.0
Currently the pattern for buying things and playing development cards look like the following, respectively
player buys item, does_something_with_it
player plays dev card: card_name, does_something_with_it
Concrete examples being:
blue buys settlement, builds at (8 NW)
blue plays dev card: road builder, builds at (9 W) and (10 E)
It might simplify the reading and parsing if they looked more similar.
You might consider:
player action item_name, extra_information
Which would make it read more like:
blue buys road, builds at (8 NW)
blue plays road builder, builds at (9 W) and (10 E)
To a human it reads almost the same, but parsing it can be simplified a little.
Now the simple parser (read: not one using syntax trees and other fanciness) can split on ','. Everything before the comma is what the user did and everything after is information about precisely how they did it.
Before the comma always has three parts.
player is always the player
action is always "buy" or "build" (or other action names as they become necessary)
The action you see informs what you should expect to see in the third slot. If it's "buy" you should expect a settlement, city, road, etc. if it's "plays" you should expect a development card.
Once you know what to expect, you can look at item_name. Once you've seen the item name you will know how to parse what's on the other side of the comma.
Just a thought. If you don't like it, it's not a big deal. It's not as if it's unparseable now. Neat project, though.
You might consider adding optional timestamps to the file. Perhaps [2016-01-01T12:00:00.000Z] or even just the number of seconds since the game started [347].
It won't add much to the human-readable-ness of it. But it will add some more data for machine parsing. In terms of readable-ness the latter is probably a better option.
Why would anyone care about timestamps?
Well, if people start adopting your format there are some interesting possibilities. Having the timestamps will let you get information like average game length, average turn length, average turn length of a winning player, how does closeness to victory affect turn length, and possibly other things.
I think it would be interesting if this project picked up steam and the community generated hundreds or thousands of these files that we could pore over, extract data from, and create interesting analyses. But that requires that the information be captured and at a granular enough level.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.