- commit
- 19212fcadf640f876f673de4c4d0541a31d4c0cb
- parent
- 25641ad4dba0b1725ca8318a0f933535ab667031
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-11-01 14:43
add script to generate scenarios.js automatically
Diffstat
| A | scripts/gen_scenarios.sh | 11 | +++++++++++ |
| M | src/scenarios.js | 32 | ++++++++++++++++---------------- |
2 files changed, 27 insertions, 16 deletions
diff --git a/scripts/gen_scenarios.sh b/scripts/gen_scenarios.sh
@@ -0,0 +1,11 @@ -1 1 #!/bin/sh -1 2 -1 3 ls scenarios/*.js | cut -d / -f 2 | cut -d . -f 1 | while read l; do -1 4 printf "import s%s from '../scenarios/%s.js';\n" "$l" "$l" -1 5 done -1 6 -1 7 printf '\nexport default [\n' -1 8 ls scenarios/*.js | cut -d / -f 2 | cut -d . -f 1 | while read l; do -1 9 printf ' s%s,\n' "$l" -1 10 done -1 11 printf '];\n'
diff --git a/src/scenarios.js b/src/scenarios.js
@@ -1,19 +1,19 @@1 -1 import gun from '../scenarios/gun.js';2 -1 import survive1 from '../scenarios/01_01survive.js';3 -1 import growth1 from '../scenarios/02_01growth.js';4 -1 import growth2 from '../scenarios/02_02growth.js';5 -1 import reach1 from '../scenarios/03_01reach.js';6 -1 import reach2 from '../scenarios/03_02reach.js';7 -1 import glider1 from '../scenarios/04_01glider.js';8 -1 import glider2 from '../scenarios/04_02glider.js';-1 1 import s01_survive_01 from '../scenarios/01_survive_01.js'; -1 2 import s02_growth_01 from '../scenarios/02_growth_01.js'; -1 3 import s03_reach_01 from '../scenarios/03_reach_01.js'; -1 4 import s04_growth_02 from '../scenarios/04_growth_02.js'; -1 5 import s05_glider_01 from '../scenarios/05_glider_01.js'; -1 6 import s06_0reach_02 from '../scenarios/06_0reach_02.js'; -1 7 import s07_glider_02 from '../scenarios/07_glider_02.js'; -1 8 import s08_gun from '../scenarios/08_gun.js'; 9 9 10 10 export default [11 -1 survive1,12 -1 growth1,13 -1 reach1,14 -1 growth2,15 -1 glider1,16 -1 reach2,17 -1 glider2,18 -1 gun,-1 11 s01_survive_01, -1 12 s02_growth_01, -1 13 s03_reach_01, -1 14 s04_growth_02, -1 15 s05_glider_01, -1 16 s06_0reach_02, -1 17 s07_glider_02, -1 18 s08_gun, 19 19 ];