tuandor.c

skylib_mudos_v1/mudlib/std/languages/tuandor.c · 6.3 KB

From the archive skylib_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

/**
 * The language for the cats, power to the cat-people!
 * Liceas, 2002
 * Shiannar, 2002, slightly tweaked garble code.
 */

#include <language.h>

inherit LANGUAGE_INHERIT;

#define MAX 12

string *vowels;

mapping spoken_consonant_matrix, written_consonant_matrix;

string long() {
  return "This is the language spoken by Tuandor!\n";
} /* long() */

void setup() {
  set_long("This is the language of the Tuandor!\n");
  set_name("Tuandorian");
  set_start_text_bit("which looks like ");
  vowels = ({
      "a", "e", "i", "j", "o", "u", "y", "m", "'",
    });
  spoken_consonant_matrix = ([
      "b"  : "rr",
      "bb" : "kl",
      "bl" : "vn",
      "c"  : "wrl",
      "cc" : "xzr",
      "ch" : "me",
      "ck" : "prun",
      "cl" : "chku",
      "cr" : "yaru",
      "ct" : "neki",
      "d"  : "meu",
      "dd" : "prr",
      "dr" : "vvrn",
      "f"  : "meeo",
      "ff" : "nrri",
      "fr" : "mew",
      "g"  : "nur",
      "gg" : "cli",
      "gh" : "khr",
      "gl" : "ymu",
      "gr" : "vrr",
      "h"  : "krun",
      "k"  : "wrrl",
      "l"  : "bee",
      "ll" : "pew",
      "m"  : "arre",
      "mm" : "errw",
      "n"  : "yew",
      "nd" : "nur",
      "nk" : "chnk",
      "nn" : "anno",
      "p"  : "yerr",
      "pp" : "bnn",
      "pr" : "yeru",
      "ps" : "yerc",
      "pt" : "yerv",
      "q"  : "q",
      "r"  : "urrru",
      "rr" : "urli",
      "s"  : "ciro",
      "sh" : "cino",
      "sl" : "civr",
      "sp" : "cire",
      "ss" : "ciri",
      "st" : "cix",
      "t"  : "xrch",
      "th" : "xreu",
      "tr" : "xruru",
      "tt" : "xrchk",
      "v"  : "neerr",
      "vr" : "neeuru",
      "w"  : "meo",
      "wr" : "meow",
      "x"  : "meri",
      "z"  : "nbr",
      "zz" : "nbrr"

  ]);
  written_consonant_matrix = ([
      "b"  : "a single scratch",
      "bb" : "two scratches running parralel",
      "bl" : "a scratch with two scratches intersecting it horizontally",
      "c"  : "a diagonal scratch from left to right",
      "cc" : "a diagonal scratch from right to left",
      "ch" : "two diagonal scratches that intersect",
      "ck" : "three downward scratches",
      "cl" : "three scratches forming a triangle",
      "cr" : "a v-shaped scratch",
      "ct" : "two cris-crossing scratches",
      "d"  : "four horizontally parralel scratches",
      "dd" : "two curved scratches",
      "dr" : "a single vertical scratch",
      "f"  : "a larger scratch with a smaller one next to it",
      "ff" : "two large scratches close beside each other",
      "fr" : "five small scratches that form a star",
      "g"  : "a wide vertical scratch",
      "gg" : "two wide vertical scratches",
      "gh" : "a wide horizontal scratch",
      "gl" : "two wide horizontal scratches and a small scratch",
      "gr" : "a scratch like an arrow pointing up",
      "h"  : "a cross shaped scratch",
      "k"  : "several tiny scratches bunched together",
      "l"  : "a curved scratch",
      "ll" : "a moon-shaped scratch",
      "m"  : "a lightning bolt shaped scratch",
      "mm" : "a small grid of scratches",
      "n"  : "two semi-circular scratches",
      "nd" : "four scratches making a square",
      "nk" : "three scratches forming a triangle",
      "nn" : "four scratches making a rectangle",
      "p"  : "several obscure scratches",
      "pp" : "several scratches making a pyramid shape",
      "pr" : "several scratches in a z-shape",
      "ps" : "five v-shaped scratches",
      "pt" : "several interlinking scratches",
      "q"  : "a scratch that looks like a kite",
      "r"  : "two vertical scratches with 3 crossing scratches",
      "rr" : "a u-shaped scratch",
      "s"  : "a snake-like scratch",
      "sh" : "a h-shaped scratch",
      "sl" : "four sets of M-like scratches joined together",
      "sp" : "two diagonal scratches",
      "ss" : "two snake-like scratches",
      "st" : "a l-shaped curvey scratch",
      "t"  : "a crucifix-esque scratch",
      "th" : "a horizontal then a diagonal scratch",
      "tr" : "two opposing diagonal lines",
      "tt" : "two crucifix-esque scratches",
      "v"  : "an odd, spiral scratch",
      "vr" : "a horizontal scratch with five crossing ones",
      "w"  : "several scratches making a bad O-shape",
      "wr" : "a right to left diagonal followed by a vertical scratch",
      "x"  : "a set of scratches making a C-shape",
      "z"  : "an odd set of curved scratches",
      "zz" : "several scratches making an obtuse shape"
  ]);
} /* create() */

/* Originally used by the Discworld.  God bless them for good */
/* garble code                                                */
string do_garble_speech( string text ) {
  int i, flag;
  string speech, word;

  text = lower_case( text );
  speech = "";

  for ( i = 0; i < strlen( text ); i++ ) {
    if ( member_array( text[ i .. i ], vowels ) != -1 )
      continue;
    if ( ( i + 1 ) < strlen( text ) )
      if ( word = spoken_consonant_matrix[ text[ i .. i + 1 ] ] ) {
        speech += word +"-";
        i++;
        flag = 1;

        continue;
      }
    if ( word = spoken_consonant_matrix[ text[ i .. i ] ] ) {
      speech += word +"-";
      flag = 1;
      continue;
    }
    if ( flag ) {
      flag = 0;
      speech = speech[ 0 .. strlen( speech ) - 2 ];
    }
    speech += text[ i .. i ];
  }
  if ( speech == "" )
    return "merr";
  if ( flag )
    speech = speech[ 0 .. strlen( speech ) - 2 ];
  while ( speech[ 0 .. 0 ] == " " ) {
    speech = speech[ 1 .. strlen( speech ) - 1 ];
  }
  return replace( speech, "  ", " " );
} /* do_garble_speech() */

string do_garble_text( string text) {
  int i, j;
  string word, *parts, *temp, *words;
  parts = ({ text });
  for ( i = 0; i < sizeof( vowels ); i++ ) {
    temp = ({ });
    for ( j = 0; j < sizeof( parts ); j++ ) {
      if ( !parts[ j ] ) {
        parts = delete( parts, j, 1 );
        j--;
      } else
        temp += explode( parts[ j ], vowels[ i ] );
    }
    parts = temp;
  }
  words = ({ });
  for ( i = 0; i < sizeof( parts ); i++ ) {
    if ( !parts[ i ] ) {
      parts = delete( parts, i, 1 );
      i--;
    } else
      if ( word = written_consonant_matrix[ parts[ i ] ] )
        words += ({ word });
  }
  if ( sizeof( words ) > MAX )
    words = words[ 1 .. MAX ] + ({ "etc" });
  return implode( words, ", " );
} /* do_garble_text() */

string do_garble(string text, string type) {
  if (type == "text")
    return do_garble_text(text);
  return do_garble_speech(text);
} /* do_garble() */

Site Stats

Snippets: 1791
Codebases: 571