GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — beatnik/bbv205 at master · flimshaw/beatnik Expand file tree/ Copy pathbbv205More file actions 290 lines (258 loc) · 8.01 KB / Copy pathbbv205File metadata and controls290 lines (258 loc) · 8.01 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 #!/usr/bin/perl ####################################################### # # "The shoe-maker on earth that had the soul of a poet # in him won't have to make shoes here." # # -Mark Twain # ####################################################### # # Beatnik Box - Version 2.05 Alpha # # Programming Begins 11.10.03 at 8:32pm # at 859 N. 21st Street, Apt #2, Philadelphia, PA 19130 # # The Brainchild of Charles RMC Hoey # Intended for a Video Installation # ####################################################### # # Day 6: 11.16.03 6:15pm # Ben Folds Five # # Last night I went to a hippy party at a lesbian's # apartment, and eventually there were two lesbians # wrestling in the middle of the room, and then they # broke out guitars and started playing folk music # and THAT'S entertainment. # ####################################################### # # 10:17pm # # Working from Jane's place, drinking cheap wine. # I'll see if I can fix that lonesome article problem. # ####################################################### # read the text files into the word array open(ARTICLES, 'article'); @article = <ARTICLES>; close(ARTICLES); open(VERBT, 'verbs.trans'); @verbstrans = <VERBT>; close(VERBT); open(VERBINT, 'verbs.intrans'); @verbsintrans = <VERBINT>; close(VERBINT); open(ADJ, 'adjective'); @adjectives = <ADJ>; close(ADJ); open(ADV, 'adverb'); @adverbs = <ADV>; close(ADV); open(NOUNT, 'nouns.things'); @nounthings = <NOUNT>; close(NOUNT); open(NOUNPE, 'nouns.people'); @nounpeople = <NOUNPE>; close(NOUNPE); open(NOUNPL, 'nouns.places'); @nounplaces = <NOUNPL>; close(NOUNPL); open(PREP, 'preposition'); @prepositions = <PREP>; close(PREP); open(CONJ, 'conjunction'); @conjunction = <CONJ>; close(CONJ); # Ezra Pound determines how many lines/words the poem will be sub pound{ $lines = int( rand(15)) + 3; $words = int( rand(8)) + 3; } # Allan Ginsberg decides the poem structure for Ezra's value sub ginsberg{ # define the poem array per Pound's instructions $poem[$_[0]][$_[1]]; # pick a random number of words for each line for($lines; $i < $lines; $i++) { $wordcount[$i] = int( rand($words)) +1; } $i = 0; # define each line for($lines; $i < $lines; $i++) { # $flaggo lets it know it's the first word in a line $flaggo = 1; for($wordcount[$i]; $x < $wordcount[$i]; $x++) { # determine what type of word it will be # The following is a key for word types: # 0 = article # 1 = verb.trans # 2 = verb.intrans # 3 = adjective # 4 = adverb # 5 = noun.thing # 6 = noun.person # 7 = noun.place # 8 = preposition # 9 = conjunction # if it's not the first word, then strunk it... if (!($flaggo)) { $type = strunk($i, $x); # if it's the only word in a sentence... } elsif($wordcount[$i] == 1) { @goods = (1, 2, 3, 4); $val = int( rand(4)) + 0; $type = $goods[$val]; # otherwise, pick a random word type yourself } else { $type = int( rand(9)) + 0; $flaggo--; } $poem[$i][$x] = $type; } # reset the word counter for the next line $x = 0; } } # Strunk checks to see what words are valid for input by looking at # the part of speech of the previous word used sub strunk{ $privy = $_[1] - 1; $prevword = $poem[$_[0]][$privy]; # if there's only one word on the line if($wordcount[$_[0]] < 2) { @goods = (1, 2, 9); $val = int( rand(3)) + 0; return $goods[$val]; # if the previous word is an article or if it's the last word } elsif($prevword == 0) { @goods = (3, 4, 5, 6, 7); $val = int( rand(5)) + 0; return $goods[$val]; } elsif($prevword == 1) { @goods = (3, 4, 5, 6, 7, 9); $val = int( rand(6)) + 0; return $goods[$val]; } elsif($prevword == 2) { @goods = (4, 8, 9); $val = int ( rand(3)) + 0; return $goods[$val]; } elsif($prevword == 3) { @goods = (5, 6, 7); $val = int ( rand(3)) + 0; return $goods[$val]; } elsif($prevword == 4) { @goods = (1, 2, 3, 4); $val = int ( rand(4)) + 0; return $goods[$val]; } elsif($prevword > 4 && $prevword < 8) { @goods = (9, 4); $val = int ( rand(2)) + 0; return $goods[$val]; } elsif($prevword == 8) { @goods = (3, 5, 6, 7); $val = int ( rand(4)) + 0; return $goods[$val]; } else { $val = int ( rand(9)) + 0; return $val; } } # Jack Kerouac decides which words to place into the poem Ginsberg and # Strunk have designed. sub kerouac{ # for each line for($lines; $b < $lines; $b++) { $c = 0; # for each word in this line for($wordcount[$b]; $c < $wordcount[$b]; $c++){ print "($poem[$b][$c])"; if($poem[$b][$c] == 1) { $scratch = int ( rand(@verbstrans)) + 0; chomp($verbstrans[$scratch]); $poem[$b][$c] = $verbstrans[$scratch]; } elsif($poem[$b][$c] == 2) { $scratch = int ( rand(@verbsintrans)) + 0; chomp($verbsintrans[$scratch]); $poem[$b][$c] = $verbsintrans[$scratch]; } elsif($poem[$b][$c] == 3) { $scratch = int ( rand(@adjectives)) + 0; chomp($adjectives[$scratch]); $poem[$b][$c] = $adjectives[$scratch]; } elsif($poem[$b][$c] == 4) { $scratch = int ( rand(@adverbs)) + 0; chomp($adverbs[$scratch]); $poem[$b][$c] = $adverbs[$scratch]; } elsif($poem[$b][$c] == 5) { $scratch = int ( rand(@nounthings)) + 0; chomp($nounthings[$scratch]); $poem[$b][$c] = $nounthings[$scratch]; } elsif($poem[$b][$c] == 6) { $scratch = int ( rand(@nounpeople)) + 0; chomp($nounpeople[$scratch]); $poem[$b][$c] = $nounpeople[$scratch]; } elsif($poem[$b][$c] == 7) { $scratch = int ( rand(@nounplaces)) + 0; chomp($nounplaces[$scratch]); $poem[$b][$c] = $nounplaces[$scratch]; } elsif($poem[$b][$c] == 8) { $scratch = int ( rand(@prepositions)) + 0; chomp($prepositions[$scratch]); $poem[$b][$c] = $prepositions[$scratch]; } elsif($poem[$b][$c] == 9) { $scratch = int ( rand(@conjunction)) + 0; chomp($conjunction[$scratch]); $poem[$b][$c] = $conjunction[$scratch]; } else { $scratch = int ( rand(@article)) + 0; chomp($article[$scratch]); $poem[$b][$c] = $article[$scratch]; } } print "\n"; } # give Jack a joint for his efforts open (FILE, 'kerouacs_reefer'); $kerouacs_reefer = <FILE>; close (FILE); if (open (FILE, ">kerouacs_reefer")) { $kerouacs_reefer++; print FILE $kerouacs_reefer; close (FILE); print "\n\n Poem #$kerouacs_reefer\n"; } else { print "[ Can't write to the data file! Counter not incremented! ]\n"; } } # Ed Kloman makes sure you handle A and An the right way. sub kloman { $b = 0; for($lines; $b < $lines; $b++) { $c = 0; for($wordcount[$b]; $c < $wordcount[$b]; $c++){ if($poem[$b][$c] eq "a") { @voweltest = split(//, $poem[$b][$c+1]); if($voweltest[0] eq "a" || $voweltest[0] eq "e" || $voweltest[0] eq "i" || $voweltest[0] eq "o" || $voweltest[0] eq "u" || $voweltest[0] eq "A" || $voweltest[0] eq "E" || $voweltest[0] eq "I" || $voweltest[0] eq "O" || $voweltest[0] eq "U") { $poem[$b][$c] = "an"; } } } } } # Johan Gutenberg prints the poem out to the screen. sub gutenberg { $b = 0; for($lines; $b < $lines; $b++) { $c = 0; for($wordcount[$b]; $c < $wordcount[$b]; $c++) { print " $poem[$b][$c]($c)"; } print "($wordcount[$b])\n"; } } pound(); ginsberg($lines, $words); kerouac(); kloman(); gutenberg(); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |