Toribash
Re: Mr-Deanster HaX~~!
this has gone from random to sensless rambling! I am not happy with the way this topic is heading! You have 24hrs to change it people!
Re: Mr-Deanster HaX~~!
random sentence generator source code:

=0= #### LISTING ONE ####
=1= #!/usr/bin/perl -w
=2= use strict;
=3= $|++;
=4=
=5= use Parse::RecDescent 1.65;
=6= use Getopt::Long;
=7=
=8= GetOptions(
=9= "start=s" => \ (my $START = "START"),
=10= ) or die "see code for usage\n";
=11=
=12= ## define the grammar of the spew grammar:
=13=
=14= (my $parser = Parse::RecDescent->new(<<'END_OF_GRAMMAR')) or die "bad!";
=15=
=16= ## return hashref
=17= ## { ident => {
=18= ## is => [
=19= ## [weight => item, item, item, ...],
=20= ## [weight => item, item, item, ...], ...
=21= ## ],
=22= ## defined => { line-number => times }
=23= ## used => { line-number => times }
=24= ## }, ...
=25= ## }
=26= ## item is " literal" or ident
=27= ## ident is C-symbol or number (internal for nested rules)
=28=
=29= { my %grammar; my $internal = 0; }
=30=
=31= grammar: rule(s) /\Z/ { \%grammar; }
=32=
=33= ## rule returns identifier (not used)
=34= rule: identifier ":" defn {
=35= push @{$grammar{$item[1]}{is}}, @{$item[3]};
=36= $grammar{$item[1]}{defined}{$itempos[1]{line}{to}}++;
=37= $item[1];
=38= }
=39= | <error>
=40=
=41= ## defn returns listref of choices
=42= defn: <leftop: choice "|" choice>
=43=
=44= ## choice returns a listref of [weight => @items]
=45= choice: weight unweightedchoice { [ $item[1] => @{$item[2]} ] }
=46=
=47= ## weight returns weight if present, 1 if not
=48= weight: /\d+(\.\d+)?/ <commit> /\@/ { $item[1] } | { 1 }
=49=
=50= ## unweightedchoice returns a listref of @items
=51= unweightedchoice: item(s)
=52=
=53= ## item returns " literal text" or "identifier"
=54= item:
=55= { $_ = extract_quotelike($text) and " " . eval }
=56= | identifier <commit> ...!/:/ { # must not be followed by colon!
=57= $grammar{$item[1]}{used}{$itempos[1]{line}{to}}++;
=58= $item[1]; # non-leading space flags an identifier
=59= }
=60= | "(" defn ")" { # parens for recursion, gensym an internal
=61= ++$internal;
=62= push @{$grammar{$internal}{is}}, @{$item[2]};
=63= $internal;
=64= }
=65= | <error>
=66=
=67= identifier: /[^\W\d]\w*/
=68=
=69= END_OF_GRAMMAR
=70=
=71= my @data = <>;
=72= for (@data) {
=73= s/^\s*#.*//;
=74= }
=75=
=76= (my $parsed = $parser->grammar(join '', @data)) or die "bad parse";
=77=
=78= for my $id (sort keys %$parsed) {
=79= next if $id =~ /^\d+$/; # skip internals
=80= my $id_ref = $parsed->{$id};
=81= unless (exists $id_ref->{defined}) {
=82= print "$id used in @{[sort keys %{$id_ref->{used}}]} but not defined - FATAL\n";
=83= }
=84= unless (exists $id_ref->{used} or $id eq $START) {
=85= print "$id defined in @{[sort keys %{$id_ref->{defined}}]} but not used - WARNING\n";
=86= }
=87= }
=88=
=89= #DEBUGGING:# use Data:umper; print Dumper($parsed);
=90= show($START);
=91=
=92= sub show {
=93= my $defn = shift;
=94= die "missing defn for $defn" unless exists $parsed->{$defn};
=95=
=96= my @choices = @{$parsed->{$defn}{is}};
=97= my $weight = 0;
=98= my @keeper = ();
=99= while (@choices) {
=100= my ($thisweight, @thisitem) = @{pop @choices};
=101= $thisweight = 0 if $thisweight < 0; # no funny stuff
=102= $weight += $thisweight;
=103= @keeper = @thisitem if rand($weight) < $thisweight;
=104= }
=105= for (@keeper) {
=106= ## should be a list of ids or defns
=107= die "huh $_ in $defn" if ref $defn;
=108= if (/^ (.*)/s) {
=109= print $1;
=110= } elsif (/^(\w+)$/) {
=111= show($1);
=112= } else {
=113= die "Can't show $_ in $defn\n";
=114= }
=115= }
=116= }
=0= #### LISTING TWO ####
=1= ## Our challenge is to effectively reverse-engineer the output of:
=2= ## http://www.dilbert.com/comics/dilber...er/bin/ms2.cgi
=3= ## as well as dynamically provide interactive feedback. :-)
=4=
=5= START: missions
=6=
=7= missions: mission "\n\n" mission "\n\n" mission "\n\n" mission "\n"
=8=
=9= mission:
=10= Our_job_is_to " " do_goals "." |
=11= 2 @ Our_job_is_to " " do_goals " " because "."
=12=
=13= Our_job_is_to:
=14= ("It is our " | "It's our ") job " to" |
=15= "Our " job (" is to" | " is to continue to") |
=16= "The customer can count on us to" |
=17= ("We continually " | "We ") ("strive" | "envision" | "exist") " to" |
=18= "We have committed to" |
=19= "We"
=20=
=21= job:
=22= "business" | "challenge" | "goal" | "job" | "mission" | "responsibility"
=23=
=24= do_goals:
=25= goal | goal " " in_order_to " " goal
=26=
=27= in_order_to:
=28= "as well as to" |
=29= "in order that we may" |
=30= "in order to" |
=31= "so that we may endeavor to" |
=32= "so that we may" |
=33= "such that we may continue to" |
=34= "to allow us to" |
=35= "while continuing to" |
=36= "and"
=37=
=38= because:
=39= "because that is what the customer expects" |
=40= "for 100% customer satisfaction" |
=41= "in order to solve business problems" |
=42= "to exceed customer expectations" |
=43= "to meet our customer's needs" |
=44= "to set us apart from the competition" |
=45= "to stay competitive in tomorrow's world" |
=46= "while promoting personal employee growth"
=47=
=48= goal: adverbly " " verb " " adjective " " noun
=49=
=50= adverbly:
=51= "quickly" | "proactively" | "efficiently" | "assertively" |
=52= "interactively" | "professionally" | "authoritatively" |
=53= "conveniently" | "completely" | "continually" | "dramatically" |
=54= "enthusiastically" | "collaboratively" | "synergistically" |
=55= "seamlessly" | "competently" | "globally"
=56=
=57=
=58= verb:
=59= "maintain" | "supply" | "provide access to" | "disseminate" |
=60= "network" | "create" | "engineer" | "integrate" | "leverage other's" |
=61= "leverage existing" | "coordinate" | "administrate" | "initiate" |
=62= "facilitate" | "promote" | "restore" | "fashion" | "revolutionize" |
=63= "build" | "enhance" | "simplify" | "pursue" | "utilize" | "foster" |
=64= "customize" | "negotiate"
=65=
=66= adjective:
=67= "professional" | "timely" | "effective" | "unique" | "cost-effective" |
=68= "virtual" | "scalable" | "economically sound" |
=69= "inexpensive" | "value-added" | "business" | "quality" | "diverse" |
=70= "high-quality" | "competitive" | "excellent" | "innovative" |
=71= "corporate" | "high standards in" | "world-class" | "error-free" |
=72= "performance-based" | "multimedia-based" | "market-driven" |
=73= "cutting edge" | "high-payoff" | "low-risk high-yield" |
=74= "long-term high-impact" | "prospective" | "progressive" | "ethical" |
=75= "enterprise-wide" | "principle-centered" | "mission-critical" |
=76= "parallel" | "interdependent" | "emerging" |
=77= "seven-habits-conforming" | "resource-leveling"
=78=
=79= noun:
=80= "content" | "paradigms" | "data" | "opportunities" |
=81= "information" | "services" | "materials" | "technology" | "benefits" |
=82= "solutions" | "infrastructures" | "products" | "deliverables" |
=83= "catalysts for change" | "resources" | "methods of empowerment" |
=84= "sources" | "leadership skills" | "meta-services" | "intellectual capital"
=0= #### LISTING THREE ####
=1= #!/usr/bin/perl -w
=2= use strict;
=3= $|++;
=4=
=5= use Parse::RecDescent;
=6=
=7= (my $parser = Parse::RecDescent->new(<<'END_OF_GRAMMAR')) or die "bad!";
=8=
=9= start: <leftop: junk rule junk> /\Z/ { 1 }
=10=
=11= junk: /[^{}]*/ { 1 }
=12=
=13= rule: "{" defining choices "}" { print "$item[2]: $item[3]\n\n" }
=14= | <error>
=15=
=16= defining: symbol ";" <commit> { $item[1] } | symbol
=17=
=18= symbol: /^<(\S+)>/ {
=19= my $x = $1;
=20= $x =~ s/([^a-zA-Z])/sprintf "_%02x_", ord $1/ge;
=21= if ($x eq "start") {
=22= $x = "START";
=23= }
=24= ## warn "saw symbol $x\n";
=25= $x;
=26= }
=27=
=28= choices: choice(s) { join " |\n ", @ {$item[1]} } | { q{""} }
=29=
=30= choice: item(s) ";" { join q{ " " }, @ {$item[1]} }
=31= | <error>
=32=
=33= item: symbol | wordlist | <error>
=34=
=35= wordlist: word(s) { "q{" . join( " ", @ {$item[1]} ) . "}" }
=36=
=37= word: /^"(\S+)"/ <commit> { $1 } | /^[^\s<>{};]+/
=38=
=39= END_OF_GRAMMAR
=40=
=41= (my $parsed = $parser->start(join '', <>)) or die "bad parse";
=42=
=43= ## see http://www-cs-faculty.stanford.edu/~.../rsg/grammars/
> implying I have a signature
Re: Coding Examples Please!
Oh?

"Coding Examples Please!"
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
Re: Coding Examples Please!
Who here is actually going to help with that? Only person i can think of is suo, so its a waste of times... >_<
Jarmund>{#toribash} Dr-Meanster: finish your sentences before pressing enter.
Re: Coding Examples Please!
Originally Posted by Thief
note of the day : Don' fall of the toilet >_>

<.<

WTF?

Do I want to know where you learned that?
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
Re: Coding Examples Please!
god damnit my brother is just going crazy with the posting with my account. The real note of the day : Water is wet
I strongly advise you NOT to click Here.
Re: Coding Examples Please!
Originally Posted by Sparrow_Hawk
I am creating the Fountain of Youth (Now In 3D!!!) so all be nice to me if u want eternal youth!!!!!


But suo is already immortal...
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!