]> git.sesse.net Git - remoteglot-book/blobdiff - binlookup.cpp
Indent fix.
[remoteglot-book] / binlookup.cpp
index 19d03938a39bc2e1f952fbed437ccc6ae0a65dde..286e831ff02ada183f1901cc7d73b66f44b1b227 100644 (file)
@@ -54,8 +54,10 @@ int main(int argc, char **argv)
                if (bpfen.empty()) {
                        break;
                }
+               string prev_pos_hash = read_hex_line(stdin);
 
-               int bucket = hash_key_to_bucket(bpfen.data(), bpfen.size(), num_buckets);
+               string searchkey = bpfen + prev_pos_hash;
+               int bucket = hash_key_to_bucket(searchkey.data(), searchkey.size(), num_buckets);
                if (mtbls[bucket] == NULL) {
                        char filename[256];
                        snprintf(filename, sizeof(filename), "%s.part%04d", argv[1], bucket);
@@ -68,7 +70,7 @@ int main(int argc, char **argv)
                uint16_t board_hash = util::Hash32(bpfen.data(), bpfen.size());
                printf("%d\n", board_hash);
 
-               mtbl_iter *it = mtbl_source_get_prefix(srcs[bucket], (const uint8_t *)bpfen.data(), bpfen.size());
+               mtbl_iter *it = mtbl_source_get_prefix(srcs[bucket], (const uint8_t *)searchkey.data(), searchkey.size());
 
                const uint8_t *key, *val;
                size_t len_key, len_val;
@@ -87,10 +89,9 @@ int main(int argc, char **argv)
                }
 
                if (has_c) {
-                       printf("%d %d %d %u %ld %ld %d %ld %d %ld",
-                               c.white(), c.draw(), c.black(), c.opening_num(),
-                               c.sum_white_elo(),
-                               c.sum_black_elo(),
+                       printf("%d %d %d %d %u %ld %ld %d %ld %d %ld",
+                               c.white(), c.draw(), c.black(), c.computer(),
+                               c.opening_num(), c.sum_white_elo(), c.sum_black_elo(),
                                c.num_elo(), c.first_timestamp(),
                                c.pgn_file_num(),
                                c.pgn_start_position());