1
0

Added prog: "CanvasCellSim"

This commit is contained in:
Mike Schwörer 2020-12-21 06:03:54 +01:00
parent 2b706c191e
commit e48d412783
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
8 changed files with 56 additions and 4 deletions

View File

Before

Width:  |  Height:  |  Size: 760 KiB

After

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -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']];

View File

@ -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);
}

View File

@ -28,7 +28,7 @@ $allprograms = $SITE->modules->Programs()->listAllNewestFirst($filter);
foreach ($allprograms as $prog)
{
$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 ' <div class="prgl_elem_left">';

View File

@ -61,7 +61,7 @@ $FRAME_OPTIONS->activeHeader = 'programs';
<div class="prgv_right_comb prgv_right_lang" style="grid-row:8">
<?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";
}

View 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)

View File

@ -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/',
],
],
];