LITTLE_S.C

LIB3/STD/LANGUAGE/LITTLE_S.C · 1.5 KB

From the archive nm4dos.zip

Download the archive   « Back to the archive contents

string long()
{
    return "The little language spoken by 'small' creatures.\n";
}

int     mod( int i )
{
    return i - 4 * (i / 4);
}

string  lang( string str )
{
/* Vowels only, for the hell of it. */
    switch( strlen( str ) )
    {
	case 1:
	    return({ "e", "o", "a", "u" })[ mod( str[ 0 ] ) ];
	case 2:
	    return({ "uo", "ea", "iu", "ae" })[ mod( str[ 0 ] ) ];
	case 3:
	    return({ "eoa", "iua", "iea", "auo" })[ mod( str[ 0 ] ) ];
	case 4:
	    return({ "uooe", "ieaa", "iuoa", "auie" })[ mod( str[ 0 ] ) ];
	case 5:
	    return({ "eooua", "ouiea", "auuoe", "uoeau" })[ mod( str[ 0 ] ) ];
	case 6:
	    return({ "ouooua", "eauiuo", "iuieou", "aeauae" })[ mod( str[ 0 ] ) ];
	case 7:
	    return({ "eooeauo", "ouaeiua", "iuouiea", "uiuouoe" })[ mod( str[ 0 ] ) ];
	case 8:
	    return({ "uoouiuae", "eaauieoo", "iuuaiuae", "aeaeoeou" })[ mod( str[ 0 ] ) ];
	default:
	    return({ "ee", "ii", "oo", "aa" })[ mod( str[ 0 ] ) ];
    }
}

string  standard_garble( string mess )
{
    string  ret, str;

    ret = "";
    while( sscanf( mess, "%s %s", str, mess ) == 2 )
	ret += lang( str ) + " ";
    return ret + lang( mess );
}

mixed   garble_tell( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_shout( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_say( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_written( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

Site Stats

Snippets: 1791
Codebases: 571