Initial commit
This commit is contained in:
29
src/Automata/Modes/M/CoolantMode.php
Normal file
29
src/Automata/Modes/M/CoolantMode.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Automata\Modes\M;
|
||||
|
||||
class CoolantMode extends M
|
||||
{
|
||||
|
||||
public function supports(int $M): bool
|
||||
{
|
||||
return in_array($M, [0, 2, 6, 8, 9, 30]);
|
||||
}
|
||||
|
||||
|
||||
public function apply(int $M): void
|
||||
{
|
||||
if (!$this->supports($M)) {
|
||||
return;
|
||||
}
|
||||
if (in_array($M, [0, 2, 6, 30])) {
|
||||
$this->M = 9;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 8 or 9
|
||||
$this->M = $M;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user