From: zen@death.corp.sun.com (d)
Newsgroups: soc.bi
Subject: bear codes... for fun and profit.
Date: 30 Sep 92 04:58:34 GMT
Distribution: soc
Organization: savage hackers
NNTP-Posting-Host: death.corp.sun.com


  I was looking at mike lloyd's .sig, and wondering what all those bear
symbols meant.  He sent me an article that explained all of it (version
1.9.1 of the bear code), so I wrote a quick perl program to parse bear
codes into english.  It's not very bright, but handles most of the
things in the code, at least according to what the spec says.  It
assumes that there is a space between each bit of the code.  For
instance, if you run this through (santa claus -- taken from the bear
code man page):

Bear code for: B8 d++ f? w++ k--?

Very long beard
DADDY with a vengence!
furry in a bearish sense (no hard visual info available)
BIG TEDDY
totally vanilla (no hard visual info available)


  Anyway, it's at least as relevant as socrates to bisexuality, and I
had a free moment hack this up.  Feel free to send me a real program
that does this, or fixes to this (version .01).

 -- d

======================================================================

#!/usr/local/bin/perl

#
# simple bear decoder, version .01
#

while (<>) {
	print "Bear code for: $_";
	chop;

	# get the code
	$res = (@codes) = split;
	# print "res: $res codes: ",@codes,"\n";

	# parse the various parts
	while ($res--) {
		($next) = shift(@codes);
		($code, $flags) = ($next =~ /([Bftwcdgksmehrpq])(.*)/);
		&print_code($code, $flags);
		}
	print "\n";
	}

sub print_code {

local ($code, $flags) = @_;

# print "args: $code, $flags\n";
# ($flags, $mods) = ($flags =~ /[(]?([0-9\-\+]*)(.*)/);
# print "args: $code, $flags\n";
($flags, $mods) = ($flags =~ /\(?([0-9\-\+]*)(.*)/);

if ($code eq "B") {
	if ($flags == 0) { $output = "Little or no beard"; }
	elsif ($flags == 1) { $output = "VERY slight beard"; }
	elsif ($flags == 2) { $output = "Slight beard"; }
	elsif ($flags == 3) { $output = "Thin beard"; }
	elsif ($flags == 4) { $output = "Mostly full beard"; }
	elsif ($flags == 5) { $output = "Full beard"; }
	elsif ($flags == 6) { $output = "Very full beard"; }
	elsif ($flags == 7) { $output = "Longish/bushy beard"; }
	elsif ($flags == 8) { $output = "Very long beard"; }
	elsif ($flags == 9) { $output = "Belt-buckle-grazing beard"; }
	else { $output = "Unknown beard-type: $flags"; }
	}
elsif ($code eq "f") {
	if ($flags eq "+++") { $output = "furry enough to be a bear"; }
	elsif ($flags eq "++") { $output = "WAY above average fur"; }
	elsif ($flags eq "+") { $output = "above average fur"; }
	elsif ($flags eq "") { $output = "furry in a bearish sense"; }
	elsif ($flags eq "-") { $output = "below average fur"; }
	elsif ($flags eq "--") { $output = "WAY below average fur"; }
	else { $output = "Unknown fur-type: $flags"; }
	}
elsif ($code eq "t") {
	if ($flags eq "++") { $output = "a virtual giant"; }
	elsif ($flags eq "+") { $output = "taller than average"; }
	elsif ($flags eq "") { $output = "fairly tall"; }
	elsif ($flags eq "-") { $output = "shorter than average"; }
	elsif ($flags eq "--") { $output = "small stature"; }
	else { $output = "Unknown hight-type: $flags"; }
	}
	# twcdgksmehrpq])(.*)/);
elsif ($code eq "w") {
	if ($flags eq "++") { $output = "BIG TEDDY"; }
	elsif ($flags eq "+") { $output = "big boned"; }
	elsif ($flags eq "") { $output = "with a tummy"; }
	elsif ($flags eq "-") { $output = "thin"; }
	elsif ($flags eq "--") { $output = "bony"; }
	else { $output = "Unknown weight-type: $flags"; }
	}
elsif ($code eq "c") {
	if ($flags eq "++") { $output = "daddy's boy"; }
	elsif ($flags eq "+") { $output = "definite cub"; }
	elsif ($flags eq "") { $output = "cub tendencies"; }
	elsif ($flags eq "-") { $output = "looks like a cub -- but isn't"; }
	else { $output = "Unknown cub-type: $flags"; }
	}
elsif ($code eq "d") {
	if ($flags eq "++") { $output = "DADDY with a vengence!"; }
	elsif ($flags eq "+") { $output = "definite daddy"; }
	elsif ($flags eq "") { $output = "daddyish tendencies"; }
	elsif ($flags eq "-") { $output = "looks like a daddy, but isn't"; }
	else { $output = "Unknown daddy-type: $flags"; }
	}
elsif ($code eq "g") {
	if ($flags eq "++") { $output = "love to grope/paw/touch/etc."; }
	elsif ($flags eq "+") { $output = "likes to be touched most of the time"; }
	elsif ($flags eq "") { $output = "generally outgoing with ursine affection"; }
	elsif ($flags eq "-") { $output = "generally doesn't like invasion of space"; }
	elsif ($flags eq "--") { $output = "touch and die"; }
	else { $output = "Unknown grope-type: $flags"; }
	}
elsif ($code eq "k") {
	if ($flags eq "++") { $output = "likes EVERYTHING"; }
	elsif ($flags eq "+") { $output = "willing to consider new ideas"; }
	elsif ($flags eq "") { $output = "open minded"; }
	elsif ($flags eq "-") { $output = "has ABSOLUTE dislikes"; }
	elsif ($flags eq "--") { $output = "totally vanilla"; }
	else { $output = "Unknown kinky-type: $flags"; }
	}
elsif ($code eq "s") {
	if ($flags eq "++") { $output = "open relationships ONLY"; }
	elsif ($flags eq "+") { $output = "will form open relationships"; }
	elsif ($flags eq "") { $output = "nuetral about relationships/monogomy"; }
	elsif ($flags eq "-") { $output = "prefers formally defined relationships"; }
	elsif ($flags eq "--") { $output = "strictly monogomous"; }
	else { $output = "Unknown sex/slut-type: $flags"; }
	}
elsif ($code eq "m") {
	if ($flags eq "++") { $output = "Arnold Schwartzinegar clone"; }
	elsif ($flags eq "+") { $output = "definitely works out"; }
	elsif ($flags eq "") { $output = "some definition/muscle tone"; }
	elsif ($flags eq "-") { $output = "not very muscular"; }
	else { $output = "Unknown muscle-type: $flags"; }
	}
elsif ($code eq "e") {
	if ($flags eq "++") { $output = "incredibly endowed"; }
	elsif ($flags eq "+") { $output = "endowment gets attention"; }
	elsif ($flags eq "") { $output = "noteworthily endowed"; }
	else { $output = "Unknown endowment-type: $flags"; }
	}
elsif ($code eq "h") {
	if ($flags eq "+") { $output = "definite BEHR"; }
	elsif ($flags eq "") { $output = "behr"; }
	elsif ($flags eq "-") { $output = "no beard or mustache"; }
	else { $output = "Unknown behr-type: $flags"; }
	}
elsif ($code eq "r") {
	if ($flags eq "++") { $output = "Grizzly Adams"; }
	elsif ($flags eq "+") { $output = "flannel/jeans/C&W *are* second skin"; }
	elsif ($flags eq "") { $output = "spends time outdoors/camping"; }
	elsif ($flags eq "-") { $output = "prefers indoor activity"; }
	elsif ($flags eq "--") { $output = "never seen in the outdoors"; }
	else { $output = "Unknown rugged/outdoor-type: $flags"; }
	}
elsif ($code eq "p") { $output = "Some idiosynchracies"; }
elsif ($code eq "q") { $output = "contains the \"Q\" factor"; }
else { $output = "Unknown bear-code: $code"; }

if ($mods eq "v") { $output .= " (variable)"; }
elsif ($mods eq "?") { $output .= " (no hard visual info available)"; }
elsif ($mods eq ":") { $output .= " (observed but uncertain)"; }
elsif ($mods eq "!") { $output .= " (prototypical)"; }
elsif ($mods eq ")") { $output .= " (range)"; }
elsif ($mods ne "") { $output .= " (unknown modifier)"; }

# print "$output [$code$flags$mods]\n";
print "$output\n";

}