BWEM-community
BWEM-community copied to clipboard
Use CSV files for string test data
As I state in Discord, CSV files allow other developer use dataset as baseline for testing their implementation on multiple maps. Currently verification data lives in the code itself, if place it in the CSV data files our work could be reused by others.
Instead of CSV, what about something more INI- or JSON-like?
For example, spitballing:
[general]
name = (2)Showdown.scx
tile_dimensions = 64, 192
walk_dimensions = 1024, 3072
center_position = 1024, 3072
altitude_limits = 0, 426
[resources]
number_geysers = 6
number_minerals = 46
[base 1]
starting_location = true
tile_location = 5, 10 ; making up numbers now
pixel_location = 150, 300
minerals = [7, 12, 1500], [7, 13, 1500], [8, 13, 1500], ... ; tile position x, y, amount
geysers = ...
blocking_minerals = ...
[base 2]
tile_position = 60, 80
...
In a couple cases I have to shoehorn stuff into strings and section names that should maybe not be there. So with JSON:
{
"tile_dimensions": [64, 192],
"walk_dimensions": [1024, 3072],
"center_position": [1024, 3072],
"altitude_limits": [0, 426],
"resources" : {
"number_geysers": 6,
"number_minerals": 46,
},
"bases": [
{
"starting_location": true,
"tile_location": [5, 10], // making up numbers now
"pixel_location": [150, 300],
"minerals": [
{ "tile_position": [7, 12], "amount": 1500},
{ "tile_position": [7, 13], "amount": 1500},
{ "tile_position": [8, 13], "amount": 1500},
],
"geysers": [ ... ],
"blocking_minerals": [ ... ];
},
{
...
}
]
}
How does this sound as a general idea? Any preference to which of these options you like more? If you like the idea, any feedback on specific schemas?
I do like approach with JSON. It relatively easy to author with shallow structure. I think every field which you write in JSON make sense. For bases this should be enough. /cc @n00byedge
The downside of the JSON format is it's more heavyweight to parse, probably requiring a third-party library (unless there's something already in BWAPI or BWEM I don't know about). I'd probably recommend nlohmann/json for that.