diff --git a/README.md b/README.md index 19690d8..e3e17e2 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,15 @@ A high-performance toolchain for discovering interesting [Langton's Ant](https://en.wikipedia.org/wiki/Langton%27s_ant) outcomes. +## Table of Contents + - [The Toolchain](#toolchain) + - [Building](#building) + - [Third Party Libraries Used](#third-party-libraries-used) + +## Toolchain The toolchain consists of 5 separate programs designed to work together: - [next_cluster](#next_cluster) - Determines the next cluster number in a directory of clusters @@ -19,52 +25,7 @@ The toolchain consists of 5 separate programs designed to work together: - Similar to `simulate_one`, but runs a batch of simulations in a thread pool, intended for mass processing - Simulations share a generation limit, save points, and save interval, but not state -Having separate programs creates flexibility by allowing users to orchestrate them as desired. A simple example script for creating clusters of simulations: - -```sh -if [ $# -ne 2 ]; then - printf 'Usage: cluster.sh ' - exit 1 -fi - -width=1000 -height=1000 -col=500 -row=500 -gen_limit=10000000000 -out_dir=$1 -sim_count=$2 - -./next_cluster_release.exe ${out_dir} -cluster=$? - -printf "Cluster %d, %s\n" ${cluster} ${out_dir} - -./make_states_release.exe \ - -N ${sim_count} \ - -o ${out_dir}/cluster${cluster} \ - -n randwords,2 \ - -m 256 -M 256 \ - -t LR \ - -s rand \ - -w ${width} -h ${height} \ - -x ${col} -y ${row} \ - -O NESW \ - -g fill=0 \ - -W words.txt \ - -c -wait - -./simulate_many_release.exe \ - -T 6 \ - -L ${out_dir}/cluster${cluster}/log.txt \ - -S ${out_dir}/cluster${cluster} \ - -g ${gen_limit} \ - -f raw \ - -o ${out_dir}/cluster${cluster} \ - -s -y -l -wait -``` +Having separate programs creates flexibility by allowing users to orchestrate them as desired. See [scripts/cluster.py](/scripts/cluster.py) for a simple example script for creating clusters of simulations. ## make_states @@ -273,6 +234,58 @@ Visualized: +## Building + +For now the primary supported platform is Linux. As such, only Linux has a build system included. This project uses make. + +To build the toolchain in release (optimized) mode, run: + +```shell +make -j $(nproc) +``` + +To build a specific program from the toolchain, run one of: + +```shell +make -j $(nproc) next_cluster +make -j $(nproc) make_states +make -j $(nproc) make_image +make -j $(nproc) simulate_one +make -j $(nproc) simulate_many +``` + +To build the toolchain in debug mode, use `BUILD_TYPE=debug`: + +```shell +# The whole toolchain: +make -j $(nproc) BUILD_TYPE=debug + +# A specific program from the toolchain: +make -j $(nproc) BUILD_TYPE=debug next_cluster +make -j $(nproc) BUILD_TYPE=debug make_states +make -j $(nproc) BUILD_TYPE=debug make_image +make -j $(nproc) BUILD_TYPE=debug simulate_one +make -j $(nproc) BUILD_TYPE=debug simulate_many +``` + +To build and run the testing suite in debug mode (recommended), run: + +```shell +make -j $(nproc) BUILD_TYPE=debug tests && bin/debug/tests +``` + +To build and run the testing suite in release mode, run: + +```shell +make -j $(nproc) tests && bin/release/tests +``` + +And the usual cleaning process: + +```shell +make clean +``` + ## Third Party Libraries Used - [Boost 1.80.0](https://www.boost.org/users/history/version_1_80_0.html) (modules: program_options, container) diff --git a/src/simulation_parse_state.cpp b/src/simulation_parse_state.cpp index 1e54ef9..4438525 100644 --- a/src/simulation_parse_state.cpp +++ b/src/simulation_parse_state.cpp @@ -402,7 +402,7 @@ simulation::state simulation::parse_state( auto const validate_property_set = [&json, &add_err](char const *const key) -> i8 { u64 const num_occurences = json.count(key); if (num_occurences == 0) { - add_err(make_str("`%s` not set", key)); + add_err(make_str("%s not set", key)); return 0; } else { return 1; diff --git a/src/testing_main.cpp b/src/testing_main.cpp index 6f76de2..fe238b2 100644 --- a/src/testing_main.cpp +++ b/src/testing_main.cpp @@ -93,15 +93,15 @@ i32 main() }; assert_parse({/* state */}, { - "`generation` not set", - "`last_step_result` not set", - "`grid_width` not set", - "`grid_height` not set", - "`grid_state` not set", - "`ant_col` not set", - "`ant_row` not set", - "`ant_orientation` not set", - "`rules` not set", + "generation not set", + "last_step_result not set", + "grid_width not set", + "grid_height not set", + "grid_state not set", + "ant_col not set", + "ant_row not set", + "ant_orientation not set", + "rules not set", }, "occurence_errors.json"); assert_parse({/* state */}, {