#!/usr/bin/perl -w #PID Roulette - Staring Bob the Cow; by Ben Jacobs 2001 use ExtUtils::testlib; use Curses; srand( time() ^ ($$ + ($$ << 15)) ); $ps = sprintf('ps -Ao "%%p %%c" |'); open BLAH, $ps; chomp(@file = ); close(BLAH); shift(@file); $doober = @file; $randomnum = rand($doober); foreach $blah (@file) { $i++; ($pids[$i], $names[$i]) = $blah =~ m/\s+(\d+)\s+(\w+)/g; } $last = @pids; $randomnum = rand($last); print "PID Roulette\n"; print "Staring Bob the Cow\n"; initscr(); noecho(); cbreak(); $cow[0][0] = " (__)"; $cow[0][1] = " ______( oo"; $cow[0][2] = "---| \\_|"; $cow[0][3] = " | |"; $cow[0][4] = " / _______ \\"; $cow[0][5] = " / / \\ \\"; $cow[2][0] = " (__)"; $cow[2][1] = " ______( oo"; $cow[2][2] = "---| \\_|"; $cow[2][3] = " | |"; $cow[2][4] = " \\ __ /"; $cow[2][5] = " \\ \\ / /"; $cow[1][0] = " (__)"; $cow[1][1] = " ______( oo"; $cow[1][2] = "---| \\_|"; $cow[1][3] = " | |"; $cow[1][4] = " / ______ |"; $cow[1][5] = " / / / /"; $cow[3][0] = " (__)"; $cow[3][1] = " ______( oo"; $cow[3][2] = "---| \\_|"; $cow[3][3] = " | |"; $cow[3][4] = " \\ ____ \\"; $cow[3][5] = " \\ \\ \\ \\"; $cow[4][0] = "(__)"; $cow[4][1] = "oo )______"; $cow[4][2] = "|_/ |---"; $cow[4][3] = " | |"; $cow[4][4] = " | ___ |"; $cow[4][5] = " | | | |"; $cow[5][0] = "(__)"; $cow[5][1] = "oo )______"; $cow[5][2] = "|_/ |---"; $cow[5][3] = " | |___"; $cow[5][4] = " | __________"; $cow[5][5] = " | |"; $cow[6][0] = " | | | |"; $cow[6][1] = " | ---- |"; $cow[6][2] = " _ |"; $cow[6][3] = "| \\ |---"; $cow[6][4] = "** )------"; $cow[6][5] = "(--)"; for ( $j = 0; $j < 16; $j+=2) { for ( $x = 0; $x < 4; $x++) { clear(); for ($i = 0; $i < 6; $i++) { addstr($i + 2, $j, $cow[$x][$i]); } addstr(0, 0, "PID Roulette - Staring Bob the Cow"); addstr(5, 30, $pids[$randomnum]); addstr(10, 0, "Bob is now going to kill \"$names[$randomnum]\", who's pid is \"$pids[$randomnum]\""); refresh(); select(undef, undef, undef, .1); } } select(undef, undef, undef, 1.5); clear(); addstr(5, 30, $pids[$randomnum]); for ($i = 0; $i < 6; $i++) { addstr($i + 2, 16, $cow[4][$i]); } addstr(0, 0, "PID Roulette - Staring Bob the Cow"); addstr(10, 0, "Bob is now going to kill \"$names[$randomnum]\", who's pid is $pids[$randomnum]"); refresh(); select(undef, undef, undef, 1.0); clear(); if (kill 9, $pids[$randomnum]) { kill 9, $pids[$randomnum]; addstr(5, 30, "*POP*"); for ($i = 0; $i < 6; $i++) { addstr($i + 2, 16, $cow[5][$i]); } addstr(10, 0, "mwhahahahahahaha!"); } else { addstr(5, 30, $pids[$randomnum]); for ($i = 0; $i < 6; $i++) { addstr($i + 2, 16, $cow[6][$i]); } addstr(10, 0, "Awwwwww ... Bob couldn't kill that PID. You should be playing as root. :-("); } addstr(0, 0, "PID Roulette - Staring Bob the Cow"); refresh(); select(undef, undef, undef, 5); endwin(); print "\nThanks for playing PID Roulette with Bob the Cow.\n\n";