diff --git a/www/data/images/program_img/image_06.png b/www/data/images/program_img/CannonConquest_13.png similarity index 100% rename from www/data/images/program_img/image_06.png rename to www/data/images/program_img/CannonConquest_13.png diff --git a/www/data/images/program_img/CanvasCellSim.png b/www/data/images/program_img/CanvasCellSim.png new file mode 100644 index 0000000..a520910 Binary files /dev/null and b/www/data/images/program_img/CanvasCellSim.png differ diff --git a/www/internals/modules/programs.php b/www/internals/modules/programs.php index cbffcfb..f1c6074 100644 --- a/www/internals/modules/programs.php +++ b/www/internals/modules/programs.php @@ -223,7 +223,7 @@ class Programs implements IWebsiteModule if (strpos($prog['internal_name'], ' ') !== FALSE) return ['result'=>'err', 'message' => 'Internal name contains spaces ' . $prog['name']]; - foreach (explode('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']]; + foreach (explode_allow_empty('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']]; if (!in_array($prog['prog_language'], self::PROG_LANGS)) return ['result'=>'err', 'message' => 'Unknown prog-lang ' . $prog['name']]; diff --git a/www/internals/utils.php b/www/internals/utils.php index cb966c6..e6bfd0b 100644 --- a/www/internals/utils.php +++ b/www/internals/utils.php @@ -288,3 +288,7 @@ function array_last(array $arr) return $arr[count($arr)-1]; } +function explode_allow_empty(string $separator, string $str): array { + if ($str === '') return []; + return explode($separator, $str); +} diff --git a/www/pages/programs_list.php b/www/pages/programs_list.php index e337c78..a62813a 100644 --- a/www/pages/programs_list.php +++ b/www/pages/programs_list.php @@ -28,7 +28,7 @@ $allprograms = $SITE->modules->Programs()->listAllNewestFirst($filter); foreach ($allprograms as $prog) { $uilang = ''; - foreach (explode('|', $prog['ui_language']) as $lang) $uilang .= ''.$lang.''; + foreach (explode_allow_empty('|', $prog['ui_language']) as $lang) $uilang .= ''.$lang.''; echo ''; echo '
'; diff --git a/www/pages/programs_view.php b/www/pages/programs_view.php index 20f3820..b725b7b 100644 --- a/www/pages/programs_view.php +++ b/www/pages/programs_view.php @@ -61,7 +61,7 @@ $FRAME_OPTIONS->activeHeader = 'programs';
modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n"; } diff --git a/www/statics/programs/CanvasCellSim_description.md b/www/statics/programs/CanvasCellSim_description.md new file mode 100644 index 0000000..a97d21c --- /dev/null +++ b/www/statics/programs/CanvasCellSim_description.md @@ -0,0 +1,28 @@ +CanvasCellSim +============= + +Simulate a cellular automata and render it onto a canvas. + +Contains a bunch of example configurations in `ccs_examples.ts` but can be freely configured with a custom transitioning function. + +**See [the the github page](https://mikescher.github.io/CanvasCellSim/) for examples** + +Included Examples: +- Game of Life +- Game of Life (with decay) +- Forest Fire +- Spiders and Mosquitoes +- Cyclic +- Pobalistic Cyclic +- Caves +- Mazes1 +- Mazes2 +- Seed +- Seed (with decay) +- Generic Lifelike (configure via [RuleString](https://www.conwaylife.com/wiki/Rulestring) or [RuleInteger](https://www.conwaylife.com/wiki/Rule_integer)) + +Support for +- resizing canvas +- wrapping or clamping edges +- Moore or Neumann neigbourhoods (or custom transitioning) +- performant drawing (cache colors and only render changes) \ No newline at end of file diff --git a/www/statics/programs/__all.php b/www/statics/programs/__all.php index fe00de5..601e3f1 100644 --- a/www/statics/programs/__all.php +++ b/www/statics/programs/__all.php @@ -607,7 +607,8 @@ return [ 'CannonConquest_01.webm', 'CannonConquest_02.png', 'CannonConquest_03.png', 'CannonConquest_04.png', 'CannonConquest_05.png', 'CannonConquest_06.png', 'CannonConquest_07.png', 'CannonConquest_08.png', - 'CannonConquest_09.png', 'CannonConquest_10.png', 'CannonConquest_11.png', 'CannonConquest_12.png' + 'CannonConquest_09.png', 'CannonConquest_10.png', 'CannonConquest_11.png', 'CannonConquest_12.png', + 'CannonConquest_13.png' ], ], @@ -712,4 +713,23 @@ return 'youtube-dl-viewer_09.png', ], ], + + + [ + 'name' => 'CanvasCellSim', + 'internal_name' => 'CanvasCellSim', + 'internal_name_alt' => null, + 'category' => 'Simulation', + 'stars' => 3, + 'ui_language' => '', + 'prog_language' => 'Typescript', + 'short_description' => 'Render a cellular automata via javascript onto an HTML5 canvas', + 'add_date' => '2020-12-21', + 'license' => 'MIT', + 'urls' => + [ + 'github' => 'https://github.com/Mikescher/CanvasCellSim', + 'homepage' => 'https://mikescher.github.io/CanvasCellSim/', + ], + ], ]; \ No newline at end of file