scar Code:
program StoryGenerator;
const
HowMany = 5; //How many stories to make up in a single session?
var
NamesMale, NamesFemale, LastNames, InanimateObjects, VerbCommands, VerbsPast,
VerbsPresent, Adverbs, Adjectives, BeforeAdverbs, Places, Titles,
AnimateObjects: array of String;
{ Mufasa/Simba support }
{$ifDef Mufasa}
function Replace(Text, FindStr, ReplaceStr: String): String;
var
i: Integer;
begin
Result := Text;
repeat
i := Pos(FindStr, Result);
if(i <> 0) then
begin
Delete(Result, i, Length(FindStr));
Insert(ReplaceStr, Result, i);
end;
Until(i = 0);
end;
{$endIf}
function FormatString(Str: String; IdentChar: Char; Arg: array of Variant): String;
var
i, bI: Integer;
begin
Result := Str;
bI := High(Arg)
for i := bI downto 0 do
Result := Replace(Result, IdentChar + IntToStr(i + 1), Arg[i]);
end;
var
D, A: Integer;
function KeepVar(Arr: array of String): String;
begin
if(A = 0) then
begin
A := Random(Length(Arr));
Result := Arr[A];
end else
begin
Result := Arr[A];
A := 0;
end;
end;
begin
NamesMale := ['Daniel', 'Stephen', 'Scott', 'Leo', 'John', 'Steven', 'Paul',
'Mike', 'Michael', 'Nathan', 'Josh', 'Joshua', 'Andrew', 'Alan', 'Eric',
'Simon', 'Pat', 'Patrick', 'Samuel', 'Samual', 'Sam', 'Greg', 'Gregory',
'James', 'Jim', 'Danny', 'Mitchell', 'Tim', 'Timothy', 'Ben', 'Benjamin',
'Chris', 'Christopher', 'Harry', 'Harrison', 'Luke', 'Lucas', 'Evan', 'Martin',
'Kevin', 'Jack', 'Jackson', 'Kyle', 'Mark', 'Marcus', 'Markus', 'Tyler',
'Phillip', 'Phill', 'Phil', 'Tom', 'Aaron', 'Arthur', 'Nick', 'Brett', 'William',
'Richard', 'Oscar'];
NamesFemale := ['Jessica', 'Lily', 'Lucy', 'Kassandra', 'Megan', 'Louise',
'Elizabeth', 'Emma', 'Sue', 'Ashleigh', 'Ashley', 'Joan', 'Joanne', 'Anne',
'Danielle', 'Daniella', 'Patricia', 'Kerry', 'Ruby', 'Grace', 'Ricki',
'Jasmine', 'Terri', 'Mary', 'Linda', 'Maria', 'Barbara', 'Melissa', 'Rebecca',
'Sandra', 'Margaret', 'Susan', 'Jennifer', 'Janet', 'Amy', 'Brenda',
'Christine', 'Catherine', 'Diane', 'Alice', 'Gloria', 'Amanda', 'Judy', 'Kathy',
'Cathy', 'Irene', 'Nicole', 'Jane', 'Sarah', 'Emily', 'Julia', 'Robin', 'Crystal',
'Kim', 'Kimberly', 'Annie', 'Wendy', 'Cindy', 'Josephine', 'Sharon', 'Melanie'];
LastNames := ['Smith', 'Jones', 'Williams', 'Brown', 'Wilson', 'Taylor', 'Johnson',
'White', 'Martin', 'Anderson', 'Thompson', 'Thomas', 'Walker', 'Harris', 'Lee',
'Ryan', 'Robinson', 'Kelly', 'King', 'Miller', 'Tapping', 'Davis', 'Moore',
'Jackson', 'Harris', 'Clark', 'Walker', 'Wright', 'Baker', 'Adams', 'Green',
'Phillips', 'Evans', 'Turner', 'Parker', 'Potter', 'Collins', 'Edwards',
'Murphy', 'Cook', 'Rogers', 'Cooper', 'Bailey', 'Peterson', 'Ward', 'Howard',
'Wood', 'Watson', 'Brooks', 'Gray', 'Fischer', 'Russell', 'Myers', 'Prince',
'Long', 'Foster', 'Butler', 'Sanders', 'Fox'];
InanimateObjects := ['soccer ball', 'football', 'footy', 'baseball bat',
'cricket ball', 'cricket bat', 'shirt', 'skyvvi', 'jumper', 'jacket', 'thongs',
'trousers', 'jeans', 'cd', 'laptop', 'netbook', 'trumpet', 'guitar', 'drum set',
'computer', 'book', 'toothbrush', 'pencil', 'pen', 'spoon', 'fork', 'knife',
'knife set', 'swiss army knife', 'plate', 'bowl', 'television', 'mobile phone',
'phone', 'blanket', 'camera', 'chair', 'dvd', 'GameBoy', 'Nintendo DS', 'Nintendo Wii',
'Xbox', 'Xbox 360', 'Playstation 2', 'Playstation 3', 'photos', 'joggers',
'sandals', 'underwear', 'pillow', 'lamp', 'torch', 'mp3 player', 'mp4 player',
'iPod Nano', 'iPod Touch', 'tape measure', 'telescope', 'swimming costume',
'wallet', 'socks', 'watch', 'Blackberry', 'iPhone', '$100 note', '$50 note',
'$20 note', 'USB stick', 'thumb drive', 'flash drive', 'car keys', '$100',
'$50', '$20', 'packet of gum', 'rock collection', 'bricks'];
AnimateObjects := ['cat', 'dog', 'guinnea pig', 'crab', 'lobster', 'hampster',
'redback', 'funnel-web', 'spider', 'horse', 'donkey', 'wolf', 'fox', 'leapord',
'panther', 'dinosaur', 'T-Rex', 'bee', 'wasp', 'fly', 'tiger',
'lion', 'elephant', 'tortoise', 'butterfly', 'moth', 'mouse', 'rat', 'bird',
'cow', 'sheep', 'llama', 'pig', 'goat', 'paedophile'];
VerbCommands := ['run', 'duck', 'jump', 'kill', 'breathe', 'swim', 'cut',
'smash', 'dump', 'bump', 'hump', 'hop', 'sing', 'dance', 'murder', 'chop',
'swing', 'rape', 'pound'];
VerbsPast := ['ran', 'ducked', 'jumped', 'killed', 'breathed', 'swam', 'cut',
'smashed', 'dumped', 'bumped', 'humped', 'hopped', 'sang', 'danced', 'murdered',
'chopped', 'swung', 'raped', 'pounded'];
VerbsPresent := ['running', 'ducking', 'jumping', 'killing', 'breathing', 'swimming',
'cutting', 'smashing', 'dumping', 'bumping', 'humping', 'hopping', 'singing', 'dancing',
'murdering', 'chopping', 'swinging', 'raping', 'pounding'];
Adverbs := ['delightfully', 'disgustingly', 'very', 'quickly', 'amazingly', 'well',
'extremely', 'often', 'wonderfully', 'beautifully', 'skillfully', 'lately',
'slowly', 'absolutely', 'heartily', 'literally', 'simply', 'kindly', 'mildly',
'completely', 'daringly'];
BeforeAdverbs := ['more', 'least', 'less', 'most'];
Places := ['Australia', 'Uluru', 'England', 'the UK', 'France', 'Netherlands',
'Sydney', 'Brisbane', 'Melbourne', 'the United States', 'Belgium', '1st Street',
'2nd Avenue', '3rd Road', 'Liverpool', 'Adelaide', 'London', 'Rome', 'Perth',
'2nd Street', '1st Avenue', '69th Street', 'Princess Highway', '5th Street',
'Princes'#39's Highway', 'Baker Street', 'Arthur Street', 'Australia Street',
'Australia Avenue', 'Park Avenue', 'King Street', 'Queen Street', 'King Road',
'Queen Road', 'Prince Street', 'Daniel Road'];
Titles := ['Sir', 'Madame', 'Miss', 'Master', 'Ms', 'King', 'Queen', 'Prince',
'Princess', 'Duke', 'Duchess'];
Adjectives := ['horrifically', 'horribly'];
for D := 1 to HowMany do
begin
case (Random(2)) of
0: Writeln(FormatString('Once upon a time, a man named %1 %2 was %3 for ' +
'his %4, when he was %5 %6 by a %7 in %8. Poor old %1 was %9 injured due ' +
'to being %5 %6. %1 then said "If I ever see that %7 again, I will %10 it with my ' +
'%11, and I will get %12 from %13 to help me".', '%', [NamesMale[Random(Length(NamesMale))],
LastNames[Random(Length(LastNames))], VerbsPresent[Random(Length(VerbsPresent))],
InanimateObjects[Random(Length(InanimateObjects))], Adverbs[Random(Length(Adverbs))],
VerbsPast[Random(Length(VerbsPast))], AnimateObjects[Random(Length(AnimateObjects))],
Places[Random(Length(Places))], Adjectives[Random(Length(Adjectives))],
VerbCommands[Random(Length(VerbCommands))], InanimateObjects[Random(Length(InanimateObjects))],
NamesFemale[Random(Length(NamesFemale))], Places[Random(Length(Places))]]));
1: Writeln(FormatString('%1 was %2 in %3 to kill boredom. She noticed a %4 ' +
'behind her, and started to %5. She was %6 away from the %4 as %7 as she ' +
'could. She failed, then the %4 %8 %9 her. She was so scared, and was ' +
'hanging onto her %10 for her life. Eventually, %1 got away. However, she ' +
'could not face her %11, so she ran away from %3 forever.', '%',
[NamesFemale[Random(Length(NamesFemale))], VerbsPresent[Random(Length(VerbsPresent))],
Places[Random(Length(Places))], AnimateObjects[Random(Length(AnimateObjects))],
KeepVar(VerbCommands), KeepVar(VerbsPresent), Adverbs[Random(Length(Adverbs))],
Adverbs[Random(Length(Adverbs))], VerbsPast[Random(Length(VerbsPast))],
InanimateObjects[Random(Length(InanimateObjects))], AnimateObjects[Random(Length(AnimateObjects))]]));
end;
end;
end.