Re: Isay command

From: Mike Breuer (mbreuer@new.rr.com)
Date: 01/09/02


> I made a command isay which is a special say for gods+ and i wanna
make it
> so levels under god see it as like a scrambled message like
> hello as fklsd

I use the following function, which I wrote as part of my language
implementation.  Feel free to use it, if it does what you want.  It
tends to make much longer words, which I don't care for but have not
gotten around to adjusting.  You need to define some constants as well.
I actually use 102 vowel sounds and 32 consonants, but I trimmed it to
keep this post shorter.

/* Some constants used by make_gibberish(..) */
const char *vow_sounds[] = {"ab", "ack", "ay", "eff", "ib", "ob", "uff",
  "ug", "uj", "yb", "yck", "yd", "yz" };
const int num_vow_sounds = 13;
const char *vowels[] = { "a", "e", "i", "o", "u", "y" };
const char *cons_sounds[] = {"b", "br", "c", "ch", "n", "p", "ps" };
const int num_cons_sounds = 7;


/*
 * Translates the text of argument into gibberish and places the
 * result in buf.  Buf is assumed to have size bytes of storage space.
 * Gibberish is random, so the same phrase will not produce the
 * same result each time.  The number of words spoken is preserved
 * in the gibberish, but the number of letters/syllables will vary.
 */
char *make_gibberish( char *buf, int size, char *argument )
{
  char temp_arg[MAX_STRING_LENGTH];
  char *tok;
  int i, len;

  strcpy(temp_arg, argument);
  *buf = '\0';
  tok = strtok(temp_arg, " ");
  while(tok) {
    len = strlen(tok);
    switch(len) {
      case 1:
      case 2:
      case 3:
        len = number(1, 2);
        break;
      case 4:
      case 5:
        len = number(2, 3);
        break;
      case 6:
      case 7:
      case 8:
        len = number(2, 4);
        break;
      default:
        len = number(3, 5);
        break;
    }

    if (strlen(buf) > size - 5)
      break;  /* Abort if we're running out of room */

    for (i = number(0,1), len += i; i < len; i++ ) {
      if (i % 2) {
        strcat(buf, vow_sounds[number(1,num_vow_sounds) - 1]);
        strcat(buf, vowels[number(0, 5)]);
      } else {
        strcat(buf, cons_sounds[number(1, num_cons_sounds) - 1]);
      }
    }

    if ( (tok = strtok(NULL, " ")) )
      strcat(buf, " ");
  }

  return buf;
}

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT