diff options
| author | Tom Harley | 2019-02-20 14:29:41 +0000 |
|---|---|---|
| committer | Tom Harley | 2019-02-20 14:29:41 +0000 |
| commit | e03ce66f47b880ac954c2f9172ecd387c1ee1e06 (patch) | |
| tree | d3c6dd64c06f89c6870c9f04e54dae6ab400170c /centre.cpp | |
| parent | Move rules files to dedicated folder (diff) | |
| download | metasol-e03ce66f47b880ac954c2f9172ecd387c1ee1e06.tar.gz metasol-e03ce66f47b880ac954c2f9172ecd387c1ee1e06.zip | |
Add rules file for Canfield
It seems like Canfield may need a longer timeout on the voters, but for the .json rules seem to describe the game accurately.
Diffstat (limited to 'centre.cpp')
| -rw-r--r-- | centre.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -768,6 +768,25 @@ int assign_pile_group(jsmntok_t *key, const char *group_name, } } +int assign_foundations_base(jsmntok_t *key, ms_rules *r, char *js) { + long length = key->end - key->start; + char *key_str = &js[key->start]; + if (!strncmp(key_str, "foundations base", length)) { + jsmntok_t *val = next_tok(key); + char *val_str = &js[val->start]; + if (!strncmp(val_str, "random", strlen("random"))) { + r->specific_foundations_base = false; + } else { + r->specific_foundations_base = true; + r->foundations_base = char_rank(val_str[0]); + } + + return 2; + } else { + return 0; + } +} + ms_rules json_rules(const char *filename) { FILE *f = fopen(filename, "rb"); long length = filelen(f); @@ -870,6 +889,11 @@ ms_rules json_rules(const char *filename) { are("sequence build policy", str_build_policy, &r.sequence_build_policy); + x = assign_foundations_base(tok, &r, buf); + if (x) { + break; + } + debug("%s\n", &buf[tok->start]); assert(false); } default: { |
