Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Roulette of alternatives
<?php
$alternatives = explode("\n", trim(file_get_contents('alternatives.txt')));
$size = count($alternatives);
$delay = 1;
$i = 0;
function print_alt($word, $final = false) {
system("clear");
system(sprintf("toilet --font smblock --%s %s", $final ? 'metal' : 'gay', $word));
}
while ( $delay < 300000 ) {
usleep($delay);
do {
$new_rand = rand(0, $size - 1);
} while( $new_rand == $i );
$i = $new_rand;
print_alt($alternatives[$i]);
$delay += 10000;
}
print_alt($alternatives[$i], true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.