Added prog: "CanvasCellSim"
This commit is contained in:
parent
2b706c191e
commit
e48d412783
Before Width: | Height: | Size: 760 KiB After Width: | Height: | Size: 760 KiB |
BIN
www/data/images/program_img/CanvasCellSim.png
Normal file
BIN
www/data/images/program_img/CanvasCellSim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
@ -223,7 +223,7 @@ class Programs implements IWebsiteModule
|
|||||||
|
|
||||||
if (strpos($prog['internal_name'], ' ') !== FALSE) return ['result'=>'err', 'message' => 'Internal name contains spaces ' . $prog['name']];
|
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']];
|
if (!in_array($prog['prog_language'], self::PROG_LANGS)) return ['result'=>'err', 'message' => 'Unknown prog-lang ' . $prog['name']];
|
||||||
|
|
||||||
|
@ -288,3 +288,7 @@ function array_last(array $arr)
|
|||||||
return $arr[count($arr)-1];
|
return $arr[count($arr)-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function explode_allow_empty(string $separator, string $str): array {
|
||||||
|
if ($str === '') return [];
|
||||||
|
return explode($separator, $str);
|
||||||
|
}
|
||||||
|
@ -28,7 +28,7 @@ $allprograms = $SITE->modules->Programs()->listAllNewestFirst($filter);
|
|||||||
foreach ($allprograms as $prog)
|
foreach ($allprograms as $prog)
|
||||||
{
|
{
|
||||||
$uilang = '';
|
$uilang = '';
|
||||||
foreach (explode('|', $prog['ui_language']) as $lang) $uilang .= '<img src="' . $SITE->modules->Programs()->convertLanguageToFlag($lang).'" alt="'.$lang.'" />';
|
foreach (explode_allow_empty('|', $prog['ui_language']) as $lang) $uilang .= '<img src="' . $SITE->modules->Programs()->convertLanguageToFlag($lang).'" alt="'.$lang.'" />';
|
||||||
|
|
||||||
echo '<a class="prgl_elem" href="'.$prog['url'].'">';
|
echo '<a class="prgl_elem" href="'.$prog['url'].'">';
|
||||||
echo ' <div class="prgl_elem_left">';
|
echo ' <div class="prgl_elem_left">';
|
||||||
|
@ -61,7 +61,7 @@ $FRAME_OPTIONS->activeHeader = 'programs';
|
|||||||
|
|
||||||
<div class="prgv_right_comb prgv_right_lang" style="grid-row:8">
|
<div class="prgv_right_comb prgv_right_lang" style="grid-row:8">
|
||||||
<?php
|
<?php
|
||||||
foreach (explode('|', $prog['ui_language']) as $lang)
|
foreach (explode_allow_empty('|', $prog['ui_language']) as $lang)
|
||||||
{
|
{
|
||||||
echo '<img src="'.$SITE->modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
|
echo '<img src="'.$SITE->modules->Programs()->convertLanguageToFlag($lang).'" title="'.$lang.'" alt="'.$lang[0].'" />' . "\n";
|
||||||
}
|
}
|
||||||
|
28
www/statics/programs/CanvasCellSim_description.md
Normal file
28
www/statics/programs/CanvasCellSim_description.md
Normal file
@ -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)
|
@ -607,7 +607,8 @@ return
|
|||||||
[
|
[
|
||||||
'CannonConquest_01.webm', 'CannonConquest_02.png', 'CannonConquest_03.png', 'CannonConquest_04.png',
|
'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_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',
|
'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/',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
Loading…
Reference in New Issue
Block a user