diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml index fe0bbdd89..64c59060e 100644 --- a/.github/workflows/ubuntu-ci.yml +++ b/.github/workflows/ubuntu-ci.yml @@ -28,11 +28,11 @@ jobs: sudo apt-get update -qq sudo apt-get install -y --no-install-recommends libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libgl1-mesa-dev libglu-dev - - uses: Jimver/cuda-toolkit@v0.2.5 + - uses: Jimver/cuda-toolkit@v0.2.8 id: cuda-toolkit with: - cuda: '11.5.1' - + cuda: '11.7.0' + - name: Run vcpkg uses: lukka/run-vcpkg@v6 with: diff --git a/README.md b/README.md index 4c602e5a2..ce8fb5c44 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ The development is driven by the desire to better understand the conditions for An important goal is to make the simulator user-friendly through a modern user interface, visually appealing rendering and a playful approach.

+**IMPORTANT:** The current development is taking place on the branch [version4](https://github.com/chrxh/alien/tree/version4). + + # Main features ### Physics and graphics engine - Particles for simulating soft body mechanics, heat dissipation, bondings, damages, phase transitions, etc. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4e09ca9e8..650a6d368 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,10 @@ # Release notes +## [3.3.1] - 2023-02-03 +### Added +- allow comments starting with # in cell code +- decompiled cell code shows matching symbols in comments + ## [3.3.0] - 2022-10-05 ### Added - extended color semantic for cells: food chain color matrix and cell color transition rules diff --git a/examples/simulations/demos/Dark Forest.settings.json b/examples/simulations/demos/Dark Forest.settings.json index 0814b16cb..b658400b6 100644 --- a/examples/simulations/demos/Dark Forest.settings.json +++ b/examples/simulations/demos/Dark Forest.settings.json @@ -1,156 +1,357 @@ { "general": { - "time step": "15574", + "time step": "0", "world size": { "x": "2500", "y": "1500" } }, "simulation parameters": { - "time step size": "1.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "time step size": "1.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "cell": { - "binding force": "1.000000", - "max velocity": "2.000000", - "max binding distance": "2.600000", - "repulsion strength": "0.080000", - "mutation rate": "0.000000", - "min distance": "0.200000", - "max distance": "1.300000", - "max force": "0.367000", - "max force decay probability": "0.200000", + "binding force": "1.00000000", + "max velocity": "2.00000000", + "max binding distance": "2.59999990", + "repulsion strength": "0.08000000", + "mutation rate": "0.00000040", + "min distance": "0.20000000", + "max distance": "1.29999995", + "max force": "0.36700001", + "max force decay probability": "0.20000000", "max bonds": "6", "max token": "3", "max token branch number": "6", - "min energy": "50.000000", - "transformation probability": "0.200000", - "fusion velocity": "0.206000", - "max binding energy": "500000.000000", + "min energy": "50.00000000", + "transformation probability": "0.20000000", + "fusion velocity": "0.20600000", + "max binding energy": "500000.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "computer": { "max instructions": "15", "memory size": "8" }, "weapon": { - "strength": "0.100000", - "energy cost": "0.159000", - "geometry deviation exponent": "0.000000", - "target color mismatch penalty": "0.375000", - "color penalty": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "strength": "0.10000000", + "energy cost": "0.15899999", + "geometry deviation exponent": "0.00000000", + "target color mismatch penalty": "0.37500000", + "food chain color matrix[0, 0]": "1.00000000", + "food chain color matrix[0, 1]": "1.00000000", + "food chain color matrix[0, 2]": "1.00000000", + "food chain color matrix[0, 3]": "1.00000000", + "food chain color matrix[0, 4]": "1.00000000", + "food chain color matrix[0, 5]": "1.00000000", + "food chain color matrix[0, 6]": "1.00000000", + "food chain color matrix[1, 0]": "1.00000000", + "food chain color matrix[1, 1]": "1.00000000", + "food chain color matrix[1, 2]": "1.00000000", + "food chain color matrix[1, 3]": "1.00000000", + "food chain color matrix[1, 4]": "1.00000000", + "food chain color matrix[1, 5]": "1.00000000", + "food chain color matrix[1, 6]": "1.00000000", + "food chain color matrix[2, 0]": "1.00000000", + "food chain color matrix[2, 1]": "1.00000000", + "food chain color matrix[2, 2]": "1.00000000", + "food chain color matrix[2, 3]": "1.00000000", + "food chain color matrix[2, 4]": "1.00000000", + "food chain color matrix[2, 5]": "1.00000000", + "food chain color matrix[2, 6]": "1.00000000", + "food chain color matrix[3, 0]": "1.00000000", + "food chain color matrix[3, 1]": "1.00000000", + "food chain color matrix[3, 2]": "1.00000000", + "food chain color matrix[3, 3]": "1.00000000", + "food chain color matrix[3, 4]": "1.00000000", + "food chain color matrix[3, 5]": "1.00000000", + "food chain color matrix[3, 6]": "1.00000000", + "food chain color matrix[4, 0]": "1.00000000", + "food chain color matrix[4, 1]": "1.00000000", + "food chain color matrix[4, 2]": "1.00000000", + "food chain color matrix[4, 3]": "1.00000000", + "food chain color matrix[4, 4]": "1.00000000", + "food chain color matrix[4, 5]": "1.00000000", + "food chain color matrix[4, 6]": "1.00000000", + "food chain color matrix[5, 0]": "1.00000000", + "food chain color matrix[5, 1]": "1.00000000", + "food chain color matrix[5, 2]": "1.00000000", + "food chain color matrix[5, 3]": "1.00000000", + "food chain color matrix[5, 4]": "1.00000000", + "food chain color matrix[5, 5]": "1.00000000", + "food chain color matrix[5, 6]": "1.00000000", + "food chain color matrix[6, 0]": "1.00000000", + "food chain color matrix[6, 1]": "1.00000000", + "food chain color matrix[6, 2]": "1.00000000", + "food chain color matrix[6, 3]": "1.00000000", + "food chain color matrix[6, 4]": "1.00000000", + "food chain color matrix[6, 5]": "1.00000000", + "food chain color matrix[6, 6]": "1.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" }, "constructor": { "offspring": { - "cell energy": "100.000000", - "cell distance": "1.600000", - "token energy": "60.000000", - "token suppress memory copy": "0.002000" + "cell energy": "100.00000000", + "cell distance": "1.60000002", + "token energy": "60.00000000", + "token suppress memory copy": "0.00200000", + "inherit color": "false" } }, "sensor": { - "range": "220.000000" + "range": "220.00000000" }, "communicator": { - "range": "250.000000" + "range": "250.00000000" } } }, "token": { - "mutation rate": "0.000000", + "mutation rate": "0.00004200", "memory size": "256", - "min energy": "3.000000" + "min energy": "3.00000000" }, "radiation": { - "exponent": "1.000000", - "factor": "0.000050", - "probability": "0.030000", - "velocity multiplier": "1.000000", - "velocity perturbation": "0.500000" + "exponent": "1.00000000", + "factor": "0.00005000", + "probability": "0.03000000", + "velocity multiplier": "1.00000000", + "velocity perturbation": "0.50000000" }, "spots": { "num spots": "0", "0": { "color": "0", "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, "shape": "circular", - "core width": "100.000000", - "core height": "200.000000", - "core radius": "100.000000", - "fadeout radius": "100.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "core width": "100.00000000", + "core height": "200.00000000", + "core radius": "100.00000000", + "fadeout radius": "100.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "radiation": { - "factor": "0.000200" + "factor": "0.00020000" }, "cell": { - "max force": "0.800000", - "min energy": "50.000000", - "binding force": "1.000000", - "fusion velocity": "0.400000", - "max binding energy": "500000.000000", - "mutation rate": "0.000000", + "max force": "0.80000001", + "min energy": "50.00000000", + "binding force": "1.00000000", + "fusion velocity": "0.40000001", + "max binding energy": "500000.00000000", + "mutation rate": "0.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "weapon": { - "energy cost": "0.200000", - "target color mismatch penalty": "0.000000", - "color penalty": "0.000000", - "geometry deviation exponent": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "energy cost": "0.20000000", + "target color mismatch penalty": "0.00000000", + "geometry deviation exponent": "0.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" } } }, "token": { - "mutation rate": "0.000000" + "mutation rate": "0.00000000" + }, + "function": { + "weapon": { + "color matrix[0, 0]": "1.00000000", + "color matrix[0, 1]": "1.00000000", + "color matrix[0, 2]": "1.00000000", + "color matrix[0, 3]": "1.00000000", + "color matrix[0, 4]": "1.00000000", + "color matrix[0, 5]": "1.00000000", + "color matrix[0, 6]": "1.00000000", + "color matrix[1, 0]": "1.00000000", + "color matrix[1, 1]": "1.00000000", + "color matrix[1, 2]": "1.00000000", + "color matrix[1, 3]": "1.00000000", + "color matrix[1, 4]": "1.00000000", + "color matrix[1, 5]": "1.00000000", + "color matrix[1, 6]": "1.00000000", + "color matrix[2, 0]": "1.00000000", + "color matrix[2, 1]": "1.00000000", + "color matrix[2, 2]": "1.00000000", + "color matrix[2, 3]": "1.00000000", + "color matrix[2, 4]": "1.00000000", + "color matrix[2, 5]": "1.00000000", + "color matrix[2, 6]": "1.00000000", + "color matrix[3, 0]": "1.00000000", + "color matrix[3, 1]": "1.00000000", + "color matrix[3, 2]": "1.00000000", + "color matrix[3, 3]": "1.00000000", + "color matrix[3, 4]": "1.00000000", + "color matrix[3, 5]": "1.00000000", + "color matrix[3, 6]": "1.00000000", + "color matrix[4, 0]": "1.00000000", + "color matrix[4, 1]": "1.00000000", + "color matrix[4, 2]": "1.00000000", + "color matrix[4, 3]": "1.00000000", + "color matrix[4, 4]": "1.00000000", + "color matrix[4, 5]": "1.00000000", + "color matrix[4, 6]": "1.00000000", + "color matrix[5, 0]": "1.00000000", + "color matrix[5, 1]": "1.00000000", + "color matrix[5, 2]": "1.00000000", + "color matrix[5, 3]": "1.00000000", + "color matrix[5, 4]": "1.00000000", + "color matrix[5, 5]": "1.00000000", + "color matrix[5, 6]": "1.00000000", + "color matrix[6, 0]": "1.00000000", + "color matrix[6, 1]": "1.00000000", + "color matrix[6, 2]": "1.00000000", + "color matrix[6, 3]": "1.00000000", + "color matrix[6, 4]": "1.00000000", + "color matrix[6, 5]": "1.00000000", + "color matrix[6, 6]": "1.00000000" + } } }, "1": { "color": "0", "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, "shape": "circular", - "core width": "100.000000", - "core height": "200.000000", - "core radius": "100.000000", - "fadeout radius": "100.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "core width": "100.00000000", + "core height": "200.00000000", + "core radius": "100.00000000", + "fadeout radius": "100.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "radiation": { - "factor": "0.000200" + "factor": "0.00020000" }, "cell": { - "max force": "0.800000", - "min energy": "50.000000", - "binding force": "1.000000", - "fusion velocity": "0.400000", - "max binding energy": "500000.000000", - "mutation rate": "0.000000", + "max force": "0.80000001", + "min energy": "50.00000000", + "binding force": "1.00000000", + "fusion velocity": "0.40000001", + "max binding energy": "500000.00000000", + "mutation rate": "0.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "weapon": { - "energy cost": "0.200000", - "target color mismatch penalty": "0.000000", - "color penalty": "0.000000", - "geometry deviation exponent": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "energy cost": "0.20000000", + "target color mismatch penalty": "0.00000000", + "geometry deviation exponent": "0.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" } } }, "token": { - "mutation rate": "0.000000" + "mutation rate": "0.00000000" + }, + "function": { + "weapon": { + "color matrix[0, 0]": "1.00000000", + "color matrix[0, 1]": "1.00000000", + "color matrix[0, 2]": "1.00000000", + "color matrix[0, 3]": "1.00000000", + "color matrix[0, 4]": "1.00000000", + "color matrix[0, 5]": "1.00000000", + "color matrix[0, 6]": "1.00000000", + "color matrix[1, 0]": "1.00000000", + "color matrix[1, 1]": "1.00000000", + "color matrix[1, 2]": "1.00000000", + "color matrix[1, 3]": "1.00000000", + "color matrix[1, 4]": "1.00000000", + "color matrix[1, 5]": "1.00000000", + "color matrix[1, 6]": "1.00000000", + "color matrix[2, 0]": "1.00000000", + "color matrix[2, 1]": "1.00000000", + "color matrix[2, 2]": "1.00000000", + "color matrix[2, 3]": "1.00000000", + "color matrix[2, 4]": "1.00000000", + "color matrix[2, 5]": "1.00000000", + "color matrix[2, 6]": "1.00000000", + "color matrix[3, 0]": "1.00000000", + "color matrix[3, 1]": "1.00000000", + "color matrix[3, 2]": "1.00000000", + "color matrix[3, 3]": "1.00000000", + "color matrix[3, 4]": "1.00000000", + "color matrix[3, 5]": "1.00000000", + "color matrix[3, 6]": "1.00000000", + "color matrix[4, 0]": "1.00000000", + "color matrix[4, 1]": "1.00000000", + "color matrix[4, 2]": "1.00000000", + "color matrix[4, 3]": "1.00000000", + "color matrix[4, 4]": "1.00000000", + "color matrix[4, 5]": "1.00000000", + "color matrix[4, 6]": "1.00000000", + "color matrix[5, 0]": "1.00000000", + "color matrix[5, 1]": "1.00000000", + "color matrix[5, 2]": "1.00000000", + "color matrix[5, 3]": "1.00000000", + "color matrix[5, 4]": "1.00000000", + "color matrix[5, 5]": "1.00000000", + "color matrix[5, 6]": "1.00000000", + "color matrix[6, 0]": "1.00000000", + "color matrix[6, 1]": "1.00000000", + "color matrix[6, 2]": "1.00000000", + "color matrix[6, 3]": "1.00000000", + "color matrix[6, 4]": "1.00000000", + "color matrix[6, 5]": "1.00000000", + "color matrix[6, 6]": "1.00000000" + } } } } @@ -160,19 +361,19 @@ "num centers": "1", "center0": { "pos": { - "x": "700.000000", - "y": "500.000000" + "x": "700.00000000", + "y": "500.00000000" }, - "radius": "200.000000", - "strength": "0.010000" + "radius": "200.00000000", + "strength": "0.01000000" }, "center1": { "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, - "radius": "200.000000", - "strength": "0.010000" + "radius": "200.00000000", + "strength": "0.01000000" } } } diff --git a/resources/autosave.settings.json b/resources/autosave.settings.json index 0814b16cb..b658400b6 100644 --- a/resources/autosave.settings.json +++ b/resources/autosave.settings.json @@ -1,156 +1,357 @@ { "general": { - "time step": "15574", + "time step": "0", "world size": { "x": "2500", "y": "1500" } }, "simulation parameters": { - "time step size": "1.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "time step size": "1.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "cell": { - "binding force": "1.000000", - "max velocity": "2.000000", - "max binding distance": "2.600000", - "repulsion strength": "0.080000", - "mutation rate": "0.000000", - "min distance": "0.200000", - "max distance": "1.300000", - "max force": "0.367000", - "max force decay probability": "0.200000", + "binding force": "1.00000000", + "max velocity": "2.00000000", + "max binding distance": "2.59999990", + "repulsion strength": "0.08000000", + "mutation rate": "0.00000040", + "min distance": "0.20000000", + "max distance": "1.29999995", + "max force": "0.36700001", + "max force decay probability": "0.20000000", "max bonds": "6", "max token": "3", "max token branch number": "6", - "min energy": "50.000000", - "transformation probability": "0.200000", - "fusion velocity": "0.206000", - "max binding energy": "500000.000000", + "min energy": "50.00000000", + "transformation probability": "0.20000000", + "fusion velocity": "0.20600000", + "max binding energy": "500000.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "computer": { "max instructions": "15", "memory size": "8" }, "weapon": { - "strength": "0.100000", - "energy cost": "0.159000", - "geometry deviation exponent": "0.000000", - "target color mismatch penalty": "0.375000", - "color penalty": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "strength": "0.10000000", + "energy cost": "0.15899999", + "geometry deviation exponent": "0.00000000", + "target color mismatch penalty": "0.37500000", + "food chain color matrix[0, 0]": "1.00000000", + "food chain color matrix[0, 1]": "1.00000000", + "food chain color matrix[0, 2]": "1.00000000", + "food chain color matrix[0, 3]": "1.00000000", + "food chain color matrix[0, 4]": "1.00000000", + "food chain color matrix[0, 5]": "1.00000000", + "food chain color matrix[0, 6]": "1.00000000", + "food chain color matrix[1, 0]": "1.00000000", + "food chain color matrix[1, 1]": "1.00000000", + "food chain color matrix[1, 2]": "1.00000000", + "food chain color matrix[1, 3]": "1.00000000", + "food chain color matrix[1, 4]": "1.00000000", + "food chain color matrix[1, 5]": "1.00000000", + "food chain color matrix[1, 6]": "1.00000000", + "food chain color matrix[2, 0]": "1.00000000", + "food chain color matrix[2, 1]": "1.00000000", + "food chain color matrix[2, 2]": "1.00000000", + "food chain color matrix[2, 3]": "1.00000000", + "food chain color matrix[2, 4]": "1.00000000", + "food chain color matrix[2, 5]": "1.00000000", + "food chain color matrix[2, 6]": "1.00000000", + "food chain color matrix[3, 0]": "1.00000000", + "food chain color matrix[3, 1]": "1.00000000", + "food chain color matrix[3, 2]": "1.00000000", + "food chain color matrix[3, 3]": "1.00000000", + "food chain color matrix[3, 4]": "1.00000000", + "food chain color matrix[3, 5]": "1.00000000", + "food chain color matrix[3, 6]": "1.00000000", + "food chain color matrix[4, 0]": "1.00000000", + "food chain color matrix[4, 1]": "1.00000000", + "food chain color matrix[4, 2]": "1.00000000", + "food chain color matrix[4, 3]": "1.00000000", + "food chain color matrix[4, 4]": "1.00000000", + "food chain color matrix[4, 5]": "1.00000000", + "food chain color matrix[4, 6]": "1.00000000", + "food chain color matrix[5, 0]": "1.00000000", + "food chain color matrix[5, 1]": "1.00000000", + "food chain color matrix[5, 2]": "1.00000000", + "food chain color matrix[5, 3]": "1.00000000", + "food chain color matrix[5, 4]": "1.00000000", + "food chain color matrix[5, 5]": "1.00000000", + "food chain color matrix[5, 6]": "1.00000000", + "food chain color matrix[6, 0]": "1.00000000", + "food chain color matrix[6, 1]": "1.00000000", + "food chain color matrix[6, 2]": "1.00000000", + "food chain color matrix[6, 3]": "1.00000000", + "food chain color matrix[6, 4]": "1.00000000", + "food chain color matrix[6, 5]": "1.00000000", + "food chain color matrix[6, 6]": "1.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" }, "constructor": { "offspring": { - "cell energy": "100.000000", - "cell distance": "1.600000", - "token energy": "60.000000", - "token suppress memory copy": "0.002000" + "cell energy": "100.00000000", + "cell distance": "1.60000002", + "token energy": "60.00000000", + "token suppress memory copy": "0.00200000", + "inherit color": "false" } }, "sensor": { - "range": "220.000000" + "range": "220.00000000" }, "communicator": { - "range": "250.000000" + "range": "250.00000000" } } }, "token": { - "mutation rate": "0.000000", + "mutation rate": "0.00004200", "memory size": "256", - "min energy": "3.000000" + "min energy": "3.00000000" }, "radiation": { - "exponent": "1.000000", - "factor": "0.000050", - "probability": "0.030000", - "velocity multiplier": "1.000000", - "velocity perturbation": "0.500000" + "exponent": "1.00000000", + "factor": "0.00005000", + "probability": "0.03000000", + "velocity multiplier": "1.00000000", + "velocity perturbation": "0.50000000" }, "spots": { "num spots": "0", "0": { "color": "0", "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, "shape": "circular", - "core width": "100.000000", - "core height": "200.000000", - "core radius": "100.000000", - "fadeout radius": "100.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "core width": "100.00000000", + "core height": "200.00000000", + "core radius": "100.00000000", + "fadeout radius": "100.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "radiation": { - "factor": "0.000200" + "factor": "0.00020000" }, "cell": { - "max force": "0.800000", - "min energy": "50.000000", - "binding force": "1.000000", - "fusion velocity": "0.400000", - "max binding energy": "500000.000000", - "mutation rate": "0.000000", + "max force": "0.80000001", + "min energy": "50.00000000", + "binding force": "1.00000000", + "fusion velocity": "0.40000001", + "max binding energy": "500000.00000000", + "mutation rate": "0.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "weapon": { - "energy cost": "0.200000", - "target color mismatch penalty": "0.000000", - "color penalty": "0.000000", - "geometry deviation exponent": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "energy cost": "0.20000000", + "target color mismatch penalty": "0.00000000", + "geometry deviation exponent": "0.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" } } }, "token": { - "mutation rate": "0.000000" + "mutation rate": "0.00000000" + }, + "function": { + "weapon": { + "color matrix[0, 0]": "1.00000000", + "color matrix[0, 1]": "1.00000000", + "color matrix[0, 2]": "1.00000000", + "color matrix[0, 3]": "1.00000000", + "color matrix[0, 4]": "1.00000000", + "color matrix[0, 5]": "1.00000000", + "color matrix[0, 6]": "1.00000000", + "color matrix[1, 0]": "1.00000000", + "color matrix[1, 1]": "1.00000000", + "color matrix[1, 2]": "1.00000000", + "color matrix[1, 3]": "1.00000000", + "color matrix[1, 4]": "1.00000000", + "color matrix[1, 5]": "1.00000000", + "color matrix[1, 6]": "1.00000000", + "color matrix[2, 0]": "1.00000000", + "color matrix[2, 1]": "1.00000000", + "color matrix[2, 2]": "1.00000000", + "color matrix[2, 3]": "1.00000000", + "color matrix[2, 4]": "1.00000000", + "color matrix[2, 5]": "1.00000000", + "color matrix[2, 6]": "1.00000000", + "color matrix[3, 0]": "1.00000000", + "color matrix[3, 1]": "1.00000000", + "color matrix[3, 2]": "1.00000000", + "color matrix[3, 3]": "1.00000000", + "color matrix[3, 4]": "1.00000000", + "color matrix[3, 5]": "1.00000000", + "color matrix[3, 6]": "1.00000000", + "color matrix[4, 0]": "1.00000000", + "color matrix[4, 1]": "1.00000000", + "color matrix[4, 2]": "1.00000000", + "color matrix[4, 3]": "1.00000000", + "color matrix[4, 4]": "1.00000000", + "color matrix[4, 5]": "1.00000000", + "color matrix[4, 6]": "1.00000000", + "color matrix[5, 0]": "1.00000000", + "color matrix[5, 1]": "1.00000000", + "color matrix[5, 2]": "1.00000000", + "color matrix[5, 3]": "1.00000000", + "color matrix[5, 4]": "1.00000000", + "color matrix[5, 5]": "1.00000000", + "color matrix[5, 6]": "1.00000000", + "color matrix[6, 0]": "1.00000000", + "color matrix[6, 1]": "1.00000000", + "color matrix[6, 2]": "1.00000000", + "color matrix[6, 3]": "1.00000000", + "color matrix[6, 4]": "1.00000000", + "color matrix[6, 5]": "1.00000000", + "color matrix[6, 6]": "1.00000000" + } } }, "1": { "color": "0", "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, "shape": "circular", - "core width": "100.000000", - "core height": "200.000000", - "core radius": "100.000000", - "fadeout radius": "100.000000", - "friction": "0.001000", - "rigidity": "0.000000", + "core width": "100.00000000", + "core height": "200.00000000", + "core radius": "100.00000000", + "fadeout radius": "100.00000000", + "friction": "0.00100000", + "rigidity": "0.00000000", "radiation": { - "factor": "0.000200" + "factor": "0.00020000" }, "cell": { - "max force": "0.800000", - "min energy": "50.000000", - "binding force": "1.000000", - "fusion velocity": "0.400000", - "max binding energy": "500000.000000", - "mutation rate": "0.000000", + "max force": "0.80000001", + "min energy": "50.00000000", + "binding force": "1.00000000", + "fusion velocity": "0.40000001", + "max binding energy": "500000.00000000", + "mutation rate": "0.00000000", + "color transition rules": { + "duration[0]": "0", + "target color[0]": "0", + "duration[1]": "0", + "target color[1]": "1", + "duration[2]": "0", + "target color[2]": "2", + "duration[3]": "0", + "target color[3]": "3", + "duration[4]": "0", + "target color[4]": "4", + "duration[5]": "0", + "target color[5]": "5", + "duration[6]": "0", + "target color[6]": "6" + }, "function": { "min invocations": "40000", - "invocations decay probability": "0.000000", + "invocations decay probability": "0.00000000", "weapon": { - "energy cost": "0.200000", - "target color mismatch penalty": "0.000000", - "color penalty": "0.000000", - "geometry deviation exponent": "0.000000", - "connections mismatch penalty": "0.330000", - "token penalty": "0.000000" + "energy cost": "0.20000000", + "target color mismatch penalty": "0.00000000", + "geometry deviation exponent": "0.00000000", + "connections mismatch penalty": "0.33000001", + "token penalty": "0.00000000" } } }, "token": { - "mutation rate": "0.000000" + "mutation rate": "0.00000000" + }, + "function": { + "weapon": { + "color matrix[0, 0]": "1.00000000", + "color matrix[0, 1]": "1.00000000", + "color matrix[0, 2]": "1.00000000", + "color matrix[0, 3]": "1.00000000", + "color matrix[0, 4]": "1.00000000", + "color matrix[0, 5]": "1.00000000", + "color matrix[0, 6]": "1.00000000", + "color matrix[1, 0]": "1.00000000", + "color matrix[1, 1]": "1.00000000", + "color matrix[1, 2]": "1.00000000", + "color matrix[1, 3]": "1.00000000", + "color matrix[1, 4]": "1.00000000", + "color matrix[1, 5]": "1.00000000", + "color matrix[1, 6]": "1.00000000", + "color matrix[2, 0]": "1.00000000", + "color matrix[2, 1]": "1.00000000", + "color matrix[2, 2]": "1.00000000", + "color matrix[2, 3]": "1.00000000", + "color matrix[2, 4]": "1.00000000", + "color matrix[2, 5]": "1.00000000", + "color matrix[2, 6]": "1.00000000", + "color matrix[3, 0]": "1.00000000", + "color matrix[3, 1]": "1.00000000", + "color matrix[3, 2]": "1.00000000", + "color matrix[3, 3]": "1.00000000", + "color matrix[3, 4]": "1.00000000", + "color matrix[3, 5]": "1.00000000", + "color matrix[3, 6]": "1.00000000", + "color matrix[4, 0]": "1.00000000", + "color matrix[4, 1]": "1.00000000", + "color matrix[4, 2]": "1.00000000", + "color matrix[4, 3]": "1.00000000", + "color matrix[4, 4]": "1.00000000", + "color matrix[4, 5]": "1.00000000", + "color matrix[4, 6]": "1.00000000", + "color matrix[5, 0]": "1.00000000", + "color matrix[5, 1]": "1.00000000", + "color matrix[5, 2]": "1.00000000", + "color matrix[5, 3]": "1.00000000", + "color matrix[5, 4]": "1.00000000", + "color matrix[5, 5]": "1.00000000", + "color matrix[5, 6]": "1.00000000", + "color matrix[6, 0]": "1.00000000", + "color matrix[6, 1]": "1.00000000", + "color matrix[6, 2]": "1.00000000", + "color matrix[6, 3]": "1.00000000", + "color matrix[6, 4]": "1.00000000", + "color matrix[6, 5]": "1.00000000", + "color matrix[6, 6]": "1.00000000" + } } } } @@ -160,19 +361,19 @@ "num centers": "1", "center0": { "pos": { - "x": "700.000000", - "y": "500.000000" + "x": "700.00000000", + "y": "500.00000000" }, - "radius": "200.000000", - "strength": "0.010000" + "radius": "200.00000000", + "strength": "0.01000000" }, "center1": { "pos": { - "x": "0.000000", - "y": "0.000000" + "x": "0.00000000", + "y": "0.00000000" }, - "radius": "200.000000", - "strength": "0.010000" + "radius": "200.00000000", + "strength": "0.01000000" } } } diff --git a/source/Base/Resources.h b/source/Base/Resources.h index e5817a1f0..931df42fb 100644 --- a/source/Base/Resources.h +++ b/source/Base/Resources.h @@ -2,7 +2,7 @@ namespace Const { - std::string const ProgramVersion = "3.3.0"; + std::string const ProgramVersion = "3.3.1"; std::string const BasePath = "resources/"; diff --git a/source/EngineGpuKernels/Operations.cuh b/source/EngineGpuKernels/Operations.cuh index 01d3ba63a..b44832761 100644 --- a/source/EngineGpuKernels/Operations.cuh +++ b/source/EngineGpuKernels/Operations.cuh @@ -59,3 +59,8 @@ struct SensorOperation { Token* token; }; + +struct NeuralNetOperation +{ + Token* token; +}; diff --git a/source/EngineGpuKernels/SimulationData.cuh b/source/EngineGpuKernels/SimulationData.cuh index ac65e6550..5b8a7254c 100644 --- a/source/EngineGpuKernels/SimulationData.cuh +++ b/source/EngineGpuKernels/SimulationData.cuh @@ -13,19 +13,25 @@ struct SimulationData { + //maps int2 worldSize; - CellMap cellMap; ParticleMap particleMap; - CellFunctionData cellFunctionData; + //objects Entities entities; Entities entitiesForCleanup; + //additional data for cell functions RawMemory processMemory; + CellFunctionData cellFunctionData; + + //scheduled operations TempArray structuralOperations; TempArray sensorOperations; + TempArray neuralNetOperations; + //number generators CudaNumberGenerator numberGen1; CudaNumberGenerator numberGen2; //second random number generator used in combination with the first generator for evaluating very low probabilities diff --git a/source/EngineInterface/CellComputationCompiler.cpp b/source/EngineInterface/CellComputationCompiler.cpp index f23677c33..9f5ee9fc3 100644 --- a/source/EngineInterface/CellComputationCompiler.cpp +++ b/source/EngineInterface/CellComputationCompiler.cpp @@ -18,7 +18,9 @@ namespace LOOKING_FOR_SEPARATOR, LOOKING_FOR_COMPARATOR, LOOKING_FOR_OP2_START, - LOOKING_FOR_OP2_END + LOOKING_FOR_OP2_END, + LOOKING_FOR_COMMENT, + LOOKING_FOR_COMMENT_END, }; struct InstructionUncoded @@ -62,12 +64,15 @@ namespace if (std::isalpha(currentSymbol)) { state = CompilerState::LOOKING_FOR_INSTR_END; instruction.name = currentSymbol; + } else if (currentSymbol == '#') { + instruction.name = currentSymbol; + state = CompilerState::LOOKING_FOR_COMMENT_END; } } break; case CompilerState::LOOKING_FOR_INSTR_END: { if (!std::isalpha(currentSymbol)) { if (instruction.name == "else" || instruction.name == "endif") - instruction.readingFinished = true; + state = CompilerState::LOOKING_FOR_COMMENT; else state = CompilerState::LOOKING_FOR_OP1_START; } else { @@ -133,13 +138,27 @@ namespace case CompilerState::LOOKING_FOR_OP2_END: { if (!isNameChar(currentSymbol) && (currentSymbol != '-') && (currentSymbol != '_') && (currentSymbol != '[') && (currentSymbol != ']') && (currentSymbol != '(') && (currentSymbol != ')')) - instruction.readingFinished = true; + state = CompilerState::LOOKING_FOR_COMMENT; else { instruction.operand2 += currentSymbol; if ((bytePos + 1) == codeSize) instruction.readingFinished = true; } } break; + case CompilerState::LOOKING_FOR_COMMENT: { + if (currentSymbol == '\n' || (bytePos + 1) == codeSize) + instruction.readingFinished = true; + else if (currentSymbol == '#') + state = CompilerState::LOOKING_FOR_COMMENT_END; + else if (currentSymbol != ' ' && currentSymbol != '\t') { + instruction.readingFinished = true; + return false; + } + } break; + case CompilerState::LOOKING_FOR_COMMENT_END: { + if (currentSymbol == '\n' || (bytePos + 1) == codeSize) + instruction.readingFinished = true; + } break; } if ((currentSymbol == '\n') || ((bytePos + 1) == codeSize)) { if (!instruction.name.empty()) { @@ -221,7 +240,9 @@ namespace instructionCoded.operation = Enums::ComputationOperation_Else; else if (instructionUncoded.name == "endif") instructionCoded.operation = Enums::ComputationOperation_Endif; - else { + else if (instructionUncoded.name == "#") { + return true; + } else { return false; } @@ -324,7 +345,8 @@ CompilationResult CellComputationCompiler::compileSourceCode(std::string const& result.lineOfFirstError = linePos; return result; } - writeInstruction(result.compilation, instructionCoded); + if(instructionUncoded.name != "#") + writeInstruction(result.compilation, instructionCoded); state = CompilerState::LOOKING_FOR_INSTR_START; instructionUncoded = InstructionUncoded(); } @@ -347,6 +369,13 @@ namespace stream << "0x" << std::hex << static_cast(value); return stream.str(); } + template + std::string toDecString(T value) + { + std::stringstream stream; + stream << std::dec << static_cast(value); + return stream.str(); + } } std::string CellComputationCompiler::decompileSourceCode( @@ -354,8 +383,13 @@ std::string CellComputationCompiler::decompileSourceCode( SymbolMap const& symbols, SimulationParameters const& parameters) { + SymbolMap revsymbols; + for (auto const& symbol : symbols) { + revsymbols[symbol.second] = symbol.first; + } std::string text; - std::string textOp1, textOp2; + std::string textOp1, textOp2, comment1, comment2; + size_t lineStart, opEnd; int nestingLevel = 0; auto dataSize = (data.size() / 3) * 3; auto isNullInstruction = [&data](int address) { @@ -369,7 +403,19 @@ std::string CellComputationCompiler::decompileSourceCode( } } + auto commentAlign = [&]() { + auto lineSize = text.size() - lineStart; + std::string spaces = " "; + spaces = spaces.substr(0, 8 - lineSize % 4); + return spaces; + }; + + auto getOp = [&]() { + return text.substr(lineStart, opEnd - lineStart + 1); + }; + for (int instructionPointer = 0; instructionPointer < dataSize;) { + lineStart = text.size(); //decode instruction data CellInstruction instruction; @@ -414,42 +460,95 @@ std::string CellComputationCompiler::decompileSourceCode( text += "endif"; } + opEnd = text.size(); + //write operands - if (instruction.opType1 == Enums::ComputationOpType_Mem) + if (instruction.opType1 == Enums::ComputationOpType_Mem) { + comment1 = "[" + toDecString(convertToAddress(instruction.operand1, parameters.tokenMemorySize)) + "]"; + if (revsymbols.find(comment1) != revsymbols.end()) + comment1 = revsymbols[comment1]; textOp1 = "[" + toHexString(convertToAddress(instruction.operand1, parameters.tokenMemorySize)) + "]"; - if (instruction.opType1 == Enums::ComputationOpType_MemMem) + } + if (instruction.opType1 == Enums::ComputationOpType_MemMem) { + comment1 = "[[" + toDecString(convertToAddress(instruction.operand1, parameters.tokenMemorySize)) + "]]"; + if (revsymbols.find(comment1) != revsymbols.end()) + comment1 = revsymbols[comment1]; textOp1 = "[[" + toHexString(convertToAddress(instruction.operand1, parameters.tokenMemorySize)) + "]]"; - if (instruction.opType1 == Enums::ComputationOpType_Cmem) + } + if (instruction.opType1 == Enums::ComputationOpType_Cmem) { + comment1 = "(" + + toDecString(convertToAddress(instruction.operand1, parameters.cellFunctionComputerCellMemorySize)) + + ")"; + if (revsymbols.find(comment1) != revsymbols.end()) + comment1 = revsymbols[comment1]; textOp1 = "(" - + toHexString(convertToAddress(instruction.operand1, parameters.cellFunctionComputerCellMemorySize)) - + ")"; - if (instruction.opType2 == Enums::ComputationOpType_Mem) + + toHexString(convertToAddress(instruction.operand1, parameters.cellFunctionComputerCellMemorySize)) + + ")"; + } + if (instruction.opType2 == Enums::ComputationOpType_Mem) { + comment2 = "[" + toDecString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)) + "]"; + if (revsymbols.find(comment2) != revsymbols.end()) + comment2 = revsymbols[comment2]; textOp2 = "[" + toHexString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)) + "]"; - if (instruction.opType2 == Enums::ComputationOpType_MemMem) + } + if (instruction.opType2 == Enums::ComputationOpType_MemMem) { + comment2 = "[[" + toDecString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)) + "]]"; + if (revsymbols.find(comment2) != revsymbols.end()) + comment2 = revsymbols[comment2]; textOp2 = "[[" + toHexString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)) + "]]"; - if (instruction.opType2 == Enums::ComputationOpType_Cmem) + } + if (instruction.opType2 == Enums::ComputationOpType_Cmem) { + comment2 = "(" + + toDecString(convertToAddress(instruction.operand2, parameters.cellFunctionComputerCellMemorySize)) + + ")"; + if (revsymbols.find(comment2) != revsymbols.end()) + comment2 = revsymbols[comment2]; textOp2 = "(" - + toHexString(convertToAddress(instruction.operand2, parameters.cellFunctionComputerCellMemorySize)) - + ")"; - if (instruction.opType2 == Enums::ComputationOpType_Constant) + + toHexString(convertToAddress(instruction.operand2, parameters.cellFunctionComputerCellMemorySize)) + + ")"; + } + if (instruction.opType2 == Enums::ComputationOpType_Constant) { + // try to be smart about constants + auto number = toDecString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)); + comment2 = number; + for (auto &it : symbols) { + auto pos = it.first.find(':'); + if (it.first.substr(0,pos) == comment1.substr(0,pos) && it.second == number) { + comment2 = it.first; + break; + } + } textOp2 = toHexString(convertToAddress(instruction.operand2, parameters.tokenMemorySize)); - + } //write separation/comparator if (instruction.operation <= Enums::ComputationOperation_And) { text += " " + textOp1 + ", " + textOp2; + text += commentAlign() + "# " + getOp() + comment1 + ", " + comment2; } - if (instruction.operation == Enums::ComputationOperation_Ifg) + if (instruction.operation == Enums::ComputationOperation_Ifg) { text += " " + textOp1 + " > " + textOp2; - if (instruction.operation == Enums::ComputationOperation_Ifge) + text += commentAlign() + "# " + getOp() + comment1 + " > " + comment2; + } + if (instruction.operation == Enums::ComputationOperation_Ifge) { text += " " + textOp1 + " >= " + textOp2; - if (instruction.operation == Enums::ComputationOperation_Ife) + text += commentAlign() + "# " + getOp() + comment1 + " >= " + comment2; + } + if (instruction.operation == Enums::ComputationOperation_Ife) { text += " " + textOp1 + " = " + textOp2; - if (instruction.operation == Enums::ComputationOperation_Ifne) + text += commentAlign() + "# " + getOp() + comment1 + " = " + comment2; + } + if (instruction.operation == Enums::ComputationOperation_Ifne) { text += " " + textOp1 + " != " + textOp2; - if (instruction.operation == Enums::ComputationOperation_Ifle) + text += commentAlign() + "# " + getOp() + comment1 + " != " + comment2; + } + if (instruction.operation == Enums::ComputationOperation_Ifle) { text += " " + textOp1 + " <= " + textOp2; - if (instruction.operation == Enums::ComputationOperation_Ifl) + text += commentAlign() + "# " + getOp() + comment1 + " <= " + comment2; + } + if (instruction.operation == Enums::ComputationOperation_Ifl) { text += " " + textOp1 + " < " + textOp2; + text += commentAlign() + "# " + getOp() + comment1 + " < " + comment2; + } if (instructionPointer < dataSize) text += "\n"; } diff --git a/source/EngineInterface/Serializer.cpp b/source/EngineInterface/Serializer.cpp index 0a765b52f..c7ca5dea5 100644 --- a/source/EngineInterface/Serializer.cpp +++ b/source/EngineInterface/Serializer.cpp @@ -551,14 +551,21 @@ namespace { std::vector versionParts; boost::split(versionParts, s, boost::is_any_of(".")); + if (versionParts.size() < 3) { + return false; + } try { for (auto const& versionPart : versionParts) { - std::stoi(versionPart); + static_cast(std::stoi(versionPart)); + } + //simple check: will be improved in future + if (std::stoi(versionParts.front()) > 3) { + return false; } } catch (...) { return false; } - return versionParts.size() == 3; + return true; } struct VersionParts { @@ -583,6 +590,7 @@ void Serializer::deserializeDataDescription(ClusteredDataDescription& data, std: throw std::runtime_error("No version detected."); } auto versionParts = getVersionParts(version); + if (versionParts.major <= 3 && versionParts.minor <= 2) { DEPRECATED_ClusteredDataDescription_3_2 oldData; archive(oldData); diff --git a/source/EngineTests/CellComputationTests.cpp b/source/EngineTests/CellComputationTests.cpp index f42ac43a9..59d12316b 100644 --- a/source/EngineTests/CellComputationTests.cpp +++ b/source/EngineTests/CellComputationTests.cpp @@ -40,6 +40,10 @@ std::string CellComputationTests::runSimpleCellComputer(std::string const& progr CompilationResult compiledProgram = CellComputationCompiler::compileSourceCode(program, symbols, parameters); + if(!compiledProgram.compilationOk) { + return ""; + } + DataDescription origData = DescriptionHelper::createRect(DescriptionHelper::CreateRectParameters().width(2).height(1)); auto& origFirstCell = origData.cells.at(0); @@ -426,3 +430,64 @@ TEST_F(CellComputationTests, divisionByZero) auto data = runSimpleCellComputer(program); EXPECT_EQ(0, data.at(1)); } + +TEST_F(CellComputationTests, singleLineComment) +{ + std::string program = " # this is ignored\n"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(0, data.at(1)); +} + +TEST_F(CellComputationTests, lineComment) +{ + std::string program = "mov [1], 55\n" + "# this is ignored\n" + "sub [1], 13\n"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(42, data.at(1)); +} + +TEST_F(CellComputationTests, opComments) +{ + std::string program = "mov [1], 55 # this is ignored\n" + "add [1], -13\n"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(42, data.at(1)); +} + +TEST_F(CellComputationTests, ifelseendifComments) +{ + std::string program = "mov [1], 55\n" + "if [1] < 3 # if comment\n" + "div [1], 1\n" + "else # else comment\n" + "div [1], 1\n" + "endif # endif comment\n"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(55, data.at(1)); +} + +TEST_F(CellComputationTests, allComments) +{ + std::string program = "# first line comment\n" + "mov [1], 2 # mov comment\n" + "# empty line comment\n" + "if [1] < 3 # if comment\n" + "mov [2], 1 # mov comment\n" + "else # else comment\n" + " # space line comment\n" + "mov [2],2 # mov comment\n" + "endif # endif comment\n" + " # last line comment"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(1, data.at(2)); +} + +TEST_F(CellComputationTests, compileError) +{ + std::string program = "mov [1], 55 this triggers an error\n" + "add [1], -13\n"; + auto data = runSimpleCellComputer(program); + EXPECT_EQ(0, data.size()); +} + diff --git a/source/Gui/BrowserWindow.cpp b/source/Gui/BrowserWindow.cpp index 3e75bd73b..ec07ab826 100644 --- a/source/Gui/BrowserWindow.cpp +++ b/source/Gui/BrowserWindow.cpp @@ -349,7 +349,10 @@ void _BrowserWindow::onOpenSimulation(std::string const& id) } DeserializedSimulation deserializedSim; - Serializer::deserializeSimulationFromStrings(deserializedSim, content, settings, symbolMap); + if (!Serializer::deserializeSimulationFromStrings(deserializedSim, content, settings, symbolMap)) { + MessageDialog::getInstance().show("Error", "Failed to load simulation. Your program version may not match."); + return; + } _simController->closeSimulation(); _statisticsWindow->reset(); diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index fad2dee4a..4f2c1d0a1 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -357,7 +357,7 @@ void _SimulationParametersWindow::processBase( .min(0) .max(0.001f) .logarithmic(true) - .format("%.7f") + .format("%.8f") .defaultValue(origSimParameters.spotValues.cellMutationRate) .tooltip(std::string("Probability that a byte or property of a cell is changed per time step.")), simParameters.spotValues.cellMutationRate); @@ -368,7 +368,7 @@ void _SimulationParametersWindow::processBase( .min(0) .max(0.1f) .logarithmic(true) - .format("%.5f") + .format("%.6f") .defaultValue(origSimParameters.spotValues.tokenMutationRate) .tooltip(std::string("Probability that a memory byte of a token is changed per time step.")), simParameters.spotValues.tokenMutationRate); @@ -701,7 +701,7 @@ void _SimulationParametersWindow::processSpot(SimulationParametersSpot& spot, Si .min(0) .max(0.001f) .logarithmic(true) - .format("%.7f") + .format("%.8f") .defaultValue(origSpot.values.cellMutationRate), spot.values.cellMutationRate); AlienImGui::SliderFloat( @@ -711,7 +711,7 @@ void _SimulationParametersWindow::processSpot(SimulationParametersSpot& spot, Si .min(0) .max(0.1f) .logarithmic(true) - .format("%.5f") + .format("%.6f") .defaultValue(origSpot.values.tokenMutationRate), spot.values.tokenMutationRate);