LT順をシャッフルして決め、結果を音声で発表するPHPスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$speakers = array_slice($argv, 1); | |
if (!$speakers) { | |
echo "ERROR!\n"; | |
exit(1); | |
} | |
for ($i = 0, $len = count($speakers); $i < $len; $i++) { | |
// do { | |
usleep(100); | |
shuffle($speakers); | |
echo "shuffle!\n"; | |
exec("say shuffle!"); | |
} | |
// } while (equals(array_slice($argv, 1), $speakers)); | |
sleep(1); | |
echo "\n- * - *- * - *- * - *-\n\n"; | |
foreach ($speakers as $idx => $name) { | |
echo "[" . ($idx + 1) . "] " . $name . "\n"; | |
exec("say {$name} san"); | |
} | |
echo "\n- * - *- * - *- * - *-\n\n"; | |
function equals(array $a, array $b) { | |
for ($i = 0; $i < count($a); $i++) { | |
if ($a[$i] === $b[$i]) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment