Skip to content

Instantly share code, notes, and snippets.

@Screwtapello
Created June 21, 2020 12:03
Show Gist options
  • Save Screwtapello/0339732bd1cc93ac538c5c7dd19572fc to your computer and use it in GitHub Desktop.
Save Screwtapello/0339732bd1cc93ac538c5c7dd19572fc to your computer and use it in GitHub Desktop.
Snoof Generator v1.1
/*********************************
*
* Snoof Generator v1.1
*
* Dave Olszewski 4/25/1997
* updated 8/12/1998
*
* A relatively inefficient way
* to make snoof
*
* (gcc werder.c -o werder to compile)
*
*********************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<unistd.h>
int main(){
char *vow[]={"a","e","i","o","u","ee","ai","ie","io","oo","ea",
"oi","oa","ou","a","e","i","o","u"};
#define VoC 19
char *beg[]={"sn","sl","tr","l","bl","fl","cr","b","dr","wr","gr",
"pl","squ","qu","cl","spl","fr","m","k"};
#define BeC 19
char *end[]={"nd","ck","ll","mn","w","ls","sk","rt","rd","zz","gh","ght",
"ny","nct","ch","st","nt","m","ng","ly","d","ff","t"};
#define EnC 23
char *all[]={"sn","d","sp","s","th","r","t","p","sh","ph",
"ct","nk","str","f","h","c","m","n",
"cr","x","st","b","g","k","l","v","w","z"};
#define CoC 28
char werd[20],sent[350];
int numwerd,numsyl,csyl,flip,x,y,pick;
int seed=getpid();
seed+=time(NULL);
srand(seed);
/* how many sentences */
for(y=0;y<1;y++){
numwerd=rand()%5+5;
strcpy(sent,"");
for(x=0;x<numwerd;++x){
if(x) strcat(sent," ");
strcpy(werd,"");
numsyl=rand()%5+3;csyl=numsyl;
/* start with consonant or vowel */
flip=rand()%3;
if(csyl%2) flip=(!flip);
while(csyl){
if(((!flip)&&(csyl%2))||((flip)&&(!(csyl%2)))){
if(csyl==numsyl){
pick=rand()%BeC;
strcat(werd,beg[pick]);}
else if(csyl==1){
pick=rand()%EnC;
strcat(werd,end[pick]);}
else{
pick=rand()%CoC;
strcat(werd,all[pick]);}
}
else{
pick=rand()%VoC;
strcat(werd,vow[pick]);
}
csyl--;
}
strcat(sent,werd);
}
sent[0]-=32;
pick=rand()%3;
if(!pick) strcat(sent,"!");
else if(pick==1) strcat(sent,".");
else strcat(sent,"?");
printf("%s\n",sent);
}
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment